From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- .../impl-derived-implicit-sized-bound-2.rs | 33 +++ .../impl-derived-implicit-sized-bound-2.stderr | 31 +++ .../impl-derived-implicit-sized-bound.rs | 36 +++ .../impl-derived-implicit-sized-bound.stderr | 31 +++ src/test/ui/trait-bounds/issue-75961.rs | 7 + src/test/ui/trait-bounds/issue-93008.rs | 15 ++ src/test/ui/trait-bounds/issue-94680.rs | 14 ++ src/test/ui/trait-bounds/issue-94999.rs | 34 +++ src/test/ui/trait-bounds/issue-95640.rs | 31 +++ src/test/ui/trait-bounds/mismatch-fn-trait.rs | 28 +++ src/test/ui/trait-bounds/mismatch-fn-trait.stderr | 81 ++++++ .../shadowed-path-in-trait-bound-suggestion.fixed | 16 ++ .../shadowed-path-in-trait-bound-suggestion.rs | 14 ++ .../shadowed-path-in-trait-bound-suggestion.stderr | 19 ++ src/test/ui/trait-bounds/unsized-bound.rs | 32 +++ src/test/ui/trait-bounds/unsized-bound.stderr | 273 +++++++++++++++++++++ 16 files changed, 695 insertions(+) create mode 100644 src/test/ui/trait-bounds/impl-derived-implicit-sized-bound-2.rs create mode 100644 src/test/ui/trait-bounds/impl-derived-implicit-sized-bound-2.stderr create mode 100644 src/test/ui/trait-bounds/impl-derived-implicit-sized-bound.rs create mode 100644 src/test/ui/trait-bounds/impl-derived-implicit-sized-bound.stderr create mode 100644 src/test/ui/trait-bounds/issue-75961.rs create mode 100644 src/test/ui/trait-bounds/issue-93008.rs create mode 100644 src/test/ui/trait-bounds/issue-94680.rs create mode 100644 src/test/ui/trait-bounds/issue-94999.rs create mode 100644 src/test/ui/trait-bounds/issue-95640.rs create mode 100644 src/test/ui/trait-bounds/mismatch-fn-trait.rs create mode 100644 src/test/ui/trait-bounds/mismatch-fn-trait.stderr create mode 100644 src/test/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.fixed create mode 100644 src/test/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.rs create mode 100644 src/test/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr create mode 100644 src/test/ui/trait-bounds/unsized-bound.rs create mode 100644 src/test/ui/trait-bounds/unsized-bound.stderr (limited to 'src/test/ui/trait-bounds') diff --git a/src/test/ui/trait-bounds/impl-derived-implicit-sized-bound-2.rs b/src/test/ui/trait-bounds/impl-derived-implicit-sized-bound-2.rs new file mode 100644 index 000000000..557d89088 --- /dev/null +++ b/src/test/ui/trait-bounds/impl-derived-implicit-sized-bound-2.rs @@ -0,0 +1,33 @@ +struct Victim<'a, T: Perpetrator + ?Sized> { + value: u8, + perp: &'a T, +} + +trait VictimTrait { + type Ret; + fn get(self) -> Self::Ret; +} + +// Actual fix is here +impl<'a, T: Perpetrator /*+ ?Sized*/> VictimTrait for Victim<'a, T> { + type Ret = u8; + fn get(self) -> Self::Ret { + self.value + } +} + +trait Perpetrator { + fn getter<'a>(&'a self) -> Victim<'a, Self> { + Victim { + value: 0, + perp: self, + } + } + + fn trigger(&self) { + self.getter().get(); + //~^ ERROR the method `get` exists for struct `Victim<'_, Self>`, but its trait bounds were not satisfied + } +} + +fn main() {} diff --git a/src/test/ui/trait-bounds/impl-derived-implicit-sized-bound-2.stderr b/src/test/ui/trait-bounds/impl-derived-implicit-sized-bound-2.stderr new file mode 100644 index 000000000..543ceac8e --- /dev/null +++ b/src/test/ui/trait-bounds/impl-derived-implicit-sized-bound-2.stderr @@ -0,0 +1,31 @@ +error[E0599]: the method `get` exists for struct `Victim<'_, Self>`, but its trait bounds were not satisfied + --> $DIR/impl-derived-implicit-sized-bound-2.rs:28:19 + | +LL | struct Victim<'a, T: Perpetrator + ?Sized> { + | ------------------------------------------ + | | + | method `get` not found for this struct + | doesn't satisfy `Victim<'_, Self>: VictimTrait` +... +LL | self.getter().get(); + | ^^^ method cannot be called on `Victim<'_, Self>` due to unsatisfied trait bounds + | +note: trait bound `Self: Sized` was not satisfied + --> $DIR/impl-derived-implicit-sized-bound-2.rs:12:10 + | +LL | impl<'a, T: Perpetrator /*+ ?Sized*/> VictimTrait for Victim<'a, T> { + | ^ ----------- ------------- + | | + | unsatisfied trait bound introduced here +help: consider relaxing the type parameter's implicit `Sized` bound + | +LL | impl<'a, T: ?Sized + Perpetrator /*+ ?Sized*/> VictimTrait for Victim<'a, T> { + | ++++++++ +help: consider restricting the type parameter to satisfy the trait bound + | +LL | struct Victim<'a, T: Perpetrator + ?Sized> where Self: Sized { + | +++++++++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/trait-bounds/impl-derived-implicit-sized-bound.rs b/src/test/ui/trait-bounds/impl-derived-implicit-sized-bound.rs new file mode 100644 index 000000000..28da41a0c --- /dev/null +++ b/src/test/ui/trait-bounds/impl-derived-implicit-sized-bound.rs @@ -0,0 +1,36 @@ +struct Victim<'a, T: Perpetrator + ?Sized> +where + Self: Sized +{ + value: u8, + perp: &'a T, +} + +trait VictimTrait { + type Ret; + fn get(self) -> Self::Ret; +} + +// Actual fix is here +impl<'a, T: Perpetrator /*+ ?Sized*/> VictimTrait for Victim<'a, T> { + type Ret = u8; + fn get(self) -> Self::Ret { + self.value + } +} + +trait Perpetrator { + fn getter<'a>(&'a self) -> Victim<'a, Self> { + Victim { + value: 0, + perp: self, + } + } + + fn trigger(&self) { + self.getter().get(); + //~^ ERROR the method `get` exists for struct `Victim<'_, Self>`, but its trait bounds were not satisfied + } +} + +fn main() {} diff --git a/src/test/ui/trait-bounds/impl-derived-implicit-sized-bound.stderr b/src/test/ui/trait-bounds/impl-derived-implicit-sized-bound.stderr new file mode 100644 index 000000000..f08d68583 --- /dev/null +++ b/src/test/ui/trait-bounds/impl-derived-implicit-sized-bound.stderr @@ -0,0 +1,31 @@ +error[E0599]: the method `get` exists for struct `Victim<'_, Self>`, but its trait bounds were not satisfied + --> $DIR/impl-derived-implicit-sized-bound.rs:31:19 + | +LL | struct Victim<'a, T: Perpetrator + ?Sized> + | ------------------------------------------ + | | + | method `get` not found for this struct + | doesn't satisfy `Victim<'_, Self>: VictimTrait` +... +LL | self.getter().get(); + | ^^^ method cannot be called on `Victim<'_, Self>` due to unsatisfied trait bounds + | +note: trait bound `Self: Sized` was not satisfied + --> $DIR/impl-derived-implicit-sized-bound.rs:15:10 + | +LL | impl<'a, T: Perpetrator /*+ ?Sized*/> VictimTrait for Victim<'a, T> { + | ^ ----------- ------------- + | | + | unsatisfied trait bound introduced here +help: consider relaxing the type parameter's implicit `Sized` bound + | +LL | impl<'a, T: ?Sized + Perpetrator /*+ ?Sized*/> VictimTrait for Victim<'a, T> { + | ++++++++ +help: consider restricting the type parameter to satisfy the trait bound + | +LL | Self: Sized, Self: Sized + | +++++++++++++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/trait-bounds/issue-75961.rs b/src/test/ui/trait-bounds/issue-75961.rs new file mode 100644 index 000000000..367eac718 --- /dev/null +++ b/src/test/ui/trait-bounds/issue-75961.rs @@ -0,0 +1,7 @@ +// check-pass + +pub fn foo<'a>(s: &'a mut ()) where &'a mut (): Clone { + <&mut () as Clone>::clone(&s); +} + +fn main() {} diff --git a/src/test/ui/trait-bounds/issue-93008.rs b/src/test/ui/trait-bounds/issue-93008.rs new file mode 100644 index 000000000..f4d21a160 --- /dev/null +++ b/src/test/ui/trait-bounds/issue-93008.rs @@ -0,0 +1,15 @@ +// build-pass +// compile-flags: -Zmir-opt-level=3 --crate-type=lib + +#![feature(trivial_bounds)] +#![allow(trivial_bounds)] + +trait Foo { + fn test(self); +} +fn baz() +where + &'static str: Foo, +{ + "Foo".test() +} diff --git a/src/test/ui/trait-bounds/issue-94680.rs b/src/test/ui/trait-bounds/issue-94680.rs new file mode 100644 index 000000000..58e892079 --- /dev/null +++ b/src/test/ui/trait-bounds/issue-94680.rs @@ -0,0 +1,14 @@ +// check-pass + +fn main() { + println!("{:?}", { + type T = (); + + pub fn cloneit(it: &'_ mut T) -> (&'_ mut T, &'_ mut T) + where + for<'any> &'any mut T: Clone, + { + (it.clone(), it) + } + }); +} diff --git a/src/test/ui/trait-bounds/issue-94999.rs b/src/test/ui/trait-bounds/issue-94999.rs new file mode 100644 index 000000000..e13190234 --- /dev/null +++ b/src/test/ui/trait-bounds/issue-94999.rs @@ -0,0 +1,34 @@ +// check-pass + +trait Identity { + type T; +} + +impl Identity for T { + type T = T; +} + +trait Holds { + type Q; +} + +struct S; +struct X(S); + +struct XHelper; + +impl Holds for X { + type Q = XHelper; +} + +impl Clone for X +where + >::T: Clone, + X: Holds, +{ + fn clone(&self) -> Self { + Self(self.0.clone()) + } +} + +fn main() {} diff --git a/src/test/ui/trait-bounds/issue-95640.rs b/src/test/ui/trait-bounds/issue-95640.rs new file mode 100644 index 000000000..e4e998b5d --- /dev/null +++ b/src/test/ui/trait-bounds/issue-95640.rs @@ -0,0 +1,31 @@ +// build-pass +// compile-flags:-Zmir-opt-level=3 + +struct D; + +trait Tr { + type It; + fn foo(self) -> Option; +} + +impl<'a> Tr for &'a D { + type It = (); + fn foo(self) -> Option<()> { + None + } +} + +fn run(f: F) +where + for<'a> &'a D: Tr, + F: Fn(<&D as Tr>::It), +{ + let d = &D; + while let Some(i) = d.foo() { + f(i); + } +} + +fn main() { + run(|_| {}); +} diff --git a/src/test/ui/trait-bounds/mismatch-fn-trait.rs b/src/test/ui/trait-bounds/mismatch-fn-trait.rs new file mode 100644 index 000000000..0ed64043a --- /dev/null +++ b/src/test/ui/trait-bounds/mismatch-fn-trait.rs @@ -0,0 +1,28 @@ +fn take(_f: impl FnMut(i32)) {} + +fn test1(f: impl FnMut(u32)) { + take(f) + //~^ ERROR [E0277] +} + +fn test2(f: impl FnMut(i32, i32)) { + take(f) + //~^ ERROR [E0277] +} + +fn test3(f: impl FnMut()) { + take(f) + //~^ ERROR [E0277] +} + +fn test4(f: impl FnOnce(i32)) { + take(f) + //~^ ERROR [E0277] +} + +fn test5(f: impl FnOnce(u32)) { + take(f) + //~^ ERROR [E0277] +} + +fn main() {} diff --git a/src/test/ui/trait-bounds/mismatch-fn-trait.stderr b/src/test/ui/trait-bounds/mismatch-fn-trait.stderr new file mode 100644 index 000000000..961e6d88f --- /dev/null +++ b/src/test/ui/trait-bounds/mismatch-fn-trait.stderr @@ -0,0 +1,81 @@ +error[E0277]: expected a `FnMut<(i32,)>` closure, found `impl FnMut(u32)` + --> $DIR/mismatch-fn-trait.rs:4:10 + | +LL | take(f) + | ---- ^ expected an `FnMut<(i32,)>` closure, found `impl FnMut(u32)` + | | + | required by a bound introduced by this call + | + = note: expected a closure with arguments `(u32,)` + found a closure with arguments `(i32,)` +note: required by a bound in `take` + --> $DIR/mismatch-fn-trait.rs:1:18 + | +LL | fn take(_f: impl FnMut(i32)) {} + | ^^^^^^^^^^ required by this bound in `take` + +error[E0277]: expected a `FnMut<(i32,)>` closure, found `impl FnMut(i32, i32)` + --> $DIR/mismatch-fn-trait.rs:9:10 + | +LL | take(f) + | ---- ^ expected an `FnMut<(i32,)>` closure, found `impl FnMut(i32, i32)` + | | + | required by a bound introduced by this call + | + = note: expected a closure taking 2 arguments, but one taking 1 argument was given +note: required by a bound in `take` + --> $DIR/mismatch-fn-trait.rs:1:18 + | +LL | fn take(_f: impl FnMut(i32)) {} + | ^^^^^^^^^^ required by this bound in `take` + +error[E0277]: expected a `FnMut<(i32,)>` closure, found `impl FnMut()` + --> $DIR/mismatch-fn-trait.rs:14:10 + | +LL | take(f) + | ---- ^ expected an `FnMut<(i32,)>` closure, found `impl FnMut()` + | | + | required by a bound introduced by this call + | + = note: expected a closure taking 0 arguments, but one taking 1 argument was given +note: required by a bound in `take` + --> $DIR/mismatch-fn-trait.rs:1:18 + | +LL | fn take(_f: impl FnMut(i32)) {} + | ^^^^^^^^^^ required by this bound in `take` + +error[E0277]: expected a `FnMut<(i32,)>` closure, found `impl FnOnce(i32)` + --> $DIR/mismatch-fn-trait.rs:19:10 + | +LL | take(f) + | ---- ^ expected an `FnMut<(i32,)>` closure, found `impl FnOnce(i32)` + | | + | required by a bound introduced by this call + | + = note: `impl FnOnce(i32)` implements `FnOnce`, but it must implement `FnMut`, which is more general +note: required by a bound in `take` + --> $DIR/mismatch-fn-trait.rs:1:18 + | +LL | fn take(_f: impl FnMut(i32)) {} + | ^^^^^^^^^^ required by this bound in `take` + +error[E0277]: expected a `FnMut<(i32,)>` closure, found `impl FnOnce(u32)` + --> $DIR/mismatch-fn-trait.rs:24:10 + | +LL | take(f) + | ---- ^ expected an `FnMut<(i32,)>` closure, found `impl FnOnce(u32)` + | | + | required by a bound introduced by this call + | + = note: `impl FnOnce(u32)` implements `FnOnce`, but it must implement `FnMut`, which is more general + = note: expected a closure with arguments `(u32,)` + found a closure with arguments `(i32,)` +note: required by a bound in `take` + --> $DIR/mismatch-fn-trait.rs:1:18 + | +LL | fn take(_f: impl FnMut(i32)) {} + | ^^^^^^^^^^ required by this bound in `take` + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.fixed b/src/test/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.fixed new file mode 100644 index 000000000..39e90d7a3 --- /dev/null +++ b/src/test/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.fixed @@ -0,0 +1,16 @@ +// run-rustfix +#![allow(non_snake_case)] +mod A { + pub trait Trait {} + impl Trait for i32 {} +} + +mod B { + use A::Trait; + +pub struct A(pub H); //~ ERROR cannot find trait +} + +fn main() { + let _ = B::A(42); +} diff --git a/src/test/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.rs b/src/test/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.rs new file mode 100644 index 000000000..ee6ed0cae --- /dev/null +++ b/src/test/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.rs @@ -0,0 +1,14 @@ +// run-rustfix +#![allow(non_snake_case)] +mod A { + pub trait Trait {} + impl Trait for i32 {} +} + +mod B { + pub struct A(pub H); //~ ERROR cannot find trait +} + +fn main() { + let _ = B::A(42); +} diff --git a/src/test/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr b/src/test/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr new file mode 100644 index 000000000..b29766295 --- /dev/null +++ b/src/test/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr @@ -0,0 +1,19 @@ +error[E0405]: cannot find trait `Trait` in `A` + --> $DIR/shadowed-path-in-trait-bound-suggestion.rs:9:24 + | +LL | pub struct A(pub H); + | ^^^^^ not found in `A` + | +help: consider importing this trait + | +LL | use A::Trait; + | +help: if you import `Trait`, refer to it directly + | +LL - pub struct A(pub H); +LL + pub struct A(pub H); + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0405`. diff --git a/src/test/ui/trait-bounds/unsized-bound.rs b/src/test/ui/trait-bounds/unsized-bound.rs new file mode 100644 index 000000000..035b8ef1b --- /dev/null +++ b/src/test/ui/trait-bounds/unsized-bound.rs @@ -0,0 +1,32 @@ +trait Trait {} +impl Trait<(A, B)> for (A, B) where A: ?Sized, B: ?Sized, {} +//~^ ERROR E0277 +//~| ERROR E0277 +impl Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {} +//~^ ERROR E0277 +//~| ERROR E0277 +//~| ERROR E0277 +trait Trait2 {} +impl Trait2<(A, B)> for (A, B) {} +//~^ ERROR E0277 +//~| ERROR E0277 +trait Trait3 {} +impl Trait3 for A where A: ?Sized {} +//~^ ERROR E0277 +trait Trait4 {} +impl Trait4 for A {} +//~^ ERROR E0277 +trait Trait5 {} +impl Trait5 for X where X: ?Sized {} +//~^ ERROR E0277 +trait Trait6 {} +impl Trait6 for X {} +//~^ ERROR E0277 +trait Trait7 {} +impl Trait7 for X where Y: ?Sized {} +//~^ ERROR E0277 +trait Trait8 {} +impl Trait8 for X {} +//~^ ERROR E0277 + +fn main() {} diff --git a/src/test/ui/trait-bounds/unsized-bound.stderr b/src/test/ui/trait-bounds/unsized-bound.stderr new file mode 100644 index 000000000..ec85ada7a --- /dev/null +++ b/src/test/ui/trait-bounds/unsized-bound.stderr @@ -0,0 +1,273 @@ +error[E0277]: the size for values of type `B` cannot be known at compilation time + --> $DIR/unsized-bound.rs:2:12 + | +LL | impl Trait<(A, B)> for (A, B) where A: ?Sized, B: ?Sized, {} + | - ^^^^^^^^^^^^^ doesn't have a size known at compile-time + | | + | this type parameter needs to be `std::marker::Sized` + | + = note: required because it appears within the type `(A, B)` +note: required by a bound in `Trait` + --> $DIR/unsized-bound.rs:1:13 + | +LL | trait Trait {} + | ^ required by this bound in `Trait` +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - impl Trait<(A, B)> for (A, B) where A: ?Sized, B: ?Sized, {} +LL + impl Trait<(A, B)> for (A, B) where A: ?Sized, {} + | +help: consider relaxing the implicit `Sized` restriction + | +LL | trait Trait {} + | ++++++++ + +error[E0277]: the size for values of type `A` cannot be known at compilation time + --> $DIR/unsized-bound.rs:2:30 + | +LL | impl Trait<(A, B)> for (A, B) where A: ?Sized, B: ?Sized, {} + | - ^^^^^^ doesn't have a size known at compile-time + | | + | this type parameter needs to be `std::marker::Sized` + | + = note: only the last element of a tuple may have a dynamically sized type +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - impl Trait<(A, B)> for (A, B) where A: ?Sized, B: ?Sized, {} +LL + impl Trait<(A, B)> for (A, B) where B: ?Sized, {} + | + +error[E0277]: the size for values of type `C` cannot be known at compilation time + --> $DIR/unsized-bound.rs:5:31 + | +LL | impl Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {} + | - ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | | + | this type parameter needs to be `std::marker::Sized` + | + = note: required because it appears within the type `(A, B, C)` +note: required by a bound in `Trait` + --> $DIR/unsized-bound.rs:1:13 + | +LL | trait Trait {} + | ^ required by this bound in `Trait` +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - impl Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {} +LL + impl Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {} + | +help: consider relaxing the implicit `Sized` restriction + | +LL | trait Trait {} + | ++++++++ + +error[E0277]: the size for values of type `A` cannot be known at compilation time + --> $DIR/unsized-bound.rs:5:52 + | +LL | impl Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {} + | - ^^^^^^^^^ doesn't have a size known at compile-time + | | + | this type parameter needs to be `std::marker::Sized` + | + = note: only the last element of a tuple may have a dynamically sized type +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - impl Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {} +LL + impl Trait<(A, B, C)> for (A, B, C) {} + | + +error[E0277]: the size for values of type `B` cannot be known at compilation time + --> $DIR/unsized-bound.rs:5:52 + | +LL | impl Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {} + | - ^^^^^^^^^ doesn't have a size known at compile-time + | | + | this type parameter needs to be `std::marker::Sized` + | + = note: only the last element of a tuple may have a dynamically sized type +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - impl Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {} +LL + impl Trait<(A, B, C)> for (A, B, C) where A: ?Sized, {} + | + +error[E0277]: the size for values of type `B` cannot be known at compilation time + --> $DIR/unsized-bound.rs:10:28 + | +LL | impl Trait2<(A, B)> for (A, B) {} + | - ^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | | + | this type parameter needs to be `std::marker::Sized` + | + = note: required because it appears within the type `(A, B)` +note: required by a bound in `Trait2` + --> $DIR/unsized-bound.rs:9:14 + | +LL | trait Trait2 {} + | ^ required by this bound in `Trait2` +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - impl Trait2<(A, B)> for (A, B) {} +LL + impl Trait2<(A, B)> for (A, B) {} + | +help: consider relaxing the implicit `Sized` restriction + | +LL | trait Trait2 {} + | ++++++++ + +error[E0277]: the size for values of type `A` cannot be known at compilation time + --> $DIR/unsized-bound.rs:10:47 + | +LL | impl Trait2<(A, B)> for (A, B) {} + | - ^^^^^^ doesn't have a size known at compile-time + | | + | this type parameter needs to be `std::marker::Sized` + | + = note: only the last element of a tuple may have a dynamically sized type +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - impl Trait2<(A, B)> for (A, B) {} +LL + impl Trait2<(A, B)> for (A, B) {} + | + +error[E0277]: the size for values of type `A` cannot be known at compilation time + --> $DIR/unsized-bound.rs:14:9 + | +LL | impl Trait3 for A where A: ?Sized {} + | - ^^^^^^^^^ doesn't have a size known at compile-time + | | + | this type parameter needs to be `std::marker::Sized` + | +note: required by a bound in `Trait3` + --> $DIR/unsized-bound.rs:13:14 + | +LL | trait Trait3 {} + | ^ required by this bound in `Trait3` +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - impl Trait3 for A where A: ?Sized {} +LL + impl Trait3 for A {} + | +help: consider relaxing the implicit `Sized` restriction + | +LL | trait Trait3 {} + | ++++++++ + +error[E0277]: the size for values of type `A` cannot be known at compilation time + --> $DIR/unsized-bound.rs:17:17 + | +LL | impl Trait4 for A {} + | - ^^^^^^^^^ doesn't have a size known at compile-time + | | + | this type parameter needs to be `std::marker::Sized` + | +note: required by a bound in `Trait4` + --> $DIR/unsized-bound.rs:16:14 + | +LL | trait Trait4 {} + | ^ required by this bound in `Trait4` +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - impl Trait4 for A {} +LL + impl Trait4 for A {} + | +help: consider relaxing the implicit `Sized` restriction + | +LL | trait Trait4 {} + | ++++++++ + +error[E0277]: the size for values of type `X` cannot be known at compilation time + --> $DIR/unsized-bound.rs:20:12 + | +LL | impl Trait5 for X where X: ?Sized {} + | - ^^^^^^^^^^^^ doesn't have a size known at compile-time + | | + | this type parameter needs to be `std::marker::Sized` + | +note: required by a bound in `Trait5` + --> $DIR/unsized-bound.rs:19:14 + | +LL | trait Trait5 {} + | ^ required by this bound in `Trait5` +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - impl Trait5 for X where X: ?Sized {} +LL + impl Trait5 for X {} + | +help: consider relaxing the implicit `Sized` restriction + | +LL | trait Trait5 {} + | ++++++++ + +error[E0277]: the size for values of type `X` cannot be known at compilation time + --> $DIR/unsized-bound.rs:23:20 + | +LL | impl Trait6 for X {} + | - ^^^^^^^^^^^^ doesn't have a size known at compile-time + | | + | this type parameter needs to be `std::marker::Sized` + | +note: required by a bound in `Trait6` + --> $DIR/unsized-bound.rs:22:14 + | +LL | trait Trait6 {} + | ^ required by this bound in `Trait6` +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - impl Trait6 for X {} +LL + impl Trait6 for X {} + | +help: consider relaxing the implicit `Sized` restriction + | +LL | trait Trait6 {} + | ++++++++ + +error[E0277]: the size for values of type `Y` cannot be known at compilation time + --> $DIR/unsized-bound.rs:26:12 + | +LL | impl Trait7 for X where Y: ?Sized {} + | - ^^^^^^^^^^^^ doesn't have a size known at compile-time + | | + | this type parameter needs to be `std::marker::Sized` + | +note: required by a bound in `Trait7` + --> $DIR/unsized-bound.rs:25:17 + | +LL | trait Trait7 {} + | ^ required by this bound in `Trait7` +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - impl Trait7 for X where Y: ?Sized {} +LL + impl Trait7 for X {} + | +help: consider relaxing the implicit `Sized` restriction + | +LL | trait Trait7 {} + | ++++++++ + +error[E0277]: the size for values of type `Y` cannot be known at compilation time + --> $DIR/unsized-bound.rs:29:20 + | +LL | impl Trait8 for X {} + | - ^^^^^^^^^^^^ doesn't have a size known at compile-time + | | + | this type parameter needs to be `std::marker::Sized` + | +note: required by a bound in `Trait8` + --> $DIR/unsized-bound.rs:28:17 + | +LL | trait Trait8 {} + | ^ required by this bound in `Trait8` +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - impl Trait8 for X {} +LL + impl Trait8 for X {} + | +help: consider relaxing the implicit `Sized` restriction + | +LL | trait Trait8 {} + | ++++++++ + +error: aborting due to 13 previous errors + +For more information about this error, try `rustc --explain E0277`. -- cgit v1.2.3