Point at arguments or output when fn obligations come from them, or ident when they don't

This commit is contained in:
Esteban Küber 2020-01-18 14:57:56 -08:00
parent 994e5e7465
commit fca5c64abd
42 changed files with 261 additions and 392 deletions

View File

@ -219,9 +219,17 @@ fn check_associated_item(
ty::AssocKind::Method => {
let sig = fcx.tcx.fn_sig(item.def_id);
let sig = fcx.normalize_associated_types_in(span, &sig);
check_fn_or_method(tcx, fcx, span, sig, item.def_id, &mut implied_bounds);
let sig_if_method = sig_if_method.expect("bad signature for method");
check_method_receiver(fcx, sig_if_method, &item, self_ty);
let hir_sig = sig_if_method.expect("bad signature for method");
check_fn_or_method(
tcx,
fcx,
item.ident.span,
sig,
hir_sig,
item.def_id,
&mut implied_bounds,
);
check_method_receiver(fcx, hir_sig, &item, self_ty);
}
ty::AssocKind::Type => {
if item.defaultness.has_value() {
@ -364,7 +372,11 @@ fn check_item_fn(tcx: TyCtxt<'_>, item: &hir::Item<'_>) {
let sig = fcx.tcx.fn_sig(def_id);
let sig = fcx.normalize_associated_types_in(item.span, &sig);
let mut implied_bounds = vec![];
check_fn_or_method(tcx, fcx, item.span, sig, def_id, &mut implied_bounds);
let hir_sig = match &item.kind {
ItemKind::Fn(sig, ..) => sig,
_ => bug!("expected `ItemKind::Fn`, found `{:?}`", item.kind),
};
check_fn_or_method(tcx, fcx, item.ident.span, sig, hir_sig, def_id, &mut implied_bounds);
implied_bounds
})
}
@ -609,18 +621,23 @@ fn check_fn_or_method<'fcx, 'tcx>(
fcx: &FnCtxt<'fcx, 'tcx>,
span: Span,
sig: ty::PolyFnSig<'tcx>,
hir_sig: &hir::FnSig<'_>,
def_id: DefId,
implied_bounds: &mut Vec<Ty<'tcx>>,
) {
let sig = fcx.normalize_associated_types_in(span, &sig);
let sig = fcx.tcx.liberate_late_bound_regions(def_id, &sig);
for input_ty in sig.inputs() {
for (input_ty, span) in sig.inputs().iter().zip(hir_sig.decl.inputs.iter().map(|t| t.span)) {
fcx.register_wf_obligation(&input_ty, span, ObligationCauseCode::MiscObligation);
}
implied_bounds.extend(sig.inputs());
fcx.register_wf_obligation(sig.output(), span, ObligationCauseCode::ReturnType);
fcx.register_wf_obligation(
sig.output(),
hir_sig.decl.output.span(),
ObligationCauseCode::ReturnType,
);
// FIXME(#25759) return types should not be implied bounds
implied_bounds.push(sig.output());

View File

@ -9,74 +9,47 @@ LL | impl Case1 for S1 {
error[E0277]: `<<T as Case1>::C as std::iter::Iterator>::Item` is not an iterator
--> $DIR/bad-bounds-on-assoc-in-trait.rs:36:1
|
LL | fn assume_case1<T: Case1>() {
| ^ - help: consider further restricting the associated type: `where <<T as Case1>::C as std::iter::Iterator>::Item: std::iter::Iterator`
| _|
| |
LL | |
LL | |
LL | |
... |
LL | | assert_c::<_, _, _, T::C>();
LL | | }
| |_^ `<<T as Case1>::C as std::iter::Iterator>::Item` is not an iterator
LL | fn assume_case1<T: Case1>() {
| ^^^^^^^^^^^^ - help: consider further restricting the associated type: `where <<T as Case1>::C as std::iter::Iterator>::Item: std::iter::Iterator`
| |
| `<<T as Case1>::C as std::iter::Iterator>::Item` is not an iterator
|
= help: the trait `std::iter::Iterator` is not implemented for `<<T as Case1>::C as std::iter::Iterator>::Item`
error[E0277]: `<<T as Case1>::C as std::iter::Iterator>::Item` cannot be sent between threads safely
--> $DIR/bad-bounds-on-assoc-in-trait.rs:36:1
|
LL | trait Case1 {
| ----------- required by `Case1`
LL | trait Case1 {
| ----------- required by `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`
| _|
| |
LL | |
LL | |
LL | |
... |
LL | | assert_c::<_, _, _, T::C>();
LL | | }
| |_^ `<<T as Case1>::C as std::iter::Iterator>::Item` cannot be sent between threads safely
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`
| |
| `<<T as Case1>::C as std::iter::Iterator>::Item` cannot be sent between threads safely
|
= help: the trait `std::marker::Send` is not implemented for `<<T as Case1>::C as std::iter::Iterator>::Item`
error[E0277]: `<<T as Case1>::C as std::iter::Iterator>::Item` cannot be shared between threads safely
--> $DIR/bad-bounds-on-assoc-in-trait.rs:36:1
|
LL | trait Case1 {
| ----------- required by `Case1`
LL | trait Case1 {
| ----------- required by `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`
| _|
| |
LL | |
LL | |
LL | |
... |
LL | | assert_c::<_, _, _, T::C>();
LL | | }
| |_^ `<<T as Case1>::C as std::iter::Iterator>::Item` cannot be shared between threads safely
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`
| |
| `<<T as Case1>::C as std::iter::Iterator>::Item` cannot be shared between threads safely
|
= help: the trait `std::marker::Sync` is not implemented for `<<T as Case1>::C as std::iter::Iterator>::Item`
error[E0277]: `<_ as Lam<&'a u8>>::App` doesn't implement `std::fmt::Debug`
--> $DIR/bad-bounds-on-assoc-in-trait.rs:36:1
|
LL | trait Case1 {
| ----------- required by `Case1`
LL | trait Case1 {
| ----------- required by `Case1`
...
LL | / fn assume_case1<T: Case1>() {
LL | |
LL | |
LL | |
... |
LL | | assert_c::<_, _, _, T::C>();
LL | | }
| |_^ `<_ as Lam<&'a u8>>::App` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
LL | fn assume_case1<T: Case1>() {
| ^^^^^^^^^^^^ `<_ as Lam<&'a u8>>::App` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
|
= help: the trait `for<'a> std::fmt::Debug` is not implemented for `<_ as Lam<&'a u8>>::App`

View File

@ -1,17 +1,13 @@
error[E0277]: `F` cannot be sent between threads safely
--> $DIR/closure-bounds-cant-promote-superkind-in-struct.rs:5:1
--> $DIR/closure-bounds-cant-promote-superkind-in-struct.rs:5:22
|
LL | struct X<F> where F: FnOnce() + 'static + Send {
| ---------------------------------------------- required by `X`
LL | struct X<F> where F: FnOnce() + 'static + Send {
| ---------------------------------------------- required by `X`
...
LL | fn foo<F>(blk: F) -> X<F> where F: FnOnce() + 'static {
| ^ - help: consider further restricting type parameter `F`: `, F: std::marker::Send`
| _|
| |
LL | |
LL | | return X { field: blk };
LL | | }
| |_^ `F` cannot be sent between threads safely
LL | fn foo<F>(blk: F) -> X<F> where F: FnOnce() + 'static {
| ^^^^ - help: consider further restricting type parameter `F`: `, F: std::marker::Send`
| |
| `F` cannot be sent between threads safely
|
= help: the trait `std::marker::Send` is not implemented for `F`

View File

@ -1,11 +1,11 @@
error[E0038]: the trait `Trait` cannot be made into an object
--> $DIR/E0038.rs:5:1
--> $DIR/E0038.rs:5:16
|
LL | fn foo(&self) -> Self;
| --- method `foo` references the `Self` type in its parameters or return type
...
LL | fn call_foo(x: Box<dyn Trait>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` cannot be made into an object
| ^^^^^^^^^^^^^^ the trait `Trait` cannot be made into an object
error: aborting due to previous error

View File

@ -1,37 +1,37 @@
error[E0038]: the trait `NonObjectSafe1` cannot be made into an object
--> $DIR/feature-gate-object_safe_for_dispatch.rs:18:1
--> $DIR/feature-gate-object_safe_for_dispatch.rs:18:38
|
LL | fn takes_non_object_safe_ref<T>(obj: &dyn NonObjectSafe1) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe1` cannot be made into an object
| ^^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe1` cannot be made into an object
|
= note: the trait cannot require that `Self : Sized`
error[E0038]: the trait `NonObjectSafe2` cannot be made into an object
--> $DIR/feature-gate-object_safe_for_dispatch.rs:22:1
--> $DIR/feature-gate-object_safe_for_dispatch.rs:22:36
|
LL | fn static_fn() {}
| --------- associated function `static_fn` has no `self` parameter
...
LL | fn return_non_object_safe_ref() -> &'static dyn NonObjectSafe2 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe2` cannot be made into an object
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe2` cannot be made into an object
error[E0038]: the trait `NonObjectSafe3` cannot be made into an object
--> $DIR/feature-gate-object_safe_for_dispatch.rs:27:1
--> $DIR/feature-gate-object_safe_for_dispatch.rs:27:35
|
LL | fn foo<T>(&self);
| --- method `foo` has generic type parameters
...
LL | fn takes_non_object_safe_box(obj: Box<dyn NonObjectSafe3>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe3` cannot be made into an object
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe3` cannot be made into an object
error[E0038]: the trait `NonObjectSafe4` cannot be made into an object
--> $DIR/feature-gate-object_safe_for_dispatch.rs:31:1
--> $DIR/feature-gate-object_safe_for_dispatch.rs:31:35
|
LL | fn foo(&self, &Self);
| --- method `foo` references the `Self` type in its parameters or return type
...
LL | fn return_non_object_safe_rc() -> std::rc::Rc<dyn NonObjectSafe4> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe4` cannot be made into an object
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NonObjectSafe4` cannot be made into an object
error[E0038]: the trait `NonObjectSafe1` cannot be made into an object
--> $DIR/feature-gate-object_safe_for_dispatch.rs:38:6

View File

@ -25,16 +25,13 @@ LL | type Item<'a> where T: 'a = <std::slice::Iter<'a, T> as Iterator>::Item
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
error[E0271]: type mismatch resolving `for<'a> <<std::vec::Vec<T> as Iterable>::Iter<'a> as std::iter::Iterator>::Item == <std::vec::Vec<T> as Iterable>::Item<'a>`
--> $DIR/iterable.rs:19:5
--> $DIR/iterable.rs:19:30
|
LL | trait Iterable {
| -------------- required by `Iterable`
LL | trait Iterable {
| -------------- required by `Iterable`
...
LL | / fn iter<'a>(&'a self) -> Self::Iter<'a> {
LL | |
LL | | self.iter()
LL | | }
| |_____^ expected associated type, found reference
LL | fn iter<'a>(&'a self) -> Self::Iter<'a> {
| ^^^^^^^^^^^^^^ expected associated type, found reference
|
= note: expected associated type `<std::vec::Vec<T> as Iterable>::Item<'_>`
found reference `&T`
@ -42,16 +39,13 @@ LL | | }
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
error[E0271]: type mismatch resolving `for<'a> <<[T] as Iterable>::Iter<'a> as std::iter::Iterator>::Item == <[T] as Iterable>::Item<'a>`
--> $DIR/iterable.rs:31:5
--> $DIR/iterable.rs:31:30
|
LL | trait Iterable {
| -------------- required by `Iterable`
LL | trait Iterable {
| -------------- required by `Iterable`
...
LL | / fn iter<'a>(&'a self) -> Self::Iter<'a> {
LL | |
LL | | self.iter()
LL | | }
| |_____^ expected associated type, found reference
LL | fn iter<'a>(&'a self) -> Self::Iter<'a> {
| ^^^^^^^^^^^^^^ expected associated type, found reference
|
= note: expected associated type `<[T] as Iterable>::Item<'_>`
found reference `&T`

View File

@ -1,10 +1,8 @@
error[E0277]: the size for values of type `dyn for<'r> std::ops::Fn(&'r isize) -> isize` cannot be known at compilation time
--> $DIR/issue-18919.rs:3:1
--> $DIR/issue-18919.rs:3:15
|
LL | / fn ho_func(f: Option<FuncType>) {
LL | |
LL | | }
| |_^ doesn't have a size known at compile-time
LL | fn ho_func(f: Option<FuncType>) {
| ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= 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>

View File

@ -1,11 +1,11 @@
error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/issue-18959.rs:11:1
--> $DIR/issue-18959.rs:11:11
|
LL | pub trait Foo { fn foo<T>(&self, ext_thing: &T); }
| --- method `foo` has generic type parameters
...
LL | fn foo(b: &dyn Bar) {
| ^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object
| ^^^^^^^^ the trait `Bar` cannot be made into an object
error: aborting due to previous error

View File

@ -1,16 +1,14 @@
error[E0277]: the size for values of type `Self` cannot be known at compilation time
--> $DIR/issue-20005.rs:8:5
--> $DIR/issue-20005.rs:8:8
|
LL | trait From<Src> {
| --------------- required by `From`
LL | trait From<Src> {
| --------------- required by `From`
...
LL | / fn to<Dst>(
LL | | self
LL | | ) -> <Dst as From<Self>>::Result where Dst: From<Self> {
| | - help: consider further restricting `Self`: `, Self: std::marker::Sized`
LL | | From::from(self)
LL | | }
| |_____^ doesn't have a size known at compile-time
LL | fn to<Dst>(
| ^^ doesn't have a size known at compile-time
LL | self
LL | ) -> <Dst as From<Self>>::Result where Dst: From<Self> {
| - help: consider further restricting `Self`: `, Self: std::marker::Sized`
|
= help: the trait `std::marker::Sized` is not implemented for `Self`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>

View File

@ -151,16 +151,13 @@ LL | | }
= note: required because of the requirements on the impl of `Foo` for `NoData<T>`
error[E0275]: overflow evaluating the requirement `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo`
--> $DIR/issue-20413.rs:10:3
--> $DIR/issue-20413.rs:10:6
|
LL | trait Foo {
| --------- required by `Foo`
LL | trait Foo {
| --------- required by `Foo`
...
LL | / fn answer(self) {
LL | |
LL | | let val: NoData<T> = NoData;
LL | | }
| |___^
LL | fn answer(self) {
| ^^^^^^
|
= help: consider adding a `#![recursion_limit="256"]` attribute to your crate
= note: required because of the requirements on the impl of `Foo` for `NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<NoData<T>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`

View File

@ -1,8 +1,8 @@
error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
--> $DIR/issue-20433.rs:6:5
--> $DIR/issue-20433.rs:6:18
|
LL | fn iceman(c: Vec<[i32]>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
| ^^^^^^^^^^ doesn't have a size known at compile-time
|
= 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>

View File

@ -61,16 +61,10 @@ LL | | }
| |_____^
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
--> $DIR/issue-20831-debruijn.rs:28:5
--> $DIR/issue-20831-debruijn.rs:28:33
|
LL | / fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
LL | | // Not obvious, but there is an implicit lifetime here -------^
LL | |
LL | |
... |
LL | | self.sub = t;
LL | | }
| |_____^
LL | fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the method body at 28:5...
--> $DIR/issue-20831-debruijn.rs:28:5
@ -89,30 +83,18 @@ note: ...but the lifetime must also be valid for the lifetime `'a` as defined on
LL | impl<'a> Publisher<'a> for MyStruct<'a> {
| ^^
note: ...so that the types are compatible
--> $DIR/issue-20831-debruijn.rs:28:5
--> $DIR/issue-20831-debruijn.rs:28:33
|
LL | / fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
LL | | // Not obvious, but there is an implicit lifetime here -------^
LL | |
LL | |
... |
LL | | self.sub = t;
LL | | }
| |_____^
LL | fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: expected `Publisher<'_>`
found `Publisher<'_>`
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
--> $DIR/issue-20831-debruijn.rs:28:5
--> $DIR/issue-20831-debruijn.rs:28:33
|
LL | / fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
LL | | // Not obvious, but there is an implicit lifetime here -------^
LL | |
LL | |
... |
LL | | self.sub = t;
LL | | }
| |_____^
LL | fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the method body at 28:5...
--> $DIR/issue-20831-debruijn.rs:28:5
@ -131,16 +113,10 @@ note: ...but the lifetime must also be valid for the lifetime `'a` as defined on
LL | impl<'a> Publisher<'a> for MyStruct<'a> {
| ^^
note: ...so that the types are compatible
--> $DIR/issue-20831-debruijn.rs:28:5
--> $DIR/issue-20831-debruijn.rs:28:33
|
LL | / fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
LL | | // Not obvious, but there is an implicit lifetime here -------^
LL | |
LL | |
... |
LL | | self.sub = t;
LL | | }
| |_____^
LL | fn subscribe(&mut self, t : Box<dyn Subscriber<Input=<Self as Publisher>::Output> + 'a>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: expected `Publisher<'_>`
found `Publisher<'_>`

View File

@ -1,17 +1,11 @@
error[E0283]: type annotations needed
--> $DIR/issue-21974.rs:10:1
--> $DIR/issue-21974.rs:10:4
|
LL | trait Foo {
| --------- required by `Foo`
LL | trait Foo {
| --------- required by `Foo`
...
LL | / fn foo<'a,'b,T>(x: &'a T, y: &'b T)
LL | | where &'a T : Foo,
LL | | &'b T : Foo
LL | | {
LL | | x.foo();
LL | | y.foo();
LL | | }
| |_^ cannot infer type for reference `&'a T`
LL | fn foo<'a,'b,T>(x: &'a T, y: &'b T)
| ^^^ cannot infer type for reference `&'a T`
|
= note: cannot resolve `&'a T: Foo`

View File

@ -1,8 +1,8 @@
error[E0277]: the size for values of type `(dyn std::ops::Fn() + 'static)` cannot be known at compilation time
--> $DIR/issue-23281.rs:4:5
--> $DIR/issue-23281.rs:4:27
|
LL | pub fn function(funs: Vec<dyn Fn() -> ()>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
| ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= 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>

View File

@ -1,11 +1,11 @@
error[E0271]: type mismatch resolving `<<T as Trait>::A as MultiDispatch<i32>>::O == T`
--> $DIR/issue-24204.rs:14:1
--> $DIR/issue-24204.rs:14:4
|
LL | trait Trait: Sized {
| ------------------ required by `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
| ^^^^ expected type parameter `T`, found associated type
|
= note: expected type parameter `T`
found associated type `<<T as Trait>::A as MultiDispatch<i32>>::O`

View File

@ -1,8 +1,8 @@
error[E0308]: mismatched types
--> $DIR/issue-27942.rs:5:5
--> $DIR/issue-27942.rs:5:25
|
LL | fn select(&self) -> BufferViewHandle<R>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
| ^^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
= note: expected type `Resources<'_>`
found type `Resources<'a>`
@ -18,10 +18,10 @@ LL | pub trait Buffer<'a, R: Resources<'a>> {
| ^^
error[E0308]: mismatched types
--> $DIR/issue-27942.rs:5:5
--> $DIR/issue-27942.rs:5:25
|
LL | fn select(&self) -> BufferViewHandle<R>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
| ^^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
= note: expected type `Resources<'_>`
found type `Resources<'a>`

View File

@ -13,87 +13,69 @@ LL | foo: &'static T
| ^^^^^^^^^^^^^^^
error[E0309]: the parameter type `K` may not live long enough
--> $DIR/lifetime-doesnt-live-long-enough.rs:24:5
--> $DIR/lifetime-doesnt-live-long-enough.rs:24:8
|
LL | trait X<K>: Sized {
| - help: consider adding an explicit lifetime bound `K: 'a`...
LL | fn foo<'a, L: X<&'a Nested<K>>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^
|
note: ...so that the reference type `&'a Nested<K>` does not outlive the data it points at
--> $DIR/lifetime-doesnt-live-long-enough.rs:24:5
--> $DIR/lifetime-doesnt-live-long-enough.rs:24:8
|
LL | fn foo<'a, L: X<&'a Nested<K>>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^
error[E0309]: the parameter type `Self` may not live long enough
--> $DIR/lifetime-doesnt-live-long-enough.rs:28:5
--> $DIR/lifetime-doesnt-live-long-enough.rs:28:8
|
LL | fn bar<'a, L: X<&'a Nested<Self>>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^
|
= help: consider adding an explicit lifetime bound `Self: 'a`...
note: ...so that the reference type `&'a Nested<Self>` does not outlive the data it points at
--> $DIR/lifetime-doesnt-live-long-enough.rs:28:5
--> $DIR/lifetime-doesnt-live-long-enough.rs:28:8
|
LL | fn bar<'a, L: X<&'a Nested<Self>>>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^
error[E0309]: the parameter type `L` may not live long enough
--> $DIR/lifetime-doesnt-live-long-enough.rs:32:5
--> $DIR/lifetime-doesnt-live-long-enough.rs:32:8
|
LL | fn baz<'a, L, M: X<&'a Nested<L>>>() {
| ^ - help: consider adding an explicit lifetime bound `L: 'a`...
| _____|
| |
LL | |
LL | | }
| |_____^
LL | fn baz<'a, L, M: X<&'a Nested<L>>>() {
| ^^^ - help: consider adding an explicit lifetime bound `L: 'a`...
|
note: ...so that the reference type `&'a Nested<L>` does not outlive the data it points at
--> $DIR/lifetime-doesnt-live-long-enough.rs:32:5
--> $DIR/lifetime-doesnt-live-long-enough.rs:32:8
|
LL | / fn baz<'a, L, M: X<&'a Nested<L>>>() {
LL | |
LL | | }
| |_____^
LL | fn baz<'a, L, M: X<&'a Nested<L>>>() {
| ^^^
error[E0309]: the parameter type `K` may not live long enough
--> $DIR/lifetime-doesnt-live-long-enough.rs:41:5
--> $DIR/lifetime-doesnt-live-long-enough.rs:41:8
|
LL | impl<K> Nested<K> {
| - help: consider adding an explicit lifetime bound `K: 'a`...
LL | / fn generic_in_parent<'a, L: X<&'a Nested<K>>>() {
LL | |
LL | | }
| |_____^
LL | impl<K> Nested<K> {
| - help: consider adding an explicit lifetime bound `K: 'a`...
LL | fn generic_in_parent<'a, L: X<&'a Nested<K>>>() {
| ^^^^^^^^^^^^^^^^^
|
note: ...so that the reference type `&'a Nested<K>` does not outlive the data it points at
--> $DIR/lifetime-doesnt-live-long-enough.rs:41:5
--> $DIR/lifetime-doesnt-live-long-enough.rs:41:8
|
LL | / fn generic_in_parent<'a, L: X<&'a Nested<K>>>() {
LL | |
LL | | }
| |_____^
LL | fn generic_in_parent<'a, L: X<&'a Nested<K>>>() {
| ^^^^^^^^^^^^^^^^^
error[E0309]: the parameter type `M` may not live long enough
--> $DIR/lifetime-doesnt-live-long-enough.rs:44:5
--> $DIR/lifetime-doesnt-live-long-enough.rs:44:8
|
LL | fn generic_in_child<'a, 'b, L: X<&'a Nested<M>>, M: 'b>() {
| ^ -- help: consider adding an explicit lifetime bound `M: 'a`...
| _____|
| |
LL | |
LL | | }
| |_____^
LL | fn generic_in_child<'a, 'b, L: X<&'a Nested<M>>, M: 'b>() {
| ^^^^^^^^^^^^^^^^ -- help: consider adding an explicit lifetime bound `M: 'a`...
|
note: ...so that the reference type `&'a Nested<M>` does not outlive the data it points at
--> $DIR/lifetime-doesnt-live-long-enough.rs:44:5
--> $DIR/lifetime-doesnt-live-long-enough.rs:44:8
|
LL | / fn generic_in_child<'a, 'b, L: X<&'a Nested<M>>, M: 'b>() {
LL | |
LL | | }
| |_____^
LL | fn generic_in_child<'a, 'b, L: X<&'a Nested<M>>, M: 'b>() {
| ^^^^^^^^^^^^^^^^
error: aborting due to 6 previous errors

View File

@ -1,11 +1,11 @@
error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/object-safety-associated-consts.rs:12:1
--> $DIR/object-safety-associated-consts.rs:12:30
|
LL | const X: usize;
| - the trait cannot contain associated consts like `X`
...
LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object
| ^^^^^^^^ the trait `Bar` cannot be made into an object
error: aborting due to previous error

View File

@ -1,20 +1,20 @@
error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/object-safety-generics.rs:18:1
--> $DIR/object-safety-generics.rs:18:30
|
LL | fn bar<T>(&self, t: T);
| --- method `bar` has generic type parameters
...
LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object
| ^^^^^^^^ the trait `Bar` cannot be made into an object
error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/object-safety-generics.rs:24:1
--> $DIR/object-safety-generics.rs:24:39
|
LL | fn bar<T>(&self, t: T);
| --- method `bar` has generic type parameters
...
LL | fn make_bar_explicit<T:Bar>(t: &T) -> &dyn Bar {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object
| ^^^^^^^^ the trait `Bar` cannot be made into an object
error: aborting due to 2 previous errors

View File

@ -1,20 +1,20 @@
error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/object-safety-mentions-Self.rs:22:1
--> $DIR/object-safety-mentions-Self.rs:22:30
|
LL | fn bar(&self, x: &Self);
| --- method `bar` references the `Self` type in its parameters or return type
...
LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object
| ^^^^^^^^ the trait `Bar` cannot be made into an object
error[E0038]: the trait `Baz` cannot be made into an object
--> $DIR/object-safety-mentions-Self.rs:28:1
--> $DIR/object-safety-mentions-Self.rs:28:30
|
LL | fn baz(&self) -> Self;
| --- method `baz` references the `Self` type in its parameters or return type
...
LL | fn make_baz<T:Baz>(t: &T) -> &dyn Baz {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Baz` cannot be made into an object
| ^^^^^^^^ the trait `Baz` cannot be made into an object
error: aborting due to 2 previous errors

View File

@ -1,11 +1,11 @@
error[E0038]: the trait `Foo` cannot be made into an object
--> $DIR/object-safety-no-static.rs:12:1
--> $DIR/object-safety-no-static.rs:12:18
|
LL | fn foo() {}
| --- associated function `foo` has no `self` parameter
...
LL | fn diverges() -> Box<dyn Foo> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object
| ^^^^^^^^^^^^ the trait `Foo` cannot be made into an object
error: aborting due to previous error

View File

@ -1,8 +1,8 @@
error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/object-safety-sized-2.rs:14:1
--> $DIR/object-safety-sized-2.rs:14:30
|
LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object
| ^^^^^^^^ the trait `Bar` cannot be made into an object
|
= note: the trait cannot require that `Self : Sized`

View File

@ -1,8 +1,8 @@
error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/object-safety-sized.rs:12:1
--> $DIR/object-safety-sized.rs:12:30
|
LL | fn make_bar<T:Bar>(t: &T) -> &dyn Bar {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object
| ^^^^^^^^ the trait `Bar` cannot be made into an object
|
= note: the trait cannot require that `Self : Sized`

View File

@ -1,12 +1,8 @@
error[E0491]: in type `&'a &'b usize`, reference has a longer lifetime than the data it references
--> $DIR/regions-free-region-ordering-callee-4.rs:5:1
--> $DIR/regions-free-region-ordering-callee-4.rs:5:4
|
LL | / fn ordering4<'a, 'b, F>(a: &'a usize, b: &'b usize, x: F) where F: FnOnce(&'a &'b usize) {
LL | |
LL | | // Do not infer ordering from closure argument types.
LL | | let z: Option<&'a &'b usize> = None;
LL | | }
| |_^
LL | fn ordering4<'a, 'b, F>(a: &'a usize, b: &'b usize, x: F) where F: FnOnce(&'a &'b usize) {
| ^^^^^^^^^
|
note: the pointer is valid for the lifetime `'a` as defined on the function body at 5:14
--> $DIR/regions-free-region-ordering-callee-4.rs:5:14

View File

@ -1,11 +1,8 @@
error[E0491]: in type `&'x (dyn for<'z> Trait1<<T as Trait2<'y, 'z>>::Foo> + 'x)`, reference has a longer lifetime than the data it references
--> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:21:1
--> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:21:25
|
LL | / fn callee<'x, 'y, T>(t: &'x dyn for<'z> Trait1< <T as Trait2<'y, 'z>>::Foo >)
LL | |
LL | | {
LL | | }
| |_^
LL | fn callee<'x, 'y, T>(t: &'x dyn for<'z> Trait1< <T as Trait2<'y, 'z>>::Foo >)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the pointer is valid for the lifetime `'x` as defined on the function body at 21:11
--> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:21:11

View File

@ -67,15 +67,10 @@ LL | | }
found `Project<'_, '_>`
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
--> $DIR/regions-normalize-in-where-clause-list.rs:22:1
--> $DIR/regions-normalize-in-where-clause-list.rs:22:4
|
LL | / fn bar<'a, 'b>()
LL | |
LL | |
LL | | where <() as Project<'a, 'b>>::Item : Eq
LL | | {
LL | | }
| |_^
LL | fn bar<'a, 'b>()
| ^^^
|
note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 22:8...
--> $DIR/regions-normalize-in-where-clause-list.rs:22:8
@ -88,15 +83,10 @@ note: ...but the lifetime must also be valid for the lifetime `'b` as defined on
LL | fn bar<'a, 'b>()
| ^^
note: ...so that the types are compatible
--> $DIR/regions-normalize-in-where-clause-list.rs:22:1
--> $DIR/regions-normalize-in-where-clause-list.rs:22:4
|
LL | / fn bar<'a, 'b>()
LL | |
LL | |
LL | | where <() as Project<'a, 'b>>::Item : Eq
LL | | {
LL | | }
| |_^
LL | fn bar<'a, 'b>()
| ^^^
= note: expected `Project<'a, 'b>`
found `Project<'_, '_>`

View File

@ -1,8 +1,8 @@
error[E0038]: the trait `issue_3907::Foo` cannot be made into an object
--> $DIR/issue-3907-2.rs:11:1
--> $DIR/issue-3907-2.rs:11:12
|
LL | fn bar(_x: Foo) {}
| ^^^^^^^^^^^^^^^ the trait `issue_3907::Foo` cannot be made into an object
| ^^^ the trait `issue_3907::Foo` cannot be made into an object
|
= note: associated function `bar` has no `self` parameter

View File

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

View File

@ -1,16 +1,16 @@
error[E0277]: the trait bound `usize: trait_bounds_on_structs_and_enums_xc::Trait` is not satisfied
--> $DIR/trait-bounds-on-structs-and-enums-xc.rs:7:1
--> $DIR/trait-bounds-on-structs-and-enums-xc.rs:7:15
|
LL | fn explode(x: Foo<usize>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `trait_bounds_on_structs_and_enums_xc::Trait` is not implemented for `usize`
| ^^^^^^^^^^ the trait `trait_bounds_on_structs_and_enums_xc::Trait` is not implemented for `usize`
|
= note: required by `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:1
--> $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`
| ^^^^^^^^ the trait `trait_bounds_on_structs_and_enums_xc::Trait` is not implemented for `f32`
|
= note: required by `trait_bounds_on_structs_and_enums_xc::Bar`

View File

@ -1,10 +1,8 @@
error: non-defining opaque type use in defining scope
--> $DIR/generic_duplicate_lifetime_param.rs:7:1
--> $DIR/generic_duplicate_lifetime_param.rs:7:4
|
LL | / fn one<'a>(t: &'a ()) -> Two<'a, 'a> {
LL | | t
LL | | }
| |_^
LL | fn one<'a>(t: &'a ()) -> Two<'a, 'a> {
| ^^^
|
note: lifetime used multiple times
--> $DIR/generic_duplicate_lifetime_param.rs:5:10

View File

@ -1,17 +1,11 @@
error[E0283]: type annotations needed
--> $DIR/issue-40294.rs:5:1
--> $DIR/issue-40294.rs:5:4
|
LL | trait Foo: Sized {
| ---------------- required by `Foo`
LL | trait Foo: Sized {
| ---------------- required by `Foo`
...
LL | / fn foo<'a,'b,T>(x: &'a T, y: &'b T)
LL | | where &'a T : Foo,
LL | | &'b T : Foo
LL | | {
LL | | x.foo();
LL | | y.foo();
LL | | }
| |_^ cannot infer type for reference `&'a T`
LL | fn foo<'a,'b,T>(x: &'a T, y: &'b T)
| ^^^ cannot infer type for reference `&'a T`
|
= note: cannot resolve `&'a T: Foo`

View File

@ -1,32 +1,29 @@
error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied
--> $DIR/wf-fn-where-clause.rs:8:1
--> $DIR/wf-fn-where-clause.rs:8:4
|
LL | trait ExtraCopy<T:Copy> { }
| ----------------------- required by `ExtraCopy`
LL | trait ExtraCopy<T:Copy> { }
| ----------------------- required by `ExtraCopy`
LL |
LL | fn foo<T,U>() where T: ExtraCopy<U>
| ^ - help: consider further restricting type parameter `U`: `, U: std::marker::Copy`
| _|
| |
LL | | {
LL | | }
| |_^ the trait `std::marker::Copy` is not implemented for `U`
LL | fn foo<T,U>() where T: ExtraCopy<U>
| ^^^ - help: consider further restricting type parameter `U`: `, U: std::marker::Copy`
| |
| the trait `std::marker::Copy` is not implemented for `U`
error[E0277]: the size for values of type `(dyn std::marker::Copy + 'static)` cannot be known at compilation time
--> $DIR/wf-fn-where-clause.rs:12:1
--> $DIR/wf-fn-where-clause.rs:12:4
|
LL | fn bar() where Vec<dyn Copy>:, {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
| ^^^ doesn't have a size known at compile-time
|
= 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:1
--> $DIR/wf-fn-where-clause.rs:12:4
|
LL | fn bar() where Vec<dyn Copy>:, {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` cannot be made into an object
| ^^^ the trait `std::marker::Copy` cannot be made into an object
|
= note: the trait cannot require that `Self : Sized`

View File

@ -1,16 +1,13 @@
error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
--> $DIR/wf-in-fn-arg.rs:10:1
--> $DIR/wf-in-fn-arg.rs:10:14
|
LL | struct MustBeCopy<T:Copy> {
| ------------------------- required by `MustBeCopy`
LL | struct MustBeCopy<T:Copy> {
| ------------------------- required by `MustBeCopy`
...
LL | fn bar<T>(_: &MustBeCopy<T>)
| ^ - help: consider restricting this bound: `T: std::marker::Copy`
| _|
| |
LL | | {
LL | | }
| |_^ the trait `std::marker::Copy` is not implemented for `T`
LL | fn bar<T>(_: &MustBeCopy<T>)
| - ^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
| |
| help: consider restricting this bound: `T: std::marker::Copy`
error: aborting due to previous error

View File

@ -1,16 +1,13 @@
error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
--> $DIR/wf-in-fn-ret.rs:10:1
--> $DIR/wf-in-fn-ret.rs:10:16
|
LL | struct MustBeCopy<T:Copy> {
| ------------------------- required by `MustBeCopy`
LL | struct MustBeCopy<T:Copy> {
| ------------------------- required by `MustBeCopy`
...
LL | fn bar<T>() -> MustBeCopy<T>
| ^ - help: consider restricting this bound: `T: std::marker::Copy`
| _|
| |
LL | | {
LL | | }
| |_^ the trait `std::marker::Copy` is not implemented for `T`
LL | fn bar<T>() -> MustBeCopy<T>
| - ^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
| |
| help: consider restricting this bound: `T: std::marker::Copy`
error: aborting due to previous error

View File

@ -1,15 +1,13 @@
error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied
--> $DIR/wf-in-fn-where-clause.rs:9:1
--> $DIR/wf-in-fn-where-clause.rs:9:4
|
LL | trait MustBeCopy<T:Copy> {
| ------------------------ required by `MustBeCopy`
LL | trait MustBeCopy<T:Copy> {
| ------------------------ required by `MustBeCopy`
...
LL | / fn bar<T,U>()
LL | | where T: MustBeCopy<U>
| | - help: consider further restricting type parameter `U`: `, U: std::marker::Copy`
LL | | {
LL | | }
| |_^ the trait `std::marker::Copy` is not implemented for `U`
LL | fn bar<T,U>()
| ^^^ the trait `std::marker::Copy` is not implemented for `U`
LL | where T: MustBeCopy<U>
| - help: consider further restricting type parameter `U`: `, U: std::marker::Copy`
error: aborting due to previous error

View File

@ -1,14 +1,13 @@
error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied
--> $DIR/wf-inherent-impl-method-where-clause.rs:12:5
--> $DIR/wf-inherent-impl-method-where-clause.rs:12:8
|
LL | trait ExtraCopy<T:Copy> { }
| ----------------------- required by `ExtraCopy`
LL | trait ExtraCopy<T:Copy> { }
| ----------------------- required by `ExtraCopy`
...
LL | impl<T,U> Foo<T,U> {
| - help: consider restricting this bound: `U: std::marker::Copy`
LL | / fn foo(self) where T: ExtraCopy<U>
LL | | {}
| |______^ the trait `std::marker::Copy` is not implemented for `U`
LL | impl<T,U> Foo<T,U> {
| - help: consider restricting this bound: `U: std::marker::Copy`
LL | fn foo(self) where T: ExtraCopy<U>
| ^^^ the trait `std::marker::Copy` is not implemented for `U`
error: aborting due to previous error

View File

@ -1,18 +1,13 @@
error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied
--> $DIR/wf-trait-default-fn-arg.rs:11:5
--> $DIR/wf-trait-default-fn-arg.rs:11:22
|
LL | struct Bar<T:Eq+?Sized> { value: Box<T> }
| ----------------------- required by `Bar`
LL | struct Bar<T:Eq+?Sized> { value: Box<T> }
| ----------------------- required by `Bar`
...
LL | fn bar(&self, x: &Bar<Self>) {
| ^ - help: consider further restricting `Self`: `where Self: std::cmp::Eq`
| _____|
| |
LL | |
LL | | //
LL | | // Here, Eq ought to be implemented.
LL | | }
| |_____^ the trait `std::cmp::Eq` is not implemented for `Self`
LL | fn bar(&self, x: &Bar<Self>) {
| ^^^^^^^^^^ - help: consider further restricting `Self`: `where Self: std::cmp::Eq`
| |
| the trait `std::cmp::Eq` is not implemented for `Self`
error: aborting due to previous error

View File

@ -1,19 +1,13 @@
error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied
--> $DIR/wf-trait-default-fn-ret.rs:11:5
--> $DIR/wf-trait-default-fn-ret.rs:11:22
|
LL | struct Bar<T:Eq+?Sized> { value: Box<T> }
| ----------------------- required by `Bar`
LL | struct Bar<T:Eq+?Sized> { value: Box<T> }
| ----------------------- required by `Bar`
...
LL | fn bar(&self) -> Bar<Self> {
| ^ - help: consider further restricting `Self`: `where Self: std::cmp::Eq`
| _____|
| |
LL | |
LL | | //
LL | | // Here, Eq ought to be implemented.
LL | | loop { }
LL | | }
| |_____^ the trait `std::cmp::Eq` is not implemented for `Self`
LL | fn bar(&self) -> Bar<Self> {
| ^^^^^^^^^- help: consider further restricting `Self`: `where Self: std::cmp::Eq`
| |
| the trait `std::cmp::Eq` is not implemented for `Self`
error: aborting due to previous error

View File

@ -1,18 +1,13 @@
error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied
--> $DIR/wf-trait-default-fn-where-clause.rs:11:5
--> $DIR/wf-trait-default-fn-where-clause.rs:11:8
|
LL | trait Bar<T:Eq+?Sized> { }
| ---------------------- required by `Bar`
LL | trait Bar<T:Eq+?Sized> { }
| ---------------------- required by `Bar`
...
LL | fn bar<A>(&self) where A: Bar<Self> {
| ^ - help: consider further restricting `Self`: `, Self: std::cmp::Eq`
| _____|
| |
LL | |
LL | | //
LL | | // Here, Eq ought to be implemented.
LL | | }
| |_____^ the trait `std::cmp::Eq` is not implemented for `Self`
LL | fn bar<A>(&self) where A: Bar<Self> {
| ^^^ - help: consider further restricting `Self`: `, Self: std::cmp::Eq`
| |
| the trait `std::cmp::Eq` is not implemented for `Self`
error: aborting due to previous error

View File

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

View File

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

View File

@ -1,14 +1,13 @@
error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied
--> $DIR/wf-trait-fn-where-clause.rs:10:5
--> $DIR/wf-trait-fn-where-clause.rs:10:8
|
LL | struct Bar<T:Eq+?Sized> { value: Box<T> }
| ----------------------- required by `Bar`
...
LL | fn bar(&self) where Self: Sized, Bar<Self>: Copy;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
| | |
| | help: consider further restricting `Self`: `, Self: std::cmp::Eq`
| the trait `std::cmp::Eq` is not implemented for `Self`
| ^^^ - help: consider further restricting `Self`: `, Self: std::cmp::Eq`
| |
| the trait `std::cmp::Eq` is not implemented for `Self`
error: aborting due to previous error