diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index f417b907a38..0781feee845 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -1015,6 +1015,7 @@ impl<'tcx> GenericPredicates<'tcx> { ) -> InstantiatedPredicates<'tcx> { InstantiatedPredicates { predicates: self.predicates.iter().map(|(p, _)| p.subst(tcx, substs)).collect(), + spans: self.predicates.iter().map(|(_, sp)| *sp).collect(), } } @@ -1028,6 +1029,7 @@ impl<'tcx> GenericPredicates<'tcx> { tcx.predicates_of(def_id).instantiate_into(tcx, instantiated, substs); } instantiated.predicates.extend(self.predicates.iter().map(|(p, _)| p.subst(tcx, substs))); + instantiated.spans.extend(self.predicates.iter().map(|(_, sp)| *sp)); } pub fn instantiate_identity(&self, tcx: TyCtxt<'tcx>) -> InstantiatedPredicates<'tcx> { @@ -1044,7 +1046,8 @@ impl<'tcx> GenericPredicates<'tcx> { if let Some(def_id) = self.parent { tcx.predicates_of(def_id).instantiate_identity_into(tcx, instantiated); } - instantiated.predicates.extend(self.predicates.iter().map(|&(p, _)| p)) + instantiated.predicates.extend(self.predicates.iter().map(|(p, _)| p)); + instantiated.spans.extend(self.predicates.iter().map(|(_, s)| s)); } pub fn instantiate_supertrait( @@ -1059,6 +1062,7 @@ impl<'tcx> GenericPredicates<'tcx> { .iter() .map(|(pred, _)| pred.subst_supertrait(tcx, poly_trait_ref)) .collect(), + spans: self.predicates.iter().map(|(_, sp)| *sp).collect(), } } } @@ -1511,11 +1515,12 @@ impl<'tcx> Predicate<'tcx> { #[derive(Clone, Debug, TypeFoldable)] pub struct InstantiatedPredicates<'tcx> { pub predicates: Vec>, + pub spans: Vec, } impl<'tcx> InstantiatedPredicates<'tcx> { pub fn empty() -> InstantiatedPredicates<'tcx> { - InstantiatedPredicates { predicates: vec![] } + InstantiatedPredicates { predicates: vec![], spans: vec![] } } pub fn is_empty(&self) -> bool { diff --git a/src/librustc_traits/lowering/environment.rs b/src/librustc_traits/lowering/environment.rs index 7df27e67d5b..0e26e9461f4 100644 --- a/src/librustc_traits/lowering/environment.rs +++ b/src/librustc_traits/lowering/environment.rs @@ -161,7 +161,7 @@ crate fn environment(tcx: TyCtxt<'_>, def_id: DefId) -> Environment<'_> { } // Compute the bounds on `Self` and the type parameters. - let ty::InstantiatedPredicates { predicates } = + let ty::InstantiatedPredicates { predicates, .. } = tcx.predicates_of(def_id).instantiate_identity(tcx); let clauses = predicates diff --git a/src/librustc_ty/ty.rs b/src/librustc_ty/ty.rs index 8f882be1a09..9f867cf8ab4 100644 --- a/src/librustc_ty/ty.rs +++ b/src/librustc_ty/ty.rs @@ -228,7 +228,7 @@ fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> { } // Compute the bounds on Self and the type parameters. - let ty::InstantiatedPredicates { predicates } = + let ty::InstantiatedPredicates { predicates, .. } = tcx.predicates_of(def_id).instantiate_identity(tcx); // Finally, we have to normalize the bounds in the environment, in diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 3a4a015c14a..41171117b47 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -665,16 +665,21 @@ fn check_where_clauses<'tcx, 'fcx>( let mut predicates = predicates.instantiate_identity(fcx.tcx); if let Some((return_ty, span)) = return_ty { - predicates.predicates.extend(check_opaque_types(tcx, fcx, def_id, span, return_ty)); + let opaque_types = check_opaque_types(tcx, fcx, def_id, span, return_ty); + for _ in 0..opaque_types.len() { + predicates.spans.push(span); + } + predicates.predicates.extend(opaque_types); } let predicates = fcx.normalize_associated_types_in(span, &predicates); debug!("check_where_clauses: predicates={:?}", predicates.predicates); - let wf_obligations = predicates - .predicates - .iter() - .flat_map(|p| traits::wf::predicate_obligations(fcx, fcx.param_env, fcx.body_id, p, span)); + assert_eq!(predicates.predicates.len(), predicates.spans.len()); + let wf_obligations = + predicates.predicates.iter().zip(predicates.spans.iter()).flat_map(|(p, sp)| { + traits::wf::predicate_obligations(fcx, fcx.param_env, fcx.body_id, p, *sp) + }); for obligation in wf_obligations.chain(default_obligations) { debug!("next obligation cause: {:?}", obligation.cause); diff --git a/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr b/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr index 33fe8a31240..5713e259362 100644 --- a/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr +++ b/src/test/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr @@ -10,9 +10,9 @@ error[E0277]: `<::C as std::iter::Iterator>::Item` is not an iterato --> $DIR/bad-bounds-on-assoc-in-trait.rs:36:1 | LL | fn assume_case1() { - | ^^^^^^^^^^^^ - help: consider further restricting the associated type: `where <::C as std::iter::Iterator>::Item: std::iter::Iterator` - | | - | `<::C as std::iter::Iterator>::Item` is not an iterator + | ^^^^^ - help: consider further restricting the associated type: `where <::C as std::iter::Iterator>::Item: std::iter::Iterator` + | | + | `<::C as std::iter::Iterator>::Item` is not an iterator | = help: the trait `std::iter::Iterator` is not implemented for `<::C as std::iter::Iterator>::Item` @@ -23,9 +23,9 @@ LL | trait Case1 { | ----------- required by `Case1` ... LL | fn assume_case1() { - | ^^^^^^^^^^^^ - help: consider further restricting the associated type: `where <::C as std::iter::Iterator>::Item: std::marker::Send` - | | - | `<::C as std::iter::Iterator>::Item` cannot be sent between threads safely + | ^^^^^ - help: consider further restricting the associated type: `where <::C as std::iter::Iterator>::Item: std::marker::Send` + | | + | `<::C as std::iter::Iterator>::Item` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `<::C as std::iter::Iterator>::Item` @@ -36,9 +36,9 @@ LL | trait Case1 { | ----------- required by `Case1` ... LL | fn assume_case1() { - | ^^^^^^^^^^^^ - help: consider further restricting the associated type: `where <::C as std::iter::Iterator>::Item: std::marker::Sync` - | | - | `<::C as std::iter::Iterator>::Item` cannot be shared between threads safely + | ^^^^^ - help: consider further restricting the associated type: `where <::C as std::iter::Iterator>::Item: std::marker::Sync` + | | + | `<::C as std::iter::Iterator>::Item` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `<::C as std::iter::Iterator>::Item` @@ -49,7 +49,7 @@ LL | trait Case1 { | ----------- required by `Case1` ... LL | fn assume_case1() { - | ^^^^^^^^^^^^ `<_ as Lam<&'a u8>>::App` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` + | ^^^^^ `<_ 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` diff --git a/src/test/ui/associated-types/associated-types-overridden-binding.stderr b/src/test/ui/associated-types/associated-types-overridden-binding.stderr index 069da955b67..9e10ed7b729 100644 --- a/src/test/ui/associated-types/associated-types-overridden-binding.stderr +++ b/src/test/ui/associated-types/associated-types-overridden-binding.stderr @@ -1,20 +1,20 @@ error[E0284]: type annotations needed - --> $DIR/associated-types-overridden-binding.rs:4:1 + --> $DIR/associated-types-overridden-binding.rs:4:12 | LL | trait Foo: Iterator {} | ------------------------------- required by `Foo` LL | trait Bar: Foo {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `Self` + | ^^^^^^^^^^^^^^^ cannot infer type for type parameter `Self` | = note: cannot resolve `::Item == i32` error[E0284]: type annotations needed - --> $DIR/associated-types-overridden-binding.rs:7:1 + --> $DIR/associated-types-overridden-binding.rs:7:21 | LL | trait I32Iterator = Iterator; | ----------------------------------------- required by `I32Iterator` LL | trait U32Iterator = I32Iterator; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `Self` + | ^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for type parameter `Self` | = note: cannot resolve `::Item == i32` diff --git a/src/test/ui/error-codes/E0275.stderr b/src/test/ui/error-codes/E0275.stderr index f607a9fbbf2..1d087a46594 100644 --- a/src/test/ui/error-codes/E0275.stderr +++ b/src/test/ui/error-codes/E0275.stderr @@ -1,11 +1,11 @@ error[E0275]: overflow evaluating the requirement `Bar>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo` - --> $DIR/E0275.rs:5:1 + --> $DIR/E0275.rs:5:33 | LL | trait Foo {} | --------- required by `Foo` ... LL | impl Foo for T where Bar: Foo {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^ | = help: consider adding a `#![recursion_limit="256"]` attribute to your crate = note: required because of the requirements on the impl of `Foo` for `Bar>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` diff --git a/src/test/ui/generic-associated-types/issue-62326-parameter-out-of-range.rs b/src/test/ui/generic-associated-types/issue-62326-parameter-out-of-range.rs index 60466d0bcd0..1a79dbf2279 100644 --- a/src/test/ui/generic-associated-types/issue-62326-parameter-out-of-range.rs +++ b/src/test/ui/generic-associated-types/issue-62326-parameter-out-of-range.rs @@ -4,8 +4,8 @@ // FIXME(generic-associated-types) Investigate why this doesn't compile. trait Iterator { - //~^ ERROR the requirement `for<'a> ::Item<'a>: 'a` is not satisfied type Item<'a>: 'a; + //~^ ERROR the requirement `for<'a> ::Item<'a>: 'a` is not satisfied } fn main() {} diff --git a/src/test/ui/generic-associated-types/issue-62326-parameter-out-of-range.stderr b/src/test/ui/generic-associated-types/issue-62326-parameter-out-of-range.stderr index 4dc69cdd1dc..68742396236 100644 --- a/src/test/ui/generic-associated-types/issue-62326-parameter-out-of-range.stderr +++ b/src/test/ui/generic-associated-types/issue-62326-parameter-out-of-range.stderr @@ -1,15 +1,10 @@ error[E0280]: the requirement `for<'a> ::Item<'a>: 'a` is not satisfied - --> $DIR/issue-62326-parameter-out-of-range.rs:6:1 + --> $DIR/issue-62326-parameter-out-of-range.rs:7:20 | -LL | trait Iterator { - | ^------------- - | | - | _required by `Iterator` - | | -LL | | -LL | | type Item<'a>: 'a; -LL | | } - | |_^ +LL | trait Iterator { + | -------------- required by `Iterator` +LL | type Item<'a>: 'a; + | ^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-20005.rs b/src/test/ui/issues/issue-20005.rs index 6d63c9e5b61..36350bff100 100644 --- a/src/test/ui/issues/issue-20005.rs +++ b/src/test/ui/issues/issue-20005.rs @@ -5,9 +5,9 @@ trait From { } trait To { - fn to( //~ ERROR the size for values of type + fn to( self - ) -> >::Result where Dst: From { + ) -> >::Result where Dst: From { //~ ERROR the size for values of type From::from(self) } } diff --git a/src/test/ui/issues/issue-20005.stderr b/src/test/ui/issues/issue-20005.stderr index 7c4115b4d3f..529571a6b74 100644 --- a/src/test/ui/issues/issue-20005.stderr +++ b/src/test/ui/issues/issue-20005.stderr @@ -1,14 +1,13 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation time - --> $DIR/issue-20005.rs:8:8 + --> $DIR/issue-20005.rs:10:49 | LL | trait From { | --------------- required by `From` ... -LL | fn to( - | ^^ doesn't have a size known at compile-time -LL | self LL | ) -> >::Result where Dst: From { - | - help: consider further restricting `Self`: `, Self: std::marker::Sized` + | ^^^^^^^^^^- help: consider further restricting `Self`: `, Self: std::marker::Sized` + | | + | doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Self` = note: to learn more, visit diff --git a/src/test/ui/issues/issue-20413.rs b/src/test/ui/issues/issue-20413.rs index 7eb6d5c0ecb..19ef52af657 100644 --- a/src/test/ui/issues/issue-20413.rs +++ b/src/test/ui/issues/issue-20413.rs @@ -6,9 +6,9 @@ struct NoData; //~^ ERROR: parameter `T` is never used impl Foo for T where NoData: Foo { -//~^ ERROR: overflow evaluating the requirement - fn answer(self) { //~^ ERROR: overflow evaluating the requirement + //~| ERROR: overflow evaluating the requirement + fn answer(self) { let val: NoData = NoData; } } diff --git a/src/test/ui/issues/issue-20413.stderr b/src/test/ui/issues/issue-20413.stderr index 7aec4a847c9..e765144ff0b 100644 --- a/src/test/ui/issues/issue-20413.stderr +++ b/src/test/ui/issues/issue-20413.stderr @@ -7,19 +7,13 @@ LL | struct NoData; = help: consider removing `T`, referring to it in a field, or using a marker such as `std::marker::PhantomData` error[E0275]: overflow evaluating the requirement `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo` - --> $DIR/issue-20413.rs:8:1 + --> $DIR/issue-20413.rs:8:36 | -LL | trait Foo { - | --------- required by `Foo` +LL | trait Foo { + | --------- required by `Foo` ... -LL | / impl Foo for T where NoData: Foo { -LL | | -LL | | fn answer(self) { -LL | | -LL | | let val: NoData = NoData; -LL | | } -LL | | } - | |_^ +LL | impl Foo for T where NoData: Foo { + | ^^^ | = help: consider adding a `#![recursion_limit="256"]` attribute to your crate = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` @@ -151,13 +145,13 @@ LL | | } = note: required because of the requirements on the impl of `Foo` for `NoData` error[E0275]: overflow evaluating the requirement `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo` - --> $DIR/issue-20413.rs:10:6 + --> $DIR/issue-20413.rs:8:36 | LL | trait Foo { | --------- required by `Foo` ... -LL | fn answer(self) { - | ^^^^^^ +LL | impl Foo for T where NoData: Foo { + | ^^^ | = help: consider adding a `#![recursion_limit="256"]` attribute to your crate = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` diff --git a/src/test/ui/issues/issue-21974.rs b/src/test/ui/issues/issue-21974.rs index 0cbe38d6ec0..f7c659be148 100644 --- a/src/test/ui/issues/issue-21974.rs +++ b/src/test/ui/issues/issue-21974.rs @@ -7,8 +7,8 @@ trait Foo { fn foo(self); } -fn foo<'a,'b,T>(x: &'a T, y: &'b T) //~ ERROR type annotations needed - where &'a T : Foo, +fn foo<'a,'b,T>(x: &'a T, y: &'b T) + where &'a T : Foo, //~ ERROR type annotations needed &'b T : Foo { x.foo(); diff --git a/src/test/ui/issues/issue-21974.stderr b/src/test/ui/issues/issue-21974.stderr index ebaef10cfef..19823499066 100644 --- a/src/test/ui/issues/issue-21974.stderr +++ b/src/test/ui/issues/issue-21974.stderr @@ -1,11 +1,11 @@ error[E0283]: type annotations needed - --> $DIR/issue-21974.rs:10:4 + --> $DIR/issue-21974.rs:11:19 | LL | trait Foo { | --------- required by `Foo` ... -LL | fn foo<'a,'b,T>(x: &'a T, y: &'b T) - | ^^^ cannot infer type for reference `&'a T` +LL | where &'a T : Foo, + | ^^^ cannot infer type for reference `&'a T` | = note: cannot resolve `&'a T: Foo` diff --git a/src/test/ui/issues/issue-24204.stderr b/src/test/ui/issues/issue-24204.stderr index a1a6960a3f7..2a714861da1 100644 --- a/src/test/ui/issues/issue-24204.stderr +++ b/src/test/ui/issues/issue-24204.stderr @@ -1,11 +1,11 @@ error[E0271]: type mismatch resolving `<::A as MultiDispatch>::O == T` - --> $DIR/issue-24204.rs:14:4 + --> $DIR/issue-24204.rs:14:12 | LL | trait Trait: Sized { | ------------------ required by `Trait` ... LL | fn test>(b: i32) -> T where T::A: MultiDispatch { 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 `<::A as MultiDispatch>::O` diff --git a/src/test/ui/issues/issue-24424.stderr b/src/test/ui/issues/issue-24424.stderr index 8f0850328b4..538d44c3b2e 100644 --- a/src/test/ui/issues/issue-24424.stderr +++ b/src/test/ui/issues/issue-24424.stderr @@ -1,11 +1,11 @@ error[E0283]: type annotations needed - --> $DIR/issue-24424.rs:4:1 + --> $DIR/issue-24424.rs:4:57 | LL | trait Trait0<'l0> {} | ----------------- required by `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` + | ^^^^^^^^^^^ cannot infer type for type parameter `T0` | = note: cannot resolve `T0: Trait0<'l0>` diff --git a/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr b/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr index 3154c502625..4e50064efb4 100644 --- a/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr +++ b/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr @@ -13,69 +13,71 @@ LL | foo: &'static T | ^^^^^^^^^^^^^^^ error[E0309]: the parameter type `K` may not live long enough - --> $DIR/lifetime-doesnt-live-long-enough.rs:24:8 + --> $DIR/lifetime-doesnt-live-long-enough.rs:24:19 | LL | trait X: Sized { | - help: consider adding an explicit lifetime bound `K: 'a`... LL | fn foo<'a, L: X<&'a Nested>>(); - | ^^^ + | ^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'a Nested` does not outlive the data it points at - --> $DIR/lifetime-doesnt-live-long-enough.rs:24:8 + --> $DIR/lifetime-doesnt-live-long-enough.rs:24:19 | LL | fn foo<'a, L: X<&'a Nested>>(); - | ^^^ + | ^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `Self` may not live long enough - --> $DIR/lifetime-doesnt-live-long-enough.rs:28:8 + --> $DIR/lifetime-doesnt-live-long-enough.rs:28:19 | LL | fn bar<'a, L: X<&'a Nested>>(); - | ^^^ + | ^^^^^^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `Self: 'a`... note: ...so that the reference type `&'a Nested` does not outlive the data it points at - --> $DIR/lifetime-doesnt-live-long-enough.rs:28:8 + --> $DIR/lifetime-doesnt-live-long-enough.rs:28:19 | LL | fn bar<'a, L: X<&'a Nested>>(); - | ^^^ + | ^^^^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `L` may not live long enough - --> $DIR/lifetime-doesnt-live-long-enough.rs:32:8 + --> $DIR/lifetime-doesnt-live-long-enough.rs:32:22 | LL | fn baz<'a, L, M: X<&'a Nested>>() { - | ^^^ - help: consider adding an explicit lifetime bound `L: 'a`... + | - ^^^^^^^^^^^^^^^^ + | | + | help: consider adding an explicit lifetime bound `L: 'a`... | note: ...so that the reference type `&'a Nested` does not outlive the data it points at - --> $DIR/lifetime-doesnt-live-long-enough.rs:32:8 + --> $DIR/lifetime-doesnt-live-long-enough.rs:32:22 | LL | fn baz<'a, L, M: X<&'a Nested>>() { - | ^^^ + | ^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `K` may not live long enough - --> $DIR/lifetime-doesnt-live-long-enough.rs:41:8 + --> $DIR/lifetime-doesnt-live-long-enough.rs:41:33 | LL | impl Nested { | - help: consider adding an explicit lifetime bound `K: 'a`... LL | fn generic_in_parent<'a, L: X<&'a Nested>>() { - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'a Nested` does not outlive the data it points at - --> $DIR/lifetime-doesnt-live-long-enough.rs:41:8 + --> $DIR/lifetime-doesnt-live-long-enough.rs:41:33 | LL | fn generic_in_parent<'a, L: X<&'a Nested>>() { - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `M` may not live long enough - --> $DIR/lifetime-doesnt-live-long-enough.rs:44:8 + --> $DIR/lifetime-doesnt-live-long-enough.rs:44:36 | LL | fn generic_in_child<'a, 'b, L: X<&'a Nested>, M: 'b>() { - | ^^^^^^^^^^^^^^^^ -- help: consider adding an explicit lifetime bound `M: 'a`... + | ^^^^^^^^^^^^^^^^ -- help: consider adding an explicit lifetime bound `M: 'a`... | note: ...so that the reference type `&'a Nested` does not outlive the data it points at - --> $DIR/lifetime-doesnt-live-long-enough.rs:44:8 + --> $DIR/lifetime-doesnt-live-long-enough.rs:44:36 | LL | fn generic_in_child<'a, 'b, L: X<&'a Nested>, M: 'b>() { - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/regions/regions-free-region-ordering-callee-4.stderr b/src/test/ui/regions/regions-free-region-ordering-callee-4.stderr index ad300f38ca5..5ab423d9e20 100644 --- a/src/test/ui/regions/regions-free-region-ordering-callee-4.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-callee-4.stderr @@ -1,8 +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:4 + --> $DIR/regions-free-region-ordering-callee-4.rs:5:68 | 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 diff --git a/src/test/ui/suggestions/missing-assoc-type-bound-restriction.stderr b/src/test/ui/suggestions/missing-assoc-type-bound-restriction.stderr index c6f2e5cda66..31d974ed43d 100644 --- a/src/test/ui/suggestions/missing-assoc-type-bound-restriction.stderr +++ b/src/test/ui/suggestions/missing-assoc-type-bound-restriction.stderr @@ -1,20 +1,13 @@ error[E0277]: the trait bound `::Assoc: Child` is not satisfied - --> $DIR/missing-assoc-type-bound-restriction.rs:17:1 + --> $DIR/missing-assoc-type-bound-restriction.rs:17:19 | -LL | trait Parent { - | ------------ required by `Parent` +LL | trait Parent { + | ------------ required by `Parent` ... -LL | impl> Parent for ParentWrapper { - | ^ - help: consider further restricting the associated type: `where ::Assoc: Child` - | _| - | | -LL | | -LL | | type Ty = A; -LL | | type Assoc = ChildWrapper; -LL | | -LL | | -LL | | } - | |_^ the trait `Child` is not implemented for `::Assoc` +LL | impl> Parent for ParentWrapper { + | ^^^^^^ - help: consider further restricting the associated type: `where ::Assoc: Child` + | | + | the trait `Child` is not implemented for `::Assoc` error[E0277]: the trait bound `::Assoc: Child` is not satisfied --> $DIR/missing-assoc-type-bound-restriction.rs:20:5 diff --git a/src/test/ui/traits/trait-alias/trait-alias-wf.stderr b/src/test/ui/traits/trait-alias/trait-alias-wf.stderr index 4355a517bd7..b71c0d719ff 100644 --- a/src/test/ui/traits/trait-alias/trait-alias-wf.stderr +++ b/src/test/ui/traits/trait-alias/trait-alias-wf.stderr @@ -1,13 +1,12 @@ error[E0277]: the trait bound `T: Foo` is not satisfied - --> $DIR/trait-alias-wf.rs:5:1 + --> $DIR/trait-alias-wf.rs:5:14 | LL | trait A {} | --------------- required by `A` LL | trait B = A; - | ^^^^^^^^-^^^^^^^^^ - | | | - | | help: consider restricting this bound: `T: Foo` - | the trait `Foo` is not implemented for `T` + | - ^^^^ the trait `Foo` is not implemented for `T` + | | + | help: consider restricting this bound: `T: Foo` error: aborting due to previous error diff --git a/src/test/ui/type/type-check-defaults.stderr b/src/test/ui/type/type-check-defaults.stderr index 6f84b37d612..e5d2ebda318 100644 --- a/src/test/ui/type/type-check-defaults.stderr +++ b/src/test/ui/type/type-check-defaults.stderr @@ -47,15 +47,14 @@ LL | trait TraitBound {} | required by `TraitBound` error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/type-check-defaults.rs:21:1 + --> $DIR/type-check-defaults.rs:21:25 | LL | trait Super { } | -------------------- required by `Super` LL | trait Base: Super { } - | ^^^^^^^^^^^-^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | help: consider restricting this bound: `T: std::marker::Copy` - | the trait `std::marker::Copy` is not implemented for `T` + | - ^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` + | | + | help: consider restricting this bound: `T: std::marker::Copy` error[E0277]: cannot add `u8` to `i32` --> $DIR/type-check-defaults.rs:24:66 diff --git a/src/test/ui/type/type-check/issue-40294.rs b/src/test/ui/type/type-check/issue-40294.rs index 7e6429ccfbe..5493a4e5f10 100644 --- a/src/test/ui/type/type-check/issue-40294.rs +++ b/src/test/ui/type/type-check/issue-40294.rs @@ -2,8 +2,8 @@ trait Foo: Sized { fn foo(self); } -fn foo<'a,'b,T>(x: &'a T, y: &'b T) //~ ERROR type annotations needed - where &'a T : Foo, +fn foo<'a,'b,T>(x: &'a T, y: &'b T) + where &'a T : Foo, //~ ERROR type annotations needed &'b T : Foo { x.foo(); diff --git a/src/test/ui/type/type-check/issue-40294.stderr b/src/test/ui/type/type-check/issue-40294.stderr index 4a04b71d82f..2c889b6c2ca 100644 --- a/src/test/ui/type/type-check/issue-40294.stderr +++ b/src/test/ui/type/type-check/issue-40294.stderr @@ -1,11 +1,11 @@ error[E0283]: type annotations needed - --> $DIR/issue-40294.rs:5:4 + --> $DIR/issue-40294.rs:6:19 | LL | trait Foo: Sized { | ---------------- required by `Foo` ... -LL | fn foo<'a,'b,T>(x: &'a T, y: &'b T) - | ^^^ cannot infer type for reference `&'a T` +LL | where &'a T : Foo, + | ^^^ cannot infer type for reference `&'a T` | = note: cannot resolve `&'a T: Foo` diff --git a/src/test/ui/wf/wf-enum-bound.rs b/src/test/ui/wf/wf-enum-bound.rs index c9eb9d89433..042a2cb09d2 100644 --- a/src/test/ui/wf/wf-enum-bound.rs +++ b/src/test/ui/wf/wf-enum-bound.rs @@ -6,8 +6,8 @@ trait ExtraCopy { } -enum SomeEnum //~ ERROR E0277 - where T: ExtraCopy +enum SomeEnum + where T: ExtraCopy //~ ERROR E0277 { SomeVariant(T,U) } diff --git a/src/test/ui/wf/wf-enum-bound.stderr b/src/test/ui/wf/wf-enum-bound.stderr index eaacd6b6881..0d22d18bf6f 100644 --- a/src/test/ui/wf/wf-enum-bound.stderr +++ b/src/test/ui/wf/wf-enum-bound.stderr @@ -1,16 +1,13 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied - --> $DIR/wf-enum-bound.rs:9:1 + --> $DIR/wf-enum-bound.rs:10:14 | -LL | trait ExtraCopy { } - | ----------------------- required by `ExtraCopy` -LL | -LL | / enum SomeEnum -LL | | where T: ExtraCopy - | | - help: consider further restricting type parameter `U`: `, U: std::marker::Copy` -LL | | { -LL | | SomeVariant(T,U) -LL | | } - | |_^ the trait `std::marker::Copy` is not implemented for `U` +LL | trait ExtraCopy { } + | ----------------------- required by `ExtraCopy` +... +LL | where T: ExtraCopy + | ^^^^^^^^^^^^- help: consider further restricting type parameter `U`: `, U: std::marker::Copy` + | | + | the trait `std::marker::Copy` is not implemented for `U` error: aborting due to previous error diff --git a/src/test/ui/wf/wf-fn-where-clause.stderr b/src/test/ui/wf/wf-fn-where-clause.stderr index 5d41dc77d8b..3bef38d2fd2 100644 --- a/src/test/ui/wf/wf-fn-where-clause.stderr +++ b/src/test/ui/wf/wf-fn-where-clause.stderr @@ -1,29 +1,29 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied - --> $DIR/wf-fn-where-clause.rs:8:4 + --> $DIR/wf-fn-where-clause.rs:8:24 | LL | trait ExtraCopy { } | ----------------------- required by `ExtraCopy` LL | LL | fn foo() where T: ExtraCopy - | ^^^ - help: consider further restricting type parameter `U`: `, U: std::marker::Copy` - | | - | the trait `std::marker::Copy` is not implemented for `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:4 + --> $DIR/wf-fn-where-clause.rs:12:16 | LL | fn bar() where Vec:, {} - | ^^^ 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 = 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:4 + --> $DIR/wf-fn-where-clause.rs:12:16 | LL | fn bar() where Vec:, {} - | ^^^ 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` diff --git a/src/test/ui/wf/wf-in-fn-where-clause.rs b/src/test/ui/wf/wf-in-fn-where-clause.rs index 65a1771d41a..e55295a3b25 100644 --- a/src/test/ui/wf/wf-in-fn-where-clause.rs +++ b/src/test/ui/wf/wf-in-fn-where-clause.rs @@ -6,8 +6,8 @@ trait MustBeCopy { } -fn bar() //~ ERROR E0277 - where T: MustBeCopy +fn bar() + where T: MustBeCopy //~ ERROR E0277 { } diff --git a/src/test/ui/wf/wf-in-fn-where-clause.stderr b/src/test/ui/wf/wf-in-fn-where-clause.stderr index e1a281626b9..495041b7dad 100644 --- a/src/test/ui/wf/wf-in-fn-where-clause.stderr +++ b/src/test/ui/wf/wf-in-fn-where-clause.stderr @@ -1,13 +1,13 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied - --> $DIR/wf-in-fn-where-clause.rs:9:4 + --> $DIR/wf-in-fn-where-clause.rs:10:14 | LL | trait MustBeCopy { | ------------------------ required by `MustBeCopy` ... -LL | fn bar() - | ^^^ the trait `std::marker::Copy` is not implemented for `U` LL | where T: MustBeCopy - | - help: consider further restricting type parameter `U`: `, U: std::marker::Copy` + | ^^^^^^^^^^^^^- help: consider further restricting type parameter `U`: `, U: std::marker::Copy` + | | + | the trait `std::marker::Copy` is not implemented for `U` error: aborting due to previous error diff --git a/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr b/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr index 16079c8197c..e9c1c8ddaf6 100644 --- a/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr +++ b/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied - --> $DIR/wf-inherent-impl-method-where-clause.rs:12:8 + --> $DIR/wf-inherent-impl-method-where-clause.rs:12:27 | LL | trait ExtraCopy { } | ----------------------- required by `ExtraCopy` @@ -7,7 +7,7 @@ LL | trait ExtraCopy { } LL | impl Foo { | - help: consider restricting this bound: `U: std::marker::Copy` LL | fn foo(self) where T: ExtraCopy - | ^^^ the trait `std::marker::Copy` is not implemented for `U` + | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `U` error: aborting due to previous error diff --git a/src/test/ui/wf/wf-inherent-impl-where-clause.stderr b/src/test/ui/wf/wf-inherent-impl-where-clause.stderr index 35b90933813..a4e6dce39cd 100644 --- a/src/test/ui/wf/wf-inherent-impl-where-clause.stderr +++ b/src/test/ui/wf/wf-inherent-impl-where-clause.stderr @@ -1,16 +1,13 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied - --> $DIR/wf-inherent-impl-where-clause.rs:11:1 + --> $DIR/wf-inherent-impl-where-clause.rs:11:29 | -LL | trait ExtraCopy { } - | ----------------------- required by `ExtraCopy` +LL | trait ExtraCopy { } + | ----------------------- required by `ExtraCopy` ... -LL | impl Foo where T: ExtraCopy - | ^ - help: consider further restricting type parameter `U`: `, U: std::marker::Copy` - | _| - | | -LL | | { -LL | | } - | |_^ the trait `std::marker::Copy` is not implemented for `U` +LL | impl Foo where T: ExtraCopy + | ^^^^^^^^^^^^- help: consider further restricting type parameter `U`: `, U: std::marker::Copy` + | | + | the trait `std::marker::Copy` is not implemented for `U` error: aborting due to previous error diff --git a/src/test/ui/wf/wf-struct-bound.rs b/src/test/ui/wf/wf-struct-bound.rs index 69be71cd130..6e558ca8ff0 100644 --- a/src/test/ui/wf/wf-struct-bound.rs +++ b/src/test/ui/wf/wf-struct-bound.rs @@ -6,8 +6,8 @@ trait ExtraCopy { } -struct SomeStruct //~ ERROR E0277 - where T: ExtraCopy +struct SomeStruct + where T: ExtraCopy //~ ERROR E0277 { data: (T,U) } diff --git a/src/test/ui/wf/wf-struct-bound.stderr b/src/test/ui/wf/wf-struct-bound.stderr index 21559773492..3f4047d9b56 100644 --- a/src/test/ui/wf/wf-struct-bound.stderr +++ b/src/test/ui/wf/wf-struct-bound.stderr @@ -1,16 +1,13 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied - --> $DIR/wf-struct-bound.rs:9:1 + --> $DIR/wf-struct-bound.rs:10:14 | -LL | trait ExtraCopy { } - | ----------------------- required by `ExtraCopy` -LL | -LL | / struct SomeStruct -LL | | where T: ExtraCopy - | | - help: consider further restricting type parameter `U`: `, U: std::marker::Copy` -LL | | { -LL | | data: (T,U) -LL | | } - | |_^ the trait `std::marker::Copy` is not implemented for `U` +LL | trait ExtraCopy { } + | ----------------------- required by `ExtraCopy` +... +LL | where T: ExtraCopy + | ^^^^^^^^^^^^- help: consider further restricting type parameter `U`: `, U: std::marker::Copy` + | | + | the trait `std::marker::Copy` is not implemented for `U` error: aborting due to previous error diff --git a/src/test/ui/wf/wf-trait-associated-type-bound.rs b/src/test/ui/wf/wf-trait-associated-type-bound.rs index 29e305577ac..2f20e65e502 100644 --- a/src/test/ui/wf/wf-trait-associated-type-bound.rs +++ b/src/test/ui/wf/wf-trait-associated-type-bound.rs @@ -6,8 +6,8 @@ trait ExtraCopy { } -trait SomeTrait { //~ ERROR E0277 - type Type1: ExtraCopy; +trait SomeTrait { + type Type1: ExtraCopy; //~ ERROR E0277 } diff --git a/src/test/ui/wf/wf-trait-associated-type-bound.stderr b/src/test/ui/wf/wf-trait-associated-type-bound.stderr index af0433fd22f..3370cfc8693 100644 --- a/src/test/ui/wf/wf-trait-associated-type-bound.stderr +++ b/src/test/ui/wf/wf-trait-associated-type-bound.stderr @@ -1,16 +1,13 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/wf-trait-associated-type-bound.rs:9:1 + --> $DIR/wf-trait-associated-type-bound.rs:10:17 | -LL | trait ExtraCopy { } - | ----------------------- required by `ExtraCopy` +LL | trait ExtraCopy { } + | ----------------------- required by `ExtraCopy` LL | -LL | trait SomeTrait { - | ^ - help: consider restricting this bound: `T: std::marker::Copy` - | _| - | | -LL | | type Type1: ExtraCopy; -LL | | } - | |_^ the trait `std::marker::Copy` is not implemented for `T` +LL | trait SomeTrait { + | - help: consider restricting this bound: `T: std::marker::Copy` +LL | type Type1: ExtraCopy; + | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` error: aborting due to previous error diff --git a/src/test/ui/wf/wf-trait-bound.rs b/src/test/ui/wf/wf-trait-bound.rs index d8746ba4d6e..62a1eb5b088 100644 --- a/src/test/ui/wf/wf-trait-bound.rs +++ b/src/test/ui/wf/wf-trait-bound.rs @@ -6,8 +6,8 @@ trait ExtraCopy { } -trait SomeTrait //~ ERROR E0277 - where T: ExtraCopy +trait SomeTrait + where T: ExtraCopy //~ ERROR E0277 { } diff --git a/src/test/ui/wf/wf-trait-bound.stderr b/src/test/ui/wf/wf-trait-bound.stderr index 13e2f8f5901..87c33714ff8 100644 --- a/src/test/ui/wf/wf-trait-bound.stderr +++ b/src/test/ui/wf/wf-trait-bound.stderr @@ -1,15 +1,13 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied - --> $DIR/wf-trait-bound.rs:9:1 + --> $DIR/wf-trait-bound.rs:10:14 | -LL | trait ExtraCopy { } - | ----------------------- required by `ExtraCopy` -LL | -LL | / trait SomeTrait -LL | | where T: ExtraCopy - | | - help: consider further restricting type parameter `U`: `, U: std::marker::Copy` -LL | | { -LL | | } - | |_^ the trait `std::marker::Copy` is not implemented for `U` +LL | trait ExtraCopy { } + | ----------------------- required by `ExtraCopy` +... +LL | where T: ExtraCopy + | ^^^^^^^^^^^^- help: consider further restricting type parameter `U`: `, U: std::marker::Copy` + | | + | the trait `std::marker::Copy` is not implemented for `U` error: aborting due to previous error diff --git a/src/test/ui/wf/wf-trait-default-fn-where-clause.stderr b/src/test/ui/wf/wf-trait-default-fn-where-clause.stderr index 984237ce3b4..6b63feaba89 100644 --- a/src/test/ui/wf/wf-trait-default-fn-where-clause.stderr +++ b/src/test/ui/wf/wf-trait-default-fn-where-clause.stderr @@ -1,13 +1,13 @@ error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied - --> $DIR/wf-trait-default-fn-where-clause.rs:11:8 + --> $DIR/wf-trait-default-fn-where-clause.rs:11:31 | LL | trait Bar { } | ---------------------- required by `Bar` ... LL | fn bar(&self) where A: Bar { - | ^^^ - 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 diff --git a/src/test/ui/wf/wf-trait-fn-where-clause.stderr b/src/test/ui/wf/wf-trait-fn-where-clause.stderr index 34cda077963..ec8f02c9c4f 100644 --- a/src/test/ui/wf/wf-trait-fn-where-clause.stderr +++ b/src/test/ui/wf/wf-trait-fn-where-clause.stderr @@ -1,13 +1,13 @@ error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied - --> $DIR/wf-trait-fn-where-clause.rs:10:8 + --> $DIR/wf-trait-fn-where-clause.rs:10:49 | LL | struct Bar { value: Box } | ----------------------- required by `Bar` ... LL | fn bar(&self) where Self: Sized, Bar: 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 diff --git a/src/test/ui/wf/wf-trait-superbound.stderr b/src/test/ui/wf/wf-trait-superbound.stderr index a61b8dd3a38..9ea9d046b26 100644 --- a/src/test/ui/wf/wf-trait-superbound.stderr +++ b/src/test/ui/wf/wf-trait-superbound.stderr @@ -1,15 +1,13 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/wf-trait-superbound.rs:9:1 + --> $DIR/wf-trait-superbound.rs:9:21 | -LL | trait ExtraCopy { } - | ----------------------- required by `ExtraCopy` +LL | trait ExtraCopy { } + | ----------------------- required by `ExtraCopy` LL | -LL | trait SomeTrait: ExtraCopy { - | ^ - help: consider restricting this bound: `T: std::marker::Copy` - | _| - | | -LL | | } - | |_^ the trait `std::marker::Copy` is not implemented for `T` +LL | trait SomeTrait: ExtraCopy { + | - ^^^^^^^^^^^^ 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