Use PredicateObligations instead of Predicates

Keep more information about trait binding failures.
This commit is contained in:
Esteban Küber 2020-03-03 15:07:04 -08:00
parent 485c5fb6e1
commit bd7ea5441e
90 changed files with 280 additions and 141 deletions

View file

@ -20,7 +20,10 @@ error[E0277]: `<<T as Case1>::C as std::iter::Iterator>::Item` cannot be sent be
--> $DIR/bad-bounds-on-assoc-in-trait.rs:36:20
|
LL | trait Case1 {
| ----------- required by `Case1`
| -----
LL | type C: Clone + Iterator<Item:
LL | Send + Iterator<Item:
| ---- required by this bound in `Case1`
...
LL | fn assume_case1<T: Case1>() {
| ^^^^^ - help: consider further restricting the associated type: `where <<T as Case1>::C as std::iter::Iterator>::Item: std::marker::Send`
@ -33,7 +36,10 @@ error[E0277]: `<<T as Case1>::C as std::iter::Iterator>::Item` cannot be shared
--> $DIR/bad-bounds-on-assoc-in-trait.rs:36:20
|
LL | trait Case1 {
| ----------- required by `Case1`
| -----
...
LL | > + Sync>;
| ---- required by this bound in `Case1`
...
LL | fn assume_case1<T: Case1>() {
| ^^^^^ - help: consider further restricting the associated type: `where <<T as Case1>::C as std::iter::Iterator>::Item: std::marker::Sync`
@ -46,7 +52,10 @@ error[E0277]: `<_ as Lam<&'a u8>>::App` doesn't implement `std::fmt::Debug`
--> $DIR/bad-bounds-on-assoc-in-trait.rs:36:20
|
LL | trait Case1 {
| ----------- required by `Case1`
| -----
...
LL | Debug
| ----- required by this bound in `Case1`
...
LL | fn assume_case1<T: Case1>() {
| ^^^^^ `<_ as Lam<&'a u8>>::App` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`

View file

@ -2,7 +2,7 @@ error[E0284]: type annotations needed
--> $DIR/associated-types-overridden-binding.rs:4:12
|
LL | trait Foo: Iterator<Item = i32> {}
| ------------------------------- required by `Foo`
| --- ---------- required by this bound in `Foo`
LL | trait Bar: Foo<Item = u32> {}
| ^^^^^^^^^^^^^^^ cannot infer type for type parameter `Self`
|
@ -12,7 +12,7 @@ error[E0284]: type annotations needed
--> $DIR/associated-types-overridden-binding.rs:7:21
|
LL | trait I32Iterator = Iterator<Item = i32>;
| ----------------------------------------- required by `I32Iterator`
| ----------- ---------- required by this bound in `I32Iterator`
LL | trait U32Iterator = I32Iterator<Item = u32>;
| ^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `Self`
|

View file

@ -128,10 +128,14 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation
|
LL | type Ty = Vec<[u8]>;
| ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
::: $SRC_DIR/liballoc/vec.rs:LL:COL
|
LL | pub struct Vec<T> {
| - required by this bound in `std::vec::Vec`
|
= help: the trait `std::marker::Sized` is not implemented for `[u8]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required by `std::vec::Vec`
error: aborting due to 11 previous errors

View file

@ -14,10 +14,14 @@ error[E0277]: the size for values of type `dyn Trait` cannot be known at compila
|
LL | let x: Vec<dyn Trait + Sized> = Vec::new();
| ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
::: $SRC_DIR/liballoc/vec.rs:LL:COL
|
LL | pub struct Vec<T> {
| - required by this bound in `std::vec::Vec`
|
= help: the trait `std::marker::Sized` is not implemented for `dyn Trait`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required by `std::vec::Vec`
error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
--> $DIR/bad-sized.rs:4:37

View file

@ -2,7 +2,7 @@ error[E0277]: `F` cannot be sent between threads safely
--> $DIR/closure-bounds-cant-promote-superkind-in-struct.rs:5:22
|
LL | struct X<F> where F: FnOnce() + 'static + Send {
| ---------------------------------------------- required by `X`
| - ---- required by this bound in `X`
...
LL | fn foo<F>(blk: F) -> X<F> where F: FnOnce() + 'static {
| ^^^^ `F` cannot be sent between threads safely

View file

@ -15,7 +15,7 @@ error[E0277]: the size for values of type `A` cannot be known at compilation tim
--> $DIR/too_generic_eval_ice.rs:7:13
|
LL | pub struct Foo<A, B>(A, B);
| --------------------------- required by `Foo`
| --- - required by this bound in `Foo`
LL |
LL | impl<A, B> Foo<A, B> {
| - this type parameter needs to be `std::marker::Sized`
@ -30,7 +30,7 @@ error[E0277]: the size for values of type `B` cannot be known at compilation tim
--> $DIR/too_generic_eval_ice.rs:7:13
|
LL | pub struct Foo<A, B>(A, B);
| --------------------------- required by `Foo`
| --- - required by this bound in `Foo`
LL |
LL | impl<A, B> Foo<A, B> {
| - this type parameter needs to be `std::marker::Sized`

View file

@ -3,8 +3,12 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied
|
LL | x: Error
| ^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `Error`
|
::: $SRC_DIR/libcore/cmp.rs:LL:COL
|
LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
| -- required by this bound in `std::cmp::AssertParamIsEq`
|
= note: required by `std::cmp::AssertParamIsEq`
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error

View file

@ -3,8 +3,12 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied
|
LL | Error
| ^^^^^ the trait `std::cmp::Eq` is not implemented for `Error`
|
::: $SRC_DIR/libcore/cmp.rs:LL:COL
|
LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
| -- required by this bound in `std::cmp::AssertParamIsEq`
|
= note: required by `std::cmp::AssertParamIsEq`
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error

View file

@ -3,8 +3,12 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied
|
LL | x: Error
| ^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `Error`
|
::: $SRC_DIR/libcore/cmp.rs:LL:COL
|
LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
| -- required by this bound in `std::cmp::AssertParamIsEq`
|
= note: required by `std::cmp::AssertParamIsEq`
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error

View file

@ -3,8 +3,12 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied
|
LL | Error
| ^^^^^ the trait `std::cmp::Eq` is not implemented for `Error`
|
::: $SRC_DIR/libcore/cmp.rs:LL:COL
|
LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
| -- required by this bound in `std::cmp::AssertParamIsEq`
|
= note: required by `std::cmp::AssertParamIsEq`
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error

View file

@ -2,7 +2,7 @@ error[E0275]: overflow evaluating the requirement `Bar<Bar<Bar<Bar<Bar<Bar<Bar<B
--> $DIR/E0275.rs:5:33
|
LL | trait Foo {}
| --------- required by `Foo`
| --------- required by this bound in `Foo`
...
LL | impl<T> Foo for T where Bar<T>: Foo {}
| ^^^

View file

@ -2,9 +2,9 @@ error[E0280]: the requirement `for<'a> <Self as Iterator>::Item<'a>: 'a` is not
--> $DIR/issue-62326-parameter-out-of-range.rs:7:20
|
LL | trait Iterator {
| -------------- required by `Iterator`
| --------
LL | type Item<'a>: 'a;
| ^^
| ^^ required by this bound in `Iterator`
error: aborting due to previous error

View file

@ -38,7 +38,10 @@ error[E0271]: type mismatch resolving `for<'a> <<std::vec::Vec<T> as Iterable>::
--> $DIR/iterable.rs:19:30
|
LL | trait Iterable {
| -------------- required by `Iterable`
| --------
LL | type Item<'a> where Self: 'a;
LL | type Iter<'a>: Iterator<Item = Self::Item<'a>> where Self: 'a;
| --------------------- required by this bound in `Iterable`
...
LL | fn iter<'a>(&'a self) -> Self::Iter<'a> {
| ^^^^^^^^^^^^^^ expected associated type, found reference
@ -52,7 +55,10 @@ error[E0271]: type mismatch resolving `for<'a> <<[T] as Iterable>::Iter<'a> as s
--> $DIR/iterable.rs:31:30
|
LL | trait Iterable {
| -------------- required by `Iterable`
| --------
LL | type Item<'a> where Self: 'a;
LL | type Iter<'a>: Iterator<Item = Self::Item<'a>> where Self: 'a;
| --------------------- required by this bound in `Iterable`
...
LL | fn iter<'a>(&'a self) -> Self::Iter<'a> {
| ^^^^^^^^^^^^^^ expected associated type, found reference

View file

@ -4,4 +4,9 @@ fn ho_func(f: Option<FuncType>) {
//~^ ERROR the size for values of type
}
enum Option<T> {
Some(T),
None,
}
fn main() {}

View file

@ -3,10 +3,12 @@ error[E0277]: the size for values of type `dyn for<'r> std::ops::Fn(&'r isize) -
|
LL | fn ho_func(f: Option<FuncType>) {
| ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
...
LL | enum Option<T> {
| ------ - required by this bound in `Option`
|
= help: the trait `std::marker::Sized` is not implemented for `dyn for<'r> std::ops::Fn(&'r isize) -> isize`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required by `std::option::Option`
error: aborting due to previous error

View file

@ -2,7 +2,7 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation
--> $DIR/issue-20005.rs:10:49
|
LL | trait From<Src> {
| --------------- required by `From`
| ---- --- required by this bound in `From`
...
LL | ) -> <Dst as From<Self>>::Result where Dst: From<Self> {
| ^^^^^^^^^^- help: consider further restricting `Self`: `, Self: std::marker::Sized`

View file

@ -10,7 +10,7 @@ error[E0275]: overflow evaluating the requirement `NoData<NoData<NoData<NoData<N
--> $DIR/issue-20413.rs:8:36
|
LL | trait Foo {
| --------- required by `Foo`
| --------- required by this bound in `Foo`
...
LL | impl<T> Foo for T where NoData<T>: Foo {
| ^^^
@ -148,7 +148,7 @@ error[E0275]: overflow evaluating the requirement `NoData<NoData<NoData<NoData<N
--> $DIR/issue-20413.rs:8:36
|
LL | trait Foo {
| --------- required by `Foo`
| --------- required by this bound in `Foo`
...
LL | impl<T> Foo for T where NoData<T>: Foo {
| ^^^

View file

@ -3,10 +3,14 @@ error[E0277]: the size for values of type `[i32]` cannot be known at compilation
|
LL | fn iceman(c: Vec<[i32]>) {}
| ^^^^^^^^^^ doesn't have a size known at compile-time
|
::: $SRC_DIR/liballoc/vec.rs:LL:COL
|
LL | pub struct Vec<T> {
| - required by this bound in `std::vec::Vec`
|
= help: the trait `std::marker::Sized` is not implemented for `[i32]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required by `std::vec::Vec`
error: aborting due to previous error

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: Bound` is not satisfied
--> $DIR/issue-21837.rs:8:9
|
LL | pub struct Foo<T: Bound>(T);
| ---------------------------- required by `Foo`
| --- ----- required by this bound in `Foo`
...
LL | impl<T> Trait2 for Foo<T> {}
| ^^^^^^ the trait `Bound` is not implemented for `T`

View file

@ -2,7 +2,7 @@ error[E0283]: type annotations needed
--> $DIR/issue-21974.rs:11:19
|
LL | trait Foo {
| --------- required by `Foo`
| --------- required by this bound in `Foo`
...
LL | where &'a T : Foo,
| ^^^ cannot infer type for reference `&'a T`

View file

@ -5,4 +5,8 @@ impl Struct {
//~^ ERROR the size for values of type
}
struct Vec<T> {
t: T,
}
fn main() {}

View file

@ -3,10 +3,12 @@ error[E0277]: the size for values of type `(dyn std::ops::Fn() + 'static)` canno
|
LL | pub fn function(funs: Vec<dyn Fn() -> ()>) {}
| ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
...
LL | struct Vec<T> {
| --- - required by this bound in `Vec`
|
= help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::Fn() + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required by `std::vec::Vec`
error: aborting due to previous error

View file

@ -2,7 +2,9 @@ error[E0271]: type mismatch resolving `<<T as Trait>::A as MultiDispatch<i32>>::
--> $DIR/issue-24204.rs:14:12
|
LL | trait Trait: Sized {
| ------------------ required by `Trait`
| -----
LL | type A: MultiDispatch<Self::B, O = Self>;
| -------- required by this bound in `Trait`
...
LL | fn test<T: Trait<B=i32>>(b: i32) -> T where T::A: MultiDispatch<i32> { T::new(b) }
| ^^^^^^^^^^^^ expected type parameter `T`, found associated type

View file

@ -2,7 +2,7 @@ error[E0283]: type annotations needed
--> $DIR/issue-24424.rs:4:57
|
LL | trait Trait0<'l0> {}
| ----------------- required by `Trait0`
| ----------------- required by this bound in `Trait0`
LL |
LL | impl <'l0, 'l1, T0> Trait1<'l0, T0> for bool where T0 : Trait0<'l0>, T0 : Trait0<'l1> {}
| ^^^^^^^^^^^ cannot infer type for type parameter `T0`

View file

@ -2,7 +2,7 @@ error[E0277]: `u8` is not an iterator
--> $DIR/bound.rs:2:10
|
LL | struct S<I: Iterator>(I);
| ------------------------- required by `S`
| - -------- required by this bound in `S`
LL | struct T(S<u8>);
| ^^^^^ `u8` is not an iterator
|

View file

@ -2,7 +2,7 @@ error[E0277]: `*const Bar` cannot be shared between threads safely
--> $DIR/recursive-requirements.rs:16:12
|
LL | struct AssertSync<T: Sync>(PhantomData<T>);
| ------------------------------------------- required by `AssertSync`
| ---------- ---- required by this bound in `AssertSync`
...
LL | let _: AssertSync<Foo> = unimplemented!();
| ^^^^^^^^^^^^^^^ `*const Bar` cannot be shared between threads safely
@ -14,7 +14,7 @@ error[E0277]: `*const Foo` cannot be shared between threads safely
--> $DIR/recursive-requirements.rs:16:12
|
LL | struct AssertSync<T: Sync>(PhantomData<T>);
| ------------------------------------------- required by `AssertSync`
| ---------- ---- required by this bound in `AssertSync`
...
LL | let _: AssertSync<Foo> = unimplemented!();
| ^^^^^^^^^^^^^^^ `*const Foo` cannot be shared between threads safely

View file

@ -2,7 +2,10 @@ error[E0277]: the trait bound `<T as Parent>::Assoc: Child<A>` is not satisfied
--> $DIR/missing-assoc-type-bound-restriction.rs:17:19
|
LL | trait Parent {
| ------------ required by `Parent`
| ------
LL | type Ty;
LL | type Assoc: Child<Self::Ty>;
| --------------- required by this bound in `Parent`
...
LL | impl<A, T: Parent<Ty = A>> Parent for ParentWrapper<T> {
| ^^^^^^ - help: consider further restricting the associated type: `where <T as Parent>::Assoc: Child<A>`
@ -29,7 +32,10 @@ error[E0277]: the trait bound `<T as Parent>::Assoc: Child<A>` is not satisfied
--> $DIR/missing-assoc-type-bound-restriction.rs:20:5
|
LL | trait Parent {
| ------------ required by `Parent`
| ------
LL | type Ty;
LL | type Assoc: Child<Self::Ty>;
| --------------- required by this bound in `Parent`
...
LL | impl<A, T: Parent<Ty = A>> Parent for ParentWrapper<T> {
| - help: consider further restricting the associated type: `where <T as Parent>::Assoc: Child<A>`

View file

@ -12,18 +12,26 @@ error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satis
|
LL | let fp = BufWriter::new(fp);
| ^^^^^^^^^^^^^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
|
::: $SRC_DIR/libstd/io/buffered.rs:LL:COL
|
LL | pub struct BufWriter<W: Write> {
| ----- required by this bound in `std::io::BufWriter`
|
= note: `std::io::Write` is implemented for `&mut dyn std::io::Write`, but not for `&dyn std::io::Write`
= note: required by `std::io::BufWriter`
error[E0277]: the trait bound `&dyn std::io::Write: std::io::Write` is not satisfied
--> $DIR/mut-borrow-needed-by-trait.rs:17:14
|
LL | let fp = BufWriter::new(fp);
| ^^^^^^^^^^^^^^^^^^ the trait `std::io::Write` is not implemented for `&dyn std::io::Write`
|
::: $SRC_DIR/libstd/io/buffered.rs:LL:COL
|
LL | pub struct BufWriter<W: Write> {
| ----- required by this bound in `std::io::BufWriter`
|
= note: `std::io::Write` is implemented for `&mut dyn std::io::Write`, but not for `&dyn std::io::Write`
= note: required by `std::io::BufWriter`
error[E0599]: no method named `write_fmt` found for struct `std::io::BufWriter<&dyn std::io::Write>` in the current scope
--> $DIR/mut-borrow-needed-by-trait.rs:22:5

View file

@ -13,7 +13,7 @@ error[E0277]: `dummy::TestType` cannot be sent between threads safely
--> $DIR/negated-auto-traits-error.rs:23:5
|
LL | struct Outer<T: Send>(T);
| ------------------------- required by `Outer`
| ----- ---- required by this bound in `Outer`
...
LL | Outer(TestType);
| ^^^^^^^^^^^^^^^ `dummy::TestType` cannot be sent between threads safely

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: Foo` is not satisfied
--> $DIR/trait-alias-wf.rs:5:14
|
LL | trait A<T: Foo> {}
| --------------- required by `A`
| - --- required by this bound in `A`
LL | trait B<T> = A<T>;
| ^^^^ the trait `Foo` is not implemented for `T`
|

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `u32: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums-in-fns.rs:13:15
|
LL | struct Foo<T:Trait> {
| ------------------- required by `Foo`
| --- ----- required by this bound in `Foo`
...
LL | fn explode(x: Foo<u32>) {}
| ^^^^^^^^ the trait `Trait` is not implemented for `u32`
@ -11,7 +11,7 @@ error[E0277]: the trait bound `f32: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums-in-fns.rs:16:14
|
LL | enum Bar<T:Trait> {
| ----------------- required by `Bar`
| --- ----- required by this bound in `Bar`
...
LL | fn kaboom(y: Bar<f32>) {}
| ^^^^^^^^ the trait `Trait` is not implemented for `f32`

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `u16: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums-in-impls.rs:20:6
|
LL | struct Foo<T:Trait> {
| ------------------- required by `Foo`
| --- ----- required by this bound in `Foo`
...
LL | impl PolyTrait<Foo<u16>> for Struct {
| ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `u16`

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `usize: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums-locals.rs:15:14
|
LL | struct Foo<T:Trait> {
| ------------------- required by `Foo`
| --- ----- required by this bound in `Foo`
...
LL | let baz: Foo<usize> = loop { };
| ^^^^^^^^^^ the trait `Trait` is not implemented for `usize`

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `usize: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums-static.rs:9:11
|
LL | struct Foo<T:Trait> {
| ------------------- required by `Foo`
| --- ----- required by this bound in `Foo`
...
LL | static X: Foo<usize> = Foo {
| ^^^^^^^^^^ the trait `Trait` is not implemented for `usize`

View file

@ -3,16 +3,22 @@ error[E0277]: the trait bound `usize: trait_bounds_on_structs_and_enums_xc::Trai
|
LL | fn explode(x: Foo<usize>) {}
| ^^^^^^^^^^ the trait `trait_bounds_on_structs_and_enums_xc::Trait` is not implemented for `usize`
|
::: $DIR/auxiliary/trait_bounds_on_structs_and_enums_xc.rs:5:18
|
= note: required by `trait_bounds_on_structs_and_enums_xc::Foo`
LL | pub struct Foo<T:Trait> {
| ----- required by this bound in `trait_bounds_on_structs_and_enums_xc::Foo`
error[E0277]: the trait bound `f32: trait_bounds_on_structs_and_enums_xc::Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums-xc.rs:10:14
|
LL | fn kaboom(y: Bar<f32>) {}
| ^^^^^^^^ the trait `trait_bounds_on_structs_and_enums_xc::Trait` is not implemented for `f32`
|
::: $DIR/auxiliary/trait_bounds_on_structs_and_enums_xc.rs:9:16
|
= note: required by `trait_bounds_on_structs_and_enums_xc::Bar`
LL | pub enum Bar<T:Trait> {
| ----- required by this bound in `trait_bounds_on_structs_and_enums_xc::Bar`
error: aborting due to 2 previous errors

View file

@ -3,8 +3,11 @@ error[E0277]: the trait bound `f64: trait_bounds_on_structs_and_enums_xc::Trait`
|
LL | let bar: Bar<f64> = return;
| ^^^^^^^^ the trait `trait_bounds_on_structs_and_enums_xc::Trait` is not implemented for `f64`
|
::: $DIR/auxiliary/trait_bounds_on_structs_and_enums_xc.rs:9:16
|
= note: required by `trait_bounds_on_structs_and_enums_xc::Bar`
LL | pub enum Bar<T:Trait> {
| ----- required by this bound in `trait_bounds_on_structs_and_enums_xc::Bar`
error[E0277]: the trait bound `{integer}: trait_bounds_on_structs_and_enums_xc::Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums-xc1.rs:8:15

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums.rs:13:9
|
LL | struct Foo<T:Trait> {
| ------------------- required by `Foo`
| --- ----- required by this bound in `Foo`
...
LL | impl<T> Foo<T> {
| ^^^^^^ the trait `Trait` is not implemented for `T`
@ -16,7 +16,7 @@ error[E0277]: the trait bound `isize: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums.rs:19:5
|
LL | struct Foo<T:Trait> {
| ------------------- required by `Foo`
| --- ----- required by this bound in `Foo`
...
LL | a: Foo<isize>,
| ^^^^^^^^^^^^^ the trait `Trait` is not implemented for `isize`
@ -25,7 +25,7 @@ error[E0277]: the trait bound `usize: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums.rs:23:10
|
LL | enum Bar<T:Trait> {
| ----------------- required by `Bar`
| --- ----- required by this bound in `Bar`
...
LL | Quux(Bar<usize>),
| ^^^^^^^^^^ the trait `Trait` is not implemented for `usize`
@ -34,7 +34,7 @@ error[E0277]: the trait bound `U: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums.rs:27:5
|
LL | struct Foo<T:Trait> {
| ------------------- required by `Foo`
| --- ----- required by this bound in `Foo`
...
LL | b: Foo<U>,
| ^^^^^^^^^ the trait `Trait` is not implemented for `U`
@ -48,7 +48,7 @@ error[E0277]: the trait bound `V: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums.rs:31:21
|
LL | enum Bar<T:Trait> {
| ----------------- required by `Bar`
| --- ----- required by this bound in `Bar`
...
LL | EvenMoreBadness(Bar<V>),
| ^^^^^^ the trait `Trait` is not implemented for `V`
@ -62,7 +62,7 @@ error[E0277]: the trait bound `i32: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums.rs:35:5
|
LL | struct Foo<T:Trait> {
| ------------------- required by `Foo`
| --- ----- required by this bound in `Foo`
...
LL | Foo<i32>,
| ^^^^^^^^ the trait `Trait` is not implemented for `i32`
@ -71,7 +71,7 @@ error[E0277]: the trait bound `u8: Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums.rs:39:22
|
LL | enum Bar<T:Trait> {
| ----------------- required by `Bar`
| --- ----- required by this bound in `Bar`
...
LL | DictionaryLike { field: Bar<u8> },
| ^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `u8`

View file

@ -2,7 +2,7 @@ error[E0277]: a value of type `i32` cannot be built from an iterator over elemen
--> $DIR/type-check-defaults.rs:6:19
|
LL | struct Foo<T, U: FromIterator<T>>(T, U);
| ---------------------------------------- required by `Foo`
| --- --------------- required by this bound in `Foo`
LL | struct WellFormed<Z = Foo<i32, i32>>(Z);
| ^ value of type `i32` cannot be built from `std::iter::Iterator<Item=i32>`
|
@ -12,7 +12,7 @@ error[E0277]: a value of type `i32` cannot be built from an iterator over elemen
--> $DIR/type-check-defaults.rs:8:27
|
LL | struct Foo<T, U: FromIterator<T>>(T, U);
| ---------------------------------------- required by `Foo`
| --- --------------- required by this bound in `Foo`
...
LL | struct WellFormedNoBounds<Z:?Sized = Foo<i32, i32>>(Z);
| ^ value of type `i32` cannot be built from `std::iter::Iterator<Item=i32>`
@ -50,7 +50,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
--> $DIR/type-check-defaults.rs:21:25
|
LL | trait Super<T: Copy> { }
| -------------------- required by `Super`
| ----- ---- required by this bound in `Super`
LL | trait Base<T = String>: Super<T> { }
| ^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
|

View file

@ -2,7 +2,7 @@ error[E0283]: type annotations needed
--> $DIR/issue-40294.rs:6:19
|
LL | trait Foo: Sized {
| ---------------- required by `Foo`
| ---------------- required by this bound in `Foo`
...
LL | where &'a T : Foo,
| ^^^ cannot infer type for reference `&'a T`

View file

@ -3,8 +3,12 @@ error[E0277]: the trait bound `U1: std::marker::Copy` is not satisfied
|
LL | #[derive(Clone)]
| ^^^^^ the trait `std::marker::Copy` is not implemented for `U1`
|
::: $SRC_DIR/libcore/clone.rs:LL:COL
|
LL | pub struct AssertParamIsCopy<T: Copy + ?Sized> {
| ---- required by this bound in `std::clone::AssertParamIsCopy`
|
= note: required by `std::clone::AssertParamIsCopy`
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0599]: no method named `clone` found for union `U5<CloneNoCopy>` in the current scope

View file

@ -3,8 +3,12 @@ error[E0277]: the trait bound `PartialEqNotEq: std::cmp::Eq` is not satisfied
|
LL | a: PartialEqNotEq,
| ^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `PartialEqNotEq`
|
::: $SRC_DIR/libcore/cmp.rs:LL:COL
|
LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
| -- required by this bound in `std::cmp::AssertParamIsEq`
|
= note: required by `std::cmp::AssertParamIsEq`
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error

View file

@ -2,7 +2,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
--> $DIR/unsized-enum.rs:6:36
|
LL | enum Foo<U> { FooSome(U), FooNone }
| ----------- required by `Foo`
| --- - required by this bound in `Foo`
LL | fn foo1<T>() { not_sized::<Foo<T>>() } // Hunky dory.
LL | fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() }
| - ^^^^^^ doesn't have a size known at compile-time

View file

@ -2,7 +2,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim
--> $DIR/unsized-inherent-impl-self-type.rs:7:17
|
LL | struct S5<Y>(Y);
| ---------------- required by `S5`
| -- - required by this bound in `S5`
LL |
LL | impl<X: ?Sized> S5<X> {
| - ^^^^^ doesn't have a size known at compile-time

View file

@ -2,7 +2,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation tim
--> $DIR/unsized-struct.rs:6:36
|
LL | struct Foo<T> { data: T }
| ------------- required by `Foo`
| --- - required by this bound in `Foo`
LL | fn foo1<T>() { not_sized::<Foo<T>>() } // Hunky dory.
LL | fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() }
| - ^^^^^^ doesn't have a size known at compile-time

View file

@ -2,7 +2,7 @@ error[E0277]: the size for values of type `X` cannot be known at compilation tim
--> $DIR/unsized-trait-impl-self-type.rs:10:17
|
LL | struct S5<Y>(Y);
| ---------------- required by `S5`
| -- - required by this bound in `S5`
LL |
LL | impl<X: ?Sized> T3<X> for S5<X> {
| - ^^^^^ doesn't have a size known at compile-time

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `NotCopy: std::marker::Copy` is not satisfied
--> $DIR/wf-const-type.rs:10:12
|
LL | struct IsCopy<T:Copy> { t: T }
| --------------------- required by `IsCopy`
| ------ ---- required by this bound in `IsCopy`
...
LL | const FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None };
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `NotCopy`

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied
--> $DIR/wf-enum-bound.rs:10:14
|
LL | trait ExtraCopy<T:Copy> { }
| ----------------------- required by `ExtraCopy`
| --------- ---- required by this bound in `ExtraCopy`
...
LL | where T: ExtraCopy<U>
| ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U`

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `A: std::marker::Copy` is not satisfied
--> $DIR/wf-enum-fields-struct-variant.rs:13:9
|
LL | struct IsCopy<T:Copy> {
| --------------------- required by `IsCopy`
| ------ ---- required by this bound in `IsCopy`
...
LL | f: IsCopy<A>
| ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A`

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `A: std::marker::Copy` is not satisfied
--> $DIR/wf-enum-fields.rs:12:17
|
LL | struct IsCopy<T:Copy> {
| --------------------- required by `IsCopy`
| ------ ---- required by this bound in `IsCopy`
...
LL | SomeVariant(IsCopy<A>)
| ^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A`

View file

@ -13,5 +13,8 @@ fn bar() where Vec<dyn Copy>:, {}
//~^ ERROR E0277
//~| ERROR E0038
struct Vec<T> {
t: T,
}
fn main() { }

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied
--> $DIR/wf-fn-where-clause.rs:8:24
|
LL | trait ExtraCopy<T:Copy> { }
| ----------------------- required by `ExtraCopy`
| --------- ---- required by this bound in `ExtraCopy`
LL |
LL | fn foo<T,U>() where T: ExtraCopy<U>
| ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U`
@ -17,10 +17,12 @@ error[E0277]: the size for values of type `(dyn std::marker::Copy + 'static)` ca
|
LL | fn bar() where Vec<dyn Copy>:, {}
| ^^^^^^^^^^^^^ doesn't have a size known at compile-time
...
LL | struct Vec<T> {
| --- - required by this bound in `Vec`
|
= help: the trait `std::marker::Sized` is not implemented for `(dyn std::marker::Copy + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required by `std::vec::Vec`
error[E0038]: the trait `std::marker::Copy` cannot be made into an object
--> $DIR/wf-fn-where-clause.rs:12:16

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: MyHash` is not satisfied
--> $DIR/wf-impl-associated-type-trait.rs:17:5
|
LL | pub struct MySet<T:MyHash> {
| -------------------------- required by `MySet`
| ----- ------ required by this bound in `MySet`
...
LL | type Bar = MySet<T>;
| ^^^^^^^^^^^^^^^^^^^^ the trait `MyHash` is not implemented for `T`

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
--> $DIR/wf-in-fn-arg.rs:10:14
|
LL | struct MustBeCopy<T:Copy> {
| ------------------------- required by `MustBeCopy`
| ---------- ---- required by this bound in `MustBeCopy`
...
LL | fn bar<T>(_: &MustBeCopy<T>)
| ^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
--> $DIR/wf-in-fn-ret.rs:10:16
|
LL | struct MustBeCopy<T:Copy> {
| ------------------------- required by `MustBeCopy`
| ---------- ---- required by this bound in `MustBeCopy`
...
LL | fn bar<T>() -> MustBeCopy<T>
| ^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
--> $DIR/wf-in-fn-type-arg.rs:9:5
|
LL | struct MustBeCopy<T:Copy> {
| ------------------------- required by `MustBeCopy`
| ---------- ---- required by this bound in `MustBeCopy`
...
LL | x: fn(MustBeCopy<T>)
| ^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
--> $DIR/wf-in-fn-type-ret.rs:9:5
|
LL | struct MustBeCopy<T:Copy> {
| ------------------------- required by `MustBeCopy`
| ---------- ---- required by this bound in `MustBeCopy`
...
LL | x: fn() -> MustBeCopy<T>
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied
--> $DIR/wf-in-fn-where-clause.rs:10:14
|
LL | trait MustBeCopy<T:Copy> {
| ------------------------ required by `MustBeCopy`
| ---------- ---- required by this bound in `MustBeCopy`
...
LL | where T: MustBeCopy<U>
| ^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U`

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
--> $DIR/wf-in-obj-type-trait.rs:11:5
|
LL | struct MustBeCopy<T:Copy> {
| ------------------------- required by `MustBeCopy`
| ---------- ---- required by this bound in `MustBeCopy`
...
LL | x: dyn Object<MustBeCopy<T>>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied
--> $DIR/wf-inherent-impl-method-where-clause.rs:12:27
|
LL | trait ExtraCopy<T:Copy> { }
| ----------------------- required by `ExtraCopy`
| --------- ---- required by this bound in `ExtraCopy`
...
LL | fn foo(self) where T: ExtraCopy<U>
| ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U`

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied
--> $DIR/wf-inherent-impl-where-clause.rs:11:29
|
LL | trait ExtraCopy<T:Copy> { }
| ----------------------- required by `ExtraCopy`
| --------- ---- required by this bound in `ExtraCopy`
...
LL | impl<T,U> Foo<T,U> where T: ExtraCopy<U>
| ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U`

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `NotCopy: std::marker::Copy` is not satisfied
--> $DIR/wf-static-type.rs:10:13
|
LL | struct IsCopy<T:Copy> { t: T }
| --------------------- required by `IsCopy`
| ------ ---- required by this bound in `IsCopy`
...
LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None };
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `NotCopy`

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied
--> $DIR/wf-struct-bound.rs:10:14
|
LL | trait ExtraCopy<T:Copy> { }
| ----------------------- required by `ExtraCopy`
| --------- ---- required by this bound in `ExtraCopy`
...
LL | where T: ExtraCopy<U>
| ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U`

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `A: std::marker::Copy` is not satisfied
--> $DIR/wf-struct-field.rs:12:5
|
LL | struct IsCopy<T:Copy> {
| --------------------- required by `IsCopy`
| ------ ---- required by this bound in `IsCopy`
...
LL | data: IsCopy<A>
| ^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A`

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
--> $DIR/wf-trait-associated-type-bound.rs:10:17
|
LL | trait ExtraCopy<T:Copy> { }
| ----------------------- required by `ExtraCopy`
| --------- ---- required by this bound in `ExtraCopy`
...
LL | type Type1: ExtraCopy<T>;
| ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `<Self as SomeTrait>::Type1: std::marker::Copy` is
--> $DIR/wf-trait-associated-type-trait.rs:11:5
|
LL | struct IsCopy<T:Copy> { x: T }
| --------------------- required by `IsCopy`
| ------ ---- required by this bound in `IsCopy`
LL |
LL | trait SomeTrait {
| - help: consider further restricting the associated type: `where <Self as SomeTrait>::Type1: std::marker::Copy`

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied
--> $DIR/wf-trait-bound.rs:10:14
|
LL | trait ExtraCopy<T:Copy> { }
| ----------------------- required by `ExtraCopy`
| --------- ---- required by this bound in `ExtraCopy`
...
LL | where T: ExtraCopy<U>
| ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U`

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied
--> $DIR/wf-trait-default-fn-arg.rs:11:22
|
LL | struct Bar<T:Eq+?Sized> { value: Box<T> }
| ----------------------- required by `Bar`
| --- -- required by this bound in `Bar`
...
LL | fn bar(&self, x: &Bar<Self>) {
| ^^^^^^^^^^ - help: consider further restricting `Self`: `where Self: std::cmp::Eq`

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied
--> $DIR/wf-trait-default-fn-ret.rs:11:22
|
LL | struct Bar<T:Eq+?Sized> { value: Box<T> }
| ----------------------- required by `Bar`
| --- -- required by this bound in `Bar`
...
LL | fn bar(&self) -> Bar<Self> {
| ^^^^^^^^^- help: consider further restricting `Self`: `where Self: std::cmp::Eq`

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied
--> $DIR/wf-trait-default-fn-where-clause.rs:11:31
|
LL | trait Bar<T:Eq+?Sized> { }
| ---------------------- required by `Bar`
| --- -- required by this bound in `Bar`
...
LL | fn bar<A>(&self) where A: Bar<Self> {
| ^^^^^^^^^- help: consider further restricting `Self`: `, Self: std::cmp::Eq`

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied
--> $DIR/wf-trait-fn-arg.rs:10:22
|
LL | struct Bar<T:Eq+?Sized> { value: Box<T> }
| ----------------------- required by `Bar`
| --- -- required by this bound in `Bar`
...
LL | fn bar(&self, x: &Bar<Self>);
| ^^^^^^^^^^ - help: consider further restricting `Self`: `where Self: std::cmp::Eq`

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied
--> $DIR/wf-trait-fn-ret.rs:10:22
|
LL | struct Bar<T:Eq+?Sized> { value: Box<T> }
| ----------------------- required by `Bar`
| --- -- required by this bound in `Bar`
...
LL | fn bar(&self) -> &Bar<Self>;
| ^^^^^^^^^^- help: consider further restricting `Self`: `where Self: std::cmp::Eq`

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied
--> $DIR/wf-trait-fn-where-clause.rs:10:49
|
LL | struct Bar<T:Eq+?Sized> { value: Box<T> }
| ----------------------- required by `Bar`
| --- -- required by this bound in `Bar`
...
LL | fn bar(&self) where Self: Sized, Bar<Self>: Copy;
| ^^^^- help: consider further restricting `Self`: `, Self: std::cmp::Eq`

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
--> $DIR/wf-trait-superbound.rs:9:21
|
LL | trait ExtraCopy<T:Copy> { }
| ----------------------- required by `ExtraCopy`
| --------- ---- required by this bound in `ExtraCopy`
LL |
LL | trait SomeTrait<T>: ExtraCopy<T> {
| ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`