diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs index 83591219b14dc..0ba665d6023ee 100644 --- a/compiler/rustc_trait_selection/src/traits/project.rs +++ b/compiler/rustc_trait_selection/src/traits/project.rs @@ -415,7 +415,12 @@ pub(super) fn opt_normalize_projection_term<'a, 'b, 'tcx>( let result = Normalized { value: projected_ty, obligations: PredicateObligations::new() }; infcx.inner.borrow_mut().projection_cache().insert_term(cache_key, result.clone()); - // No need to extend `obligations`. + obligations.push(Obligation::new( + infcx.tcx, + cause, + param_env, + projection_term.trait_ref(infcx.tcx), + )); Ok(Some(result.value)) } Err(ProjectionError::TooManyCandidates) => { diff --git a/tests/ui/associated-types/hr-associated-type-bound-1.stderr b/tests/ui/associated-types/hr-associated-type-bound-1.stderr index 5b00e714194d6..a3e057f4273da 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-1.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-1.stderr @@ -1,3 +1,41 @@ +error: implementation of `X` is not general enough + | + = note: `Self` must implement `X<'0>`, for any lifetime `'0`... + = note: ...but it actually implements `X<'a>` + +error: implementation of `X` is not general enough + | + = note: `Self` must implement `X<'0>`, for any lifetime `'0`... + = note: ...but it actually implements `X<'a>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `X` is not general enough + --> $DIR/hr-associated-type-bound-1.rs:1:1 + | +LL | / trait X<'a> +LL | | where +LL | | for<'b> >::U: Clone, +... | +LL | | } + | |_^ implementation of `X` is not general enough + | + = note: `Self` must implement `X<'0>`, for any lifetime `'0`... + = note: ...but it actually implements `X<'a>` + +error: implementation of `X` is not general enough + --> $DIR/hr-associated-type-bound-1.rs:1:1 + | +LL | / trait X<'a> +LL | | where +LL | | for<'b> >::U: Clone, +... | +LL | | } + | |_^ implementation of `X` is not general enough + | + = note: `Self` must implement `X<'0>`, for any lifetime `'0`... + = note: ...but it actually implements `X<'a>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error[E0277]: the trait bound `str: Clone` is not satisfied --> $DIR/hr-associated-type-bound-1.rs:12:14 | @@ -14,6 +52,80 @@ LL | where LL | for<'b> >::U: Clone, | ^^^^^ required by this bound in `X` +error: implementation of `X` is not general enough + | + = note: `Self` must implement `X<'0>`, for any lifetime `'0`... + = note: ...but it actually implements `X<'a>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `X` is not general enough + | + = note: `Self` must implement `X<'0>`, for any lifetime `'0`... + = note: ...but it actually implements `X<'a>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0478]: lifetime bound not satisfied + --> $DIR/hr-associated-type-bound-1.rs:6:5 + | +LL | fn f(&self, x: &Self::U) { + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: lifetime parameter instantiated with the lifetime `'a` as defined here + --> $DIR/hr-associated-type-bound-1.rs:1:9 + | +LL | trait X<'a> + | ^^ + +error[E0478]: lifetime bound not satisfied + --> $DIR/hr-associated-type-bound-1.rs:6:5 + | +LL | fn f(&self, x: &Self::U) { + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: but lifetime parameter must outlive the lifetime `'a` as defined here + --> $DIR/hr-associated-type-bound-1.rs:1:9 + | +LL | trait X<'a> + | ^^ + +error: implementation of `X` is not general enough + --> $DIR/hr-associated-type-bound-1.rs:6:8 + | +LL | fn f(&self, x: &Self::U) { + | ^ implementation of `X` is not general enough + | + = note: `Self` must implement `X<'0>`, for any lifetime `'0`... + = note: ...but it actually implements `X<'a>` + +error: implementation of `X` is not general enough + --> $DIR/hr-associated-type-bound-1.rs:6:8 + | +LL | fn f(&self, x: &Self::U) { + | ^ implementation of `X` is not general enough + | + = note: `Self` must implement `X<'0>`, for any lifetime `'0`... + = note: ...but it actually implements `X<'a>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `X` is not general enough + --> $DIR/hr-associated-type-bound-1.rs:6:20 + | +LL | fn f(&self, x: &Self::U) { + | ^^^^^^^^ implementation of `X` is not general enough + | + = note: `Self` must implement `X<'0>`, for any lifetime `'0`... + = note: ...but it actually implements `X<'a>` + +error: implementation of `X` is not general enough + --> $DIR/hr-associated-type-bound-1.rs:6:20 + | +LL | fn f(&self, x: &Self::U) { + | ^^^^^^^^ implementation of `X` is not general enough + | + = note: `Self` must implement `X<'0>`, for any lifetime `'0`... + = note: ...but it actually implements `X<'a>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error[E0277]: the trait bound `str: Clone` is not satisfied --> $DIR/hr-associated-type-bound-1.rs:17:10 | @@ -30,6 +142,50 @@ LL | for<'b> >::U: Clone, LL | fn f(&self, x: &Self::U) { | - required by a bound in this associated function -error: aborting due to 2 previous errors +error: lifetime may not live long enough + --> $DIR/hr-associated-type-bound-1.rs:6:5 + | +LL | trait X<'a> + | -- lifetime `'a` defined here +... +LL | fn f(&self, x: &Self::U) { + | ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: higher-ranked subtype error + --> $DIR/hr-associated-type-bound-1.rs:6:5 + | +LL | fn f(&self, x: &Self::U) { + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error: implementation of `X` is not general enough + --> $DIR/hr-associated-type-bound-1.rs:7:9 + | +LL | ::clone(x); + | ^^^^^^^^^^^^^^^^ implementation of `X` is not general enough + | + = note: `Self` must implement `X<'0>`, for any lifetime `'0`... + = note: ...but it actually implements `X<'1>`, for some specific lifetime `'1` + +error: implementation of `X` is not general enough + --> $DIR/hr-associated-type-bound-1.rs:7:9 + | +LL | ::clone(x); + | ^^^^^^^^^^^^^^^^^^^ implementation of `X` is not general enough + | + = note: `Self` must implement `X<'0>`, for any lifetime `'0`... + = note: ...but it actually implements `X<'1>`, for some specific lifetime `'1` + +error: implementation of `X` is not general enough + --> $DIR/hr-associated-type-bound-1.rs:7:9 + | +LL | ::clone(x); + | ^^^^^^^^^^^^^^^^^^^ implementation of `X` is not general enough + | + = note: `Self` must implement `X<'0>`, for any lifetime `'0`... + = note: ...but it actually implements `X<'1>`, for some specific lifetime `'1` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 19 previous errors -For more information about this error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0277, E0478. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/hr-associated-type-bound-2.stderr b/tests/ui/associated-types/hr-associated-type-bound-2.stderr index 2a7d75ef29bef..dde9dead95389 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-2.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-2.stderr @@ -1,3 +1,41 @@ +error: implementation of `X` is not general enough + | + = note: `Self` must implement `X<'0>`, for any lifetime `'0`... + = note: ...but it actually implements `X<'a>` + +error: implementation of `X` is not general enough + | + = note: `Self` must implement `X<'0>`, for any lifetime `'0`... + = note: ...but it actually implements `X<'a>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `X` is not general enough + --> $DIR/hr-associated-type-bound-2.rs:1:1 + | +LL | / trait X<'a> +LL | | where +LL | | for<'b> >::U: Clone, +... | +LL | | } + | |_^ implementation of `X` is not general enough + | + = note: `Self` must implement `X<'0>`, for any lifetime `'0`... + = note: ...but it actually implements `X<'a>` + +error: implementation of `X` is not general enough + --> $DIR/hr-associated-type-bound-2.rs:1:1 + | +LL | / trait X<'a> +LL | | where +LL | | for<'b> >::U: Clone, +... | +LL | | } + | |_^ implementation of `X` is not general enough + | + = note: `Self` must implement `X<'0>`, for any lifetime `'0`... + = note: ...but it actually implements `X<'a>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error[E0275]: overflow evaluating the requirement `for<'b> u32: X<'b>` --> $DIR/hr-associated-type-bound-2.rs:11:1 | @@ -18,6 +56,6 @@ LL | for<'b> >::U: Clone, = note: 128 redundant requirements hidden = note: required for `u32` to implement `for<'b> X<'b>` -error: aborting due to 1 previous error +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/associated-types/hr-associated-type-bound-object.stderr b/tests/ui/associated-types/hr-associated-type-bound-object.stderr index 5144cfe6d3e7d..ab2f93cf1279d 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-object.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-object.stderr @@ -1,3 +1,41 @@ +error: implementation of `X` is not general enough + | + = note: `Self` must implement `X<'0>`, for any lifetime `'0`... + = note: ...but it actually implements `X<'a>` + +error: implementation of `X` is not general enough + | + = note: `Self` must implement `X<'0>`, for any lifetime `'0`... + = note: ...but it actually implements `X<'a>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `X` is not general enough + --> $DIR/hr-associated-type-bound-object.rs:1:1 + | +LL | / trait X<'a> +LL | | where +LL | | for<'b> >::U: Clone, +... | +LL | | } + | |_^ implementation of `X` is not general enough + | + = note: `Self` must implement `X<'0>`, for any lifetime `'0`... + = note: ...but it actually implements `X<'a>` + +error: implementation of `X` is not general enough + --> $DIR/hr-associated-type-bound-object.rs:1:1 + | +LL | / trait X<'a> +LL | | where +LL | | for<'b> >::U: Clone, +... | +LL | | } + | |_^ implementation of `X` is not general enough + | + = note: `Self` must implement `X<'0>`, for any lifetime `'0`... + = note: ...but it actually implements `X<'a>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error[E0277]: the trait bound `for<'b> >::U: Clone` is not satisfied --> $DIR/hr-associated-type-bound-object.rs:7:13 | @@ -85,6 +123,6 @@ help: consider further restricting the associated type LL | fn f<'a, T: X<'a> + ?Sized>(x: &>::U) where for<'b> >::U: Clone { | ++++++++++++++++++++++++++++++++++++ -error: aborting due to 5 previous errors +error: aborting due to 9 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-1.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-1.stderr index 07d3afb74e416..a0a53b540511c 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-1.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-param-1.stderr @@ -1,3 +1,121 @@ +error: implementation of `Y` is not general enough + | + = note: `Self` must implement `Y<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, T>` + +error: implementation of `Y` is not general enough + | + = note: `Self` must implement `Y<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `Y` is not general enough + | + = note: `T` must implement `Y<'0, Self>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, Self>` + +error: implementation of `Y` is not general enough + | + = note: `T` must implement `Y<'0, Self>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, Self>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `Y` is not general enough + --> $DIR/hr-associated-type-bound-param-1.rs:1:1 + | +LL | / trait Y<'a, T: ?Sized> +LL | | where +LL | | T: Y<'a, Self>, +LL | | for<'b> >::V: Clone, +... | +LL | | } + | |_^ implementation of `Y` is not general enough + | + = note: `Self` must implement `Y<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, T>` + +error: implementation of `Y` is not general enough + --> $DIR/hr-associated-type-bound-param-1.rs:1:1 + | +LL | / trait Y<'a, T: ?Sized> +LL | | where +LL | | T: Y<'a, Self>, +LL | | for<'b> >::V: Clone, +... | +LL | | } + | |_^ implementation of `Y` is not general enough + | + = note: `Self` must implement `Y<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `Y` is not general enough + --> $DIR/hr-associated-type-bound-param-1.rs:1:1 + | +LL | / trait Y<'a, T: ?Sized> +LL | | where +LL | | T: Y<'a, Self>, +LL | | for<'b> >::V: Clone, +... | +LL | | } + | |_^ implementation of `Y` is not general enough + | + = note: `T` must implement `Y<'0, Self>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, Self>` + +error: implementation of `Y` is not general enough + --> $DIR/hr-associated-type-bound-param-1.rs:1:1 + | +LL | / trait Y<'a, T: ?Sized> +LL | | where +LL | | T: Y<'a, Self>, +LL | | for<'b> >::V: Clone, +... | +LL | | } + | |_^ implementation of `Y` is not general enough + | + = note: `T` must implement `Y<'0, Self>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, Self>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `Y` is not general enough + --> $DIR/hr-associated-type-bound-param-1.rs:3:8 + | +LL | T: Y<'a, Self>, + | ^^^^^^^^^^^ implementation of `Y` is not general enough + | + = note: `T` must implement `Y<'0, Self>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, Self>` + +error: implementation of `Y` is not general enough + --> $DIR/hr-associated-type-bound-param-1.rs:3:8 + | +LL | T: Y<'a, Self>, + | ^^^^^^^^^^^ implementation of `Y` is not general enough + | + = note: `T` must implement `Y<'0, Self>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, Self>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `Y` is not general enough + --> $DIR/hr-associated-type-bound-param-1.rs:3:8 + | +LL | T: Y<'a, Self>, + | ^^^^^^^^^^^ implementation of `Y` is not general enough + | + = note: `Self` must implement `Y<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, T>` + +error: implementation of `Y` is not general enough + --> $DIR/hr-associated-type-bound-param-1.rs:3:8 + | +LL | T: Y<'a, Self>, + | ^^^^^^^^^^^ implementation of `Y` is not general enough + | + = note: `Self` must implement `Y<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error[E0277]: the trait bound `str: Clone` is not satisfied --> $DIR/hr-associated-type-bound-param-1.rs:14:14 | @@ -14,6 +132,196 @@ LL | trait Y<'a, T: ?Sized> LL | for<'b> >::V: Clone, | ^^^^^ required by this bound in `Y` +error: implementation of `Y` is not general enough + | + = note: `Self` must implement `Y<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `Y` is not general enough + | + = note: `Self` must implement `Y<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `Y` is not general enough + | + = note: `T` must implement `Y<'0, Self>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, Self>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `Y` is not general enough + | + = note: `T` must implement `Y<'0, Self>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, Self>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `Y` is not general enough + --> $DIR/hr-associated-type-bound-param-1.rs:3:8 + | +LL | T: Y<'a, Self>, + | ^^^^^^^^^^^ implementation of `Y` is not general enough + | + = note: `T` must implement `Y<'0, Self>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, Self>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `Y` is not general enough + --> $DIR/hr-associated-type-bound-param-1.rs:3:8 + | +LL | T: Y<'a, Self>, + | ^^^^^^^^^^^ implementation of `Y` is not general enough + | + = note: `T` must implement `Y<'0, Self>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, Self>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `Y` is not general enough + --> $DIR/hr-associated-type-bound-param-1.rs:3:8 + | +LL | T: Y<'a, Self>, + | ^^^^^^^^^^^ implementation of `Y` is not general enough + | + = note: `Self` must implement `Y<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `Y` is not general enough + --> $DIR/hr-associated-type-bound-param-1.rs:3:8 + | +LL | T: Y<'a, Self>, + | ^^^^^^^^^^^ implementation of `Y` is not general enough + | + = note: `Self` must implement `Y<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0478]: lifetime bound not satisfied + --> $DIR/hr-associated-type-bound-param-1.rs:8:5 + | +LL | fn g(&self, x: &Self::V) { + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: lifetime parameter instantiated with the lifetime `'a` as defined here + --> $DIR/hr-associated-type-bound-param-1.rs:1:9 + | +LL | trait Y<'a, T: ?Sized> + | ^^ + +error[E0478]: lifetime bound not satisfied + --> $DIR/hr-associated-type-bound-param-1.rs:8:5 + | +LL | fn g(&self, x: &Self::V) { + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: but lifetime parameter must outlive the lifetime `'a` as defined here + --> $DIR/hr-associated-type-bound-param-1.rs:1:9 + | +LL | trait Y<'a, T: ?Sized> + | ^^ + +error[E0478]: lifetime bound not satisfied + --> $DIR/hr-associated-type-bound-param-1.rs:8:5 + | +LL | fn g(&self, x: &Self::V) { + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: lifetime parameter instantiated with the lifetime `'a` as defined here + --> $DIR/hr-associated-type-bound-param-1.rs:1:9 + | +LL | trait Y<'a, T: ?Sized> + | ^^ + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0478]: lifetime bound not satisfied + --> $DIR/hr-associated-type-bound-param-1.rs:8:5 + | +LL | fn g(&self, x: &Self::V) { + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: but lifetime parameter must outlive the lifetime `'a` as defined here + --> $DIR/hr-associated-type-bound-param-1.rs:1:9 + | +LL | trait Y<'a, T: ?Sized> + | ^^ + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `Y` is not general enough + --> $DIR/hr-associated-type-bound-param-1.rs:8:8 + | +LL | fn g(&self, x: &Self::V) { + | ^ implementation of `Y` is not general enough + | + = note: `Self` must implement `Y<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, T>` + +error: implementation of `Y` is not general enough + --> $DIR/hr-associated-type-bound-param-1.rs:8:8 + | +LL | fn g(&self, x: &Self::V) { + | ^ implementation of `Y` is not general enough + | + = note: `Self` must implement `Y<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `Y` is not general enough + --> $DIR/hr-associated-type-bound-param-1.rs:8:8 + | +LL | fn g(&self, x: &Self::V) { + | ^ implementation of `Y` is not general enough + | + = note: `T` must implement `Y<'0, Self>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, Self>` + +error: implementation of `Y` is not general enough + --> $DIR/hr-associated-type-bound-param-1.rs:8:8 + | +LL | fn g(&self, x: &Self::V) { + | ^ implementation of `Y` is not general enough + | + = note: `T` must implement `Y<'0, Self>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, Self>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `Y` is not general enough + --> $DIR/hr-associated-type-bound-param-1.rs:8:20 + | +LL | fn g(&self, x: &Self::V) { + | ^^^^^^^^ implementation of `Y` is not general enough + | + = note: `Self` must implement `Y<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, T>` + +error: implementation of `Y` is not general enough + --> $DIR/hr-associated-type-bound-param-1.rs:8:20 + | +LL | fn g(&self, x: &Self::V) { + | ^^^^^^^^ implementation of `Y` is not general enough + | + = note: `Self` must implement `Y<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `Y` is not general enough + --> $DIR/hr-associated-type-bound-param-1.rs:8:20 + | +LL | fn g(&self, x: &Self::V) { + | ^^^^^^^^ implementation of `Y` is not general enough + | + = note: `T` must implement `Y<'0, Self>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, Self>` + +error: implementation of `Y` is not general enough + --> $DIR/hr-associated-type-bound-param-1.rs:8:20 + | +LL | fn g(&self, x: &Self::V) { + | ^^^^^^^^ implementation of `Y` is not general enough + | + = note: `T` must implement `Y<'0, Self>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'a, Self>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error[E0277]: the trait bound `str: Clone` is not satisfied --> $DIR/hr-associated-type-bound-param-1.rs:19:9 | @@ -30,6 +338,86 @@ LL | for<'b> >::V: Clone, LL | fn g(&self, x: &Self::V) { | - required by a bound in this associated function -error: aborting due to 2 previous errors +error: lifetime may not live long enough + --> $DIR/hr-associated-type-bound-param-1.rs:8:5 + | +LL | trait Y<'a, T: ?Sized> + | -- lifetime `'a` defined here +... +LL | fn g(&self, x: &Self::V) { + | ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: higher-ranked subtype error + --> $DIR/hr-associated-type-bound-param-1.rs:8:5 + | +LL | fn g(&self, x: &Self::V) { + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error: higher-ranked subtype error + --> $DIR/hr-associated-type-bound-param-1.rs:8:5 + | +LL | fn g(&self, x: &Self::V) { + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `Y` is not general enough + --> $DIR/hr-associated-type-bound-param-1.rs:9:9 + | +LL | ::clone(x); + | ^^^^^^^^^^^^^^^^ implementation of `Y` is not general enough + | + = note: `Self` must implement `Y<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'1, T>`, for some specific lifetime `'1` + +error: implementation of `Y` is not general enough + --> $DIR/hr-associated-type-bound-param-1.rs:9:9 + | +LL | ::clone(x); + | ^^^^^^^^^^^^^^^^ implementation of `Y` is not general enough + | + = note: `T` must implement `Y<'0, Self>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'1, Self>`, for some specific lifetime `'1` + +error: implementation of `Y` is not general enough + --> $DIR/hr-associated-type-bound-param-1.rs:9:9 + | +LL | ::clone(x); + | ^^^^^^^^^^^^^^^^^^^ implementation of `Y` is not general enough + | + = note: `Self` must implement `Y<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'1, T>`, for some specific lifetime `'1` + +error: implementation of `Y` is not general enough + --> $DIR/hr-associated-type-bound-param-1.rs:9:9 + | +LL | ::clone(x); + | ^^^^^^^^^^^^^^^^^^^ implementation of `Y` is not general enough + | + = note: `T` must implement `Y<'0, Self>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'1, Self>`, for some specific lifetime `'1` + +error: implementation of `Y` is not general enough + --> $DIR/hr-associated-type-bound-param-1.rs:9:9 + | +LL | ::clone(x); + | ^^^^^^^^^^^^^^^^^^^ implementation of `Y` is not general enough + | + = note: `Self` must implement `Y<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'1, T>`, for some specific lifetime `'1` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `Y` is not general enough + --> $DIR/hr-associated-type-bound-param-1.rs:9:9 + | +LL | ::clone(x); + | ^^^^^^^^^^^^^^^^^^^ implementation of `Y` is not general enough + | + = note: `T` must implement `Y<'0, Self>`, for any lifetime `'0`... + = note: ...but it actually implements `Y<'1, Self>`, for some specific lifetime `'1` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 43 previous errors -For more information about this error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0277, E0478. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-types/hr-associated-type-projection-1.stderr b/tests/ui/associated-types/hr-associated-type-projection-1.stderr index b871bb51ae313..d3404952c607d 100644 --- a/tests/ui/associated-types/hr-associated-type-projection-1.stderr +++ b/tests/ui/associated-types/hr-associated-type-projection-1.stderr @@ -1,3 +1,92 @@ +error: implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + +error: implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + | + = note: ...`Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + +error: implementation of `UnsafeCopy` is not general enough + | + = note: ...`Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:1:1 + | +LL | / trait UnsafeCopy<'a, T: Copy> +LL | | where +LL | | for<'b> >::Item: std::ops::Deref, +... | +LL | | } + | |_^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:1:1 + | +LL | / trait UnsafeCopy<'a, T: Copy> +LL | | where +LL | | for<'b> >::Item: std::ops::Deref, +... | +LL | | } + | |_^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:1:1 + | +LL | / trait UnsafeCopy<'a, T: Copy> +LL | | where +LL | | for<'b> >::Item: std::ops::Deref, +... | +LL | | } + | |_^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:1:1 + | +LL | / trait UnsafeCopy<'a, T: Copy> +LL | | where +LL | | for<'b> >::Item: std::ops::Deref, +... | +LL | | } + | |_^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error[E0271]: type mismatch resolving `::Target == T` --> $DIR/hr-associated-type-projection-1.rs:14:17 | @@ -21,6 +110,240 @@ help: consider further restricting this bound LL | impl> UnsafeCopy<'_, T> for T { | ++++++++++++ +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:5:5 + | +LL | type Item; + | ^^^^^^^^^^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:5:5 + | +LL | type Item; + | ^^^^^^^^^^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:5:5 + | +LL | type Item; + | ^^^^^^^^^^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:5:5 + | +LL | type Item; + | ^^^^^^^^^^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:5:5 + | +LL | trait UnsafeCopy<'a, T: Copy> + | ----------------------------- due to a where-clause on `UnsafeCopy`... +LL | where +LL | for<'b> >::Item: std::ops::Deref, + | ---------- doesn't satisfy where-clause +LL | { +LL | type Item; + | ^^^^^^^^^^ + | + = note: ...`Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:5:5 + | +LL | trait UnsafeCopy<'a, T: Copy> + | ----------------------------- due to a where-clause on `UnsafeCopy`... +LL | where +LL | for<'b> >::Item: std::ops::Deref, + | ---------- doesn't satisfy where-clause +LL | { +LL | type Item; + | ^^^^^^^^^^ + | + = note: ...`Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + | + = note: ...`Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + | + = note: ...`Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0478]: lifetime bound not satisfied + --> $DIR/hr-associated-type-projection-1.rs:7:5 + | +LL | fn bug(item: &Self::Item) -> () { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: lifetime parameter instantiated with the lifetime `'a` as defined here + --> $DIR/hr-associated-type-projection-1.rs:1:18 + | +LL | trait UnsafeCopy<'a, T: Copy> + | ^^ + +error[E0478]: lifetime bound not satisfied + --> $DIR/hr-associated-type-projection-1.rs:7:5 + | +LL | fn bug(item: &Self::Item) -> () { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: but lifetime parameter must outlive the lifetime `'a` as defined here + --> $DIR/hr-associated-type-projection-1.rs:1:18 + | +LL | trait UnsafeCopy<'a, T: Copy> + | ^^ + +error[E0478]: lifetime bound not satisfied + --> $DIR/hr-associated-type-projection-1.rs:7:5 + | +LL | fn bug(item: &Self::Item) -> () { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: lifetime parameter instantiated with the lifetime `'a` as defined here + --> $DIR/hr-associated-type-projection-1.rs:1:18 + | +LL | trait UnsafeCopy<'a, T: Copy> + | ^^ + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0478]: lifetime bound not satisfied + --> $DIR/hr-associated-type-projection-1.rs:7:5 + | +LL | fn bug(item: &Self::Item) -> () { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: but lifetime parameter must outlive the lifetime `'a` as defined here + --> $DIR/hr-associated-type-projection-1.rs:1:18 + | +LL | trait UnsafeCopy<'a, T: Copy> + | ^^ + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:7:8 + | +LL | fn bug(item: &Self::Item) -> () { + | ^^^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:7:8 + | +LL | fn bug(item: &Self::Item) -> () { + | ^^^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:7:8 + | +LL | fn bug(item: &Self::Item) -> () { + | ^^^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:7:8 + | +LL | fn bug(item: &Self::Item) -> () { + | ^^^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:7:18 + | +LL | fn bug(item: &Self::Item) -> () { + | ^^^^^^^^^^^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:7:18 + | +LL | fn bug(item: &Self::Item) -> () { + | ^^^^^^^^^^^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:7:18 + | +LL | fn bug(item: &Self::Item) -> () { + | ^^^^^^^^^^^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:7:18 + | +LL | fn bug(item: &Self::Item) -> () { + | ^^^^^^^^^^^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'a, T>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error[E0271]: type mismatch resolving `<&str as Deref>::Target == &str` --> $DIR/hr-associated-type-projection-1.rs:19:6 | @@ -36,6 +359,148 @@ LL | for<'b> >::Item: std::ops::Deref, LL | fn bug(item: &Self::Item) -> () { | --- required by a bound in this associated function -error: aborting due to 2 previous errors +error: lifetime may not live long enough + --> $DIR/hr-associated-type-projection-1.rs:7:5 + | +LL | trait UnsafeCopy<'a, T: Copy> + | -- lifetime `'a` defined here +... +LL | fn bug(item: &Self::Item) -> () { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: higher-ranked subtype error + --> $DIR/hr-associated-type-projection-1.rs:7:5 + | +LL | fn bug(item: &Self::Item) -> () { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: higher-ranked subtype error + --> $DIR/hr-associated-type-projection-1.rs:7:5 + | +LL | fn bug(item: &Self::Item) -> () { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:8:20 + | +LL | let x: T = **item; + | ^^^^^^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'1, T>`, for some specific lifetime `'1` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:8:20 + | +LL | let x: T = **item; + | ^^^^^^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'1, T>`, for some specific lifetime `'1` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:8:20 + | +LL | let x: T = **item; + | ^^^^^^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'b, T>` + = note: ...but it actually implements `UnsafeCopy<'0, T>`, for some specific lifetime `'0` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:8:20 + | +LL | let x: T = **item; + | ^^^^^^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'1, T>`, for some specific lifetime `'1` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:8:20 + | +LL | let x: T = **item; + | ^^^^^^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'1, T>`, for some specific lifetime `'1` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:8:20 + | +LL | let x: T = **item; + | ^^^^^^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'b, T>` + = note: ...but it actually implements `UnsafeCopy<'0, T>`, for some specific lifetime `'0` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:8:20 + | +LL | let x: T = **item; + | ^^^^^^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'1, T>`, for some specific lifetime `'1` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:8:20 + | +LL | let x: T = **item; + | ^^^^^^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'1, T>`, for some specific lifetime `'1` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:8:20 + | +LL | let x: T = **item; + | ^^^^^^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'b, T>` + = note: ...but it actually implements `UnsafeCopy<'0, T>`, for some specific lifetime `'0` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:8:20 + | +LL | let x: T = **item; + | ^^^^^^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'1, T>`, for some specific lifetime `'1` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:8:20 + | +LL | let x: T = **item; + | ^^^^^^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'0, T>`, for any lifetime `'0`... + = note: ...but it actually implements `UnsafeCopy<'1, T>`, for some specific lifetime `'1` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: implementation of `UnsafeCopy` is not general enough + --> $DIR/hr-associated-type-projection-1.rs:8:20 + | +LL | let x: T = **item; + | ^^^^^^ implementation of `UnsafeCopy` is not general enough + | + = note: `Self` must implement `UnsafeCopy<'b, T>` + = note: ...but it actually implements `UnsafeCopy<'0, T>`, for some specific lifetime `'0` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 51 previous errors -For more information about this error, try `rustc --explain E0271`. +Some errors have detailed explanations: E0271, E0478. +For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.stderr b/tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.stderr index 4302570cdbdef..4f7b7293efd02 100644 --- a/tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.stderr +++ b/tests/ui/higher-ranked/trait-bounds/issue-62203-hrtb-ice.stderr @@ -1,3 +1,22 @@ +error: implementation of `Ty` is not general enough + --> $DIR/issue-62203-hrtb-ice.rs:25:8 + | +LL | fn m<'a, B: Ty<'a>, F>(&self, f: F) -> Unit1 + | ^ implementation of `Ty` is not general enough + | + = note: `B` must implement `Ty<'0>`, for any lifetime `'0`... + = note: ...but it actually implements `Ty<'a>` + +error: implementation of `Ty` is not general enough + --> $DIR/issue-62203-hrtb-ice.rs:25:8 + | +LL | fn m<'a, B: Ty<'a>, F>(&self, f: F) -> Unit1 + | ^ implementation of `Ty` is not general enough + | + = note: `B` must implement `Ty<'0>`, for any lifetime `'0`... + = note: ...but it actually implements `Ty<'a>` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + error[E0271]: type mismatch resolving ` as T0<'r, (&u8,)>>::O == <_ as Ty<'r>>::V` --> $DIR/issue-62203-hrtb-ice.rs:39:9 | @@ -58,6 +77,6 @@ LL | where LL | F: for<'r> T0<'r, (>::V,), O = >::V>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m` -error: aborting due to 2 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr b/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr index 4b779103a6dd8..756a3d0e1488b 100644 --- a/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr @@ -164,7 +164,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); ] = note: late-bound region is '?3 = note: number of external vids: 4 - = note: where >::AssocType: '?2 + = note: where '?1: '?2 note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:83:1 @@ -204,7 +204,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); (), ] = note: number of external vids: 4 - = note: where >::AssocType: '?3 + = note: where '?2: '?3 note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:92:1 @@ -229,7 +229,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); (), ] = note: number of external vids: 3 - = note: where >::AssocType: '?2 + = note: where '?1: '?2 note: no external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:101:1 diff --git a/tests/ui/specialization/fuzzed/fuzzing-ice-134905.stderr b/tests/ui/specialization/fuzzed/fuzzing-ice-134905.stderr index 611fef1df66bf..93270562ce757 100644 --- a/tests/ui/specialization/fuzzed/fuzzing-ice-134905.stderr +++ b/tests/ui/specialization/fuzzed/fuzzing-ice-134905.stderr @@ -25,6 +25,25 @@ note: required by a bound in `Iterate::Ty` LL | type Ty: Valid; | ^^^^^ required by this bound in `Iterate::Ty` +error[E0277]: the trait bound `T: Iterate<'a>` is not satisfied + --> $DIR/fuzzing-ice-134905.rs:17:1 + | +LL | impl<'a, T> Eq for T where >::Ty: Valid {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Check` is not implemented for `T` + | +note: required for `T` to implement `Iterate<'a>` + --> $DIR/fuzzing-ice-134905.rs:8:13 + | +LL | impl<'a, T> Iterate<'a> for T + | ^^^^^^^^^^^ ^ +LL | where +LL | T: Check, + | ----- unsatisfied trait bound introduced here +help: consider further restricting type parameter `T` with trait `Check` + | +LL | impl<'a, T> Eq for T where >::Ty: Valid, T: Check {} + | ++++++++++ + error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) --> $DIR/fuzzing-ice-134905.rs:17:10 | @@ -34,7 +53,7 @@ LL | impl<'a, T> Eq for T where >::Ty: Valid {} = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local = note: only traits defined in the current crate can be implemented for a type parameter -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 3 previous errors; 1 warning emitted Some errors have detailed explanations: E0210, E0277. For more information about an error, try `rustc --explain E0210`. diff --git a/tests/ui/specialization/issue-38091.stderr b/tests/ui/specialization/issue-38091.stderr index eb64383e18bbd..16287ff7bc373 100644 --- a/tests/ui/specialization/issue-38091.stderr +++ b/tests/ui/specialization/issue-38091.stderr @@ -25,6 +25,27 @@ note: required by a bound in `Iterate::Ty` LL | type Ty: Valid; | ^^^^^ required by this bound in `Iterate::Ty` -error: aborting due to 1 previous error; 1 warning emitted +error[E0275]: overflow evaluating the requirement `T: Iterate<'_>` + --> $DIR/issue-38091.rs:18:1 + | +LL | impl<'a, T> Check for T where >::Ty: Valid {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: required for `T` to implement `Check` + --> $DIR/issue-38091.rs:18:13 + | +LL | impl<'a, T> Check for T where >::Ty: Valid {} + | ^^^^^ ^ ----- unsatisfied trait bound introduced here +note: required for `T` to implement `Iterate<'a>` + --> $DIR/issue-38091.rs:8:13 + | +LL | impl<'a, T> Iterate<'a> for T + | ^^^^^^^^^^^ ^ +LL | where +LL | T: Check, + | ----- unsatisfied trait bound introduced here + +error: aborting due to 2 previous errors; 1 warning emitted -For more information about this error, try `rustc --explain E0277`. +Some errors have detailed explanations: E0275, E0277. +For more information about an error, try `rustc --explain E0275`.