diff --git a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs index 708a53f6c650..b537419c715b 100644 --- a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs +++ b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs @@ -144,8 +144,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { obligation: &PolyTraitObligation<'tcx>, idx: usize, ) -> Result, SelectionError<'tcx>> { - let tcx = self.tcx(); - let placeholder_trait_predicate = self.infcx.enter_forall_and_leak_universe(obligation.predicate).trait_ref; let placeholder_self_ty = self.infcx.shallow_resolve(placeholder_trait_predicate.self_ty()); @@ -194,28 +192,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { .map_err(|_| SelectionError::Unimplemented)?, ); - // FIXME(compiler-errors): I don't think this is needed. - if let ty::Alias(ty::Projection, alias_ty) = placeholder_self_ty.kind() { - let predicates = tcx.predicates_of(alias_ty.def_id).instantiate_own(tcx, alias_ty.args); - for (predicate, _) in predicates { - let normalized = normalize_with_depth_to( - self, - obligation.param_env, - obligation.cause.clone(), - obligation.recursion_depth + 1, - predicate, - &mut obligations, - ); - obligations.push(Obligation::with_depth( - self.tcx(), - obligation.cause.clone(), - obligation.recursion_depth + 1, - obligation.param_env, - normalized, - )); - } - } - Ok(obligations) } diff --git a/tests/ui/async-await/higher-ranked-auto-trait-14.no_assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-14.no_assumptions.stderr deleted file mode 100644 index b47db2b19ffe..000000000000 --- a/tests/ui/async-await/higher-ranked-auto-trait-14.no_assumptions.stderr +++ /dev/null @@ -1,33 +0,0 @@ -error: implementation of `FnOnce` is not general enough - --> $DIR/higher-ranked-auto-trait-14.rs:20:5 - | -LL | / async move { -LL | | let xs = unique_x.union(&cached) -LL | | // .copied() // works -LL | | .map(|x| *x) // error -LL | | ; -LL | | let blah = val.blah(xs.into_iter()).await; -LL | | } - | |_____^ implementation of `FnOnce` is not general enough - | - = note: closure with signature `fn(&'0 u32) -> u32` must implement `FnOnce<(&'1 u32,)>`, for any two lifetimes `'0` and `'1`... - = note: ...but it actually implements `FnOnce<(&u32,)>` - -error: implementation of `FnOnce` is not general enough - --> $DIR/higher-ranked-auto-trait-14.rs:20:5 - | -LL | / async move { -LL | | let xs = unique_x.union(&cached) -LL | | // .copied() // works -LL | | .map(|x| *x) // error -LL | | ; -LL | | let blah = val.blah(xs.into_iter()).await; -LL | | } - | |_____^ implementation of `FnOnce` is not general enough - | - = note: closure with signature `fn(&'0 u32) -> u32` must implement `FnOnce<(&'1 u32,)>`, for any two lifetimes `'0` and `'1`... - = note: ...but it actually implements `FnOnce<(&u32,)>` - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: aborting due to 2 previous errors - diff --git a/tests/ui/async-await/higher-ranked-auto-trait-14.rs b/tests/ui/async-await/higher-ranked-auto-trait-14.rs index 5ed12cd6e38c..ed53d6306c60 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-14.rs +++ b/tests/ui/async-await/higher-ranked-auto-trait-14.rs @@ -1,9 +1,8 @@ // Repro for . +//@ check-pass //@ edition: 2021 //@ revisions: assumptions no_assumptions //@[assumptions] compile-flags: -Zhigher-ranked-assumptions -//@[assumptions] check-pass -//@[no_assumptions] known-bug: #110338 use std::collections::HashSet; use std::future::Future; diff --git a/tests/ui/async-await/higher-ranked-auto-trait-2.no_assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-2.no_assumptions.stderr deleted file mode 100644 index 2fc44412b9da..000000000000 --- a/tests/ui/async-await/higher-ranked-auto-trait-2.no_assumptions.stderr +++ /dev/null @@ -1,49 +0,0 @@ -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-2.rs:16:9 - | -LL | / async move { -LL | | // asks for an unspecified lifetime to outlive itself? weird diagnostics -LL | | self.run(t).await; -LL | | } - | |_________^ - | - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-2.rs:16:9 - | -LL | / async move { -LL | | // asks for an unspecified lifetime to outlive itself? weird diagnostics -LL | | self.run(t).await; -LL | | } - | |_________^ - | - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-2.rs:16:9 - | -LL | / async move { -LL | | // asks for an unspecified lifetime to outlive itself? weird diagnostics -LL | | self.run(t).await; -LL | | } - | |_________^ - | - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-2.rs:16:9 - | -LL | / async move { -LL | | // asks for an unspecified lifetime to outlive itself? weird diagnostics -LL | | self.run(t).await; -LL | | } - | |_________^ - | - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: aborting due to 4 previous errors - diff --git a/tests/ui/async-await/higher-ranked-auto-trait-2.rs b/tests/ui/async-await/higher-ranked-auto-trait-2.rs index 6c75597265bc..b09b4983de29 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-2.rs +++ b/tests/ui/async-await/higher-ranked-auto-trait-2.rs @@ -1,9 +1,8 @@ // Repro for . +//@ check-pass //@ edition: 2021 //@ revisions: assumptions no_assumptions //@[assumptions] compile-flags: -Zhigher-ranked-assumptions -//@[assumptions] check-pass -//@[no_assumptions] known-bug: #110338 use std::future::Future; diff --git a/tests/ui/async-await/higher-ranked-auto-trait-3.assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-3.assumptions.stderr deleted file mode 100644 index be978f19d7ee..000000000000 --- a/tests/ui/async-await/higher-ranked-auto-trait-3.assumptions.stderr +++ /dev/null @@ -1,292 +0,0 @@ -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:54:5 - | -LL | / fn call_1<'s, 'cx>(&'s self, cx: &'cx ()) -> Self::Future1<'cx> -LL | | where -LL | | 's: 'cx, - | |________________^ - | -note: the lifetime `'cx` defined here... - --> $DIR/higher-ranked-auto-trait-3.rs:43:13 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^^ -note: ...must outlive the lifetime `'s` defined here - --> $DIR/higher-ranked-auto-trait-3.rs:43:9 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^ - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:54:5 - | -LL | / fn call_1<'s, 'cx>(&'s self, cx: &'cx ()) -> Self::Future1<'cx> -LL | | where -LL | | 's: 'cx, - | |________________^ - | -note: the lifetime `'cx` defined here... - --> $DIR/higher-ranked-auto-trait-3.rs:43:13 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^^ -note: ...must outlive the lifetime `'s` defined here - --> $DIR/higher-ranked-auto-trait-3.rs:43:9 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^ - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:63:5 - | -LL | / fn call_2<'s, 'cx>(&'s self, cx: &'cx ()) -> Self::Future2<'cx> -LL | | where -LL | | 's: 'cx, - | |________________^ - | -note: the lifetime `'cx` defined here... - --> $DIR/higher-ranked-auto-trait-3.rs:43:13 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^^ -note: ...must outlive the lifetime `'s` defined here - --> $DIR/higher-ranked-auto-trait-3.rs:43:9 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^ - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:63:5 - | -LL | / fn call_2<'s, 'cx>(&'s self, cx: &'cx ()) -> Self::Future2<'cx> -LL | | where -LL | | 's: 'cx, - | |________________^ - | -note: the lifetime `'cx` defined here... - --> $DIR/higher-ranked-auto-trait-3.rs:43:13 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^^ -note: ...must outlive the lifetime `'s` defined here - --> $DIR/higher-ranked-auto-trait-3.rs:43:9 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^ - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:40:31 - | -LL | impl IterCaller for UseIter - | ^^^^^^^^^^^^^^^^^ - | -note: the lifetime `'cx` defined here... - --> $DIR/higher-ranked-auto-trait-3.rs:43:13 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^^ -note: ...must outlive the lifetime `'s` defined here - --> $DIR/higher-ranked-auto-trait-3.rs:43:9 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^ - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:46:5 - | -LL | type Future1<'cx> = impl Future + Send + 'cx - | ^^^^^^^^^^^^^^^^^ - | -note: the lifetime `'cx` defined here... - --> $DIR/higher-ranked-auto-trait-3.rs:43:13 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^^ -note: ...must outlive the lifetime `'s` defined here - --> $DIR/higher-ranked-auto-trait-3.rs:43:9 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^ - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:50:5 - | -LL | type Future2<'cx> = impl Future + Send + 'cx - | ^^^^^^^^^^^^^^^^^ - | -note: the lifetime `'cx` defined here... - --> $DIR/higher-ranked-auto-trait-3.rs:43:13 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^^ -note: ...must outlive the lifetime `'s` defined here - --> $DIR/higher-ranked-auto-trait-3.rs:43:9 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^ - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:54:50 - | -LL | fn call_1<'s, 'cx>(&'s self, cx: &'cx ()) -> Self::Future1<'cx> - | ^^^^^^^^^^^^^^^^^^ - | -note: the lifetime `'cx` defined here... - --> $DIR/higher-ranked-auto-trait-3.rs:43:13 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^^ -note: ...must outlive the lifetime `'s` defined here - --> $DIR/higher-ranked-auto-trait-3.rs:43:9 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^ - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:63:50 - | -LL | fn call_2<'s, 'cx>(&'s self, cx: &'cx ()) -> Self::Future2<'cx> - | ^^^^^^^^^^^^^^^^^^ - | -note: the lifetime `'cx` defined here... - --> $DIR/higher-ranked-auto-trait-3.rs:43:13 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^^ -note: ...must outlive the lifetime `'s` defined here - --> $DIR/higher-ranked-auto-trait-3.rs:43:9 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^ - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - -error: higher-ranked subtype error - --> $DIR/higher-ranked-auto-trait-3.rs:54:5 - | -LL | / fn call_1<'s, 'cx>(&'s self, cx: &'cx ()) -> Self::Future1<'cx> -LL | | where -LL | | 's: 'cx, - | |________________^ - -error: higher-ranked subtype error - --> $DIR/higher-ranked-auto-trait-3.rs:54:5 - | -LL | / fn call_1<'s, 'cx>(&'s self, cx: &'cx ()) -> Self::Future1<'cx> -LL | | where -LL | | 's: 'cx, - | |________________^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:58:9 - | -LL | / async { -LL | | self.fi_1.get_iter(cx).await; -LL | | } - | |_________^ - | -note: the lifetime `'cx` defined here... - --> $DIR/higher-ranked-auto-trait-3.rs:43:13 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^^ -note: ...must outlive the lifetime `'s` defined here - --> $DIR/higher-ranked-auto-trait-3.rs:43:9 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^ - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:58:9 - | -LL | / async { -LL | | self.fi_1.get_iter(cx).await; -LL | | } - | |_________^ - | -note: the lifetime `'cx` defined here... - --> $DIR/higher-ranked-auto-trait-3.rs:43:13 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^^ -note: ...must outlive the lifetime `'s` defined here - --> $DIR/higher-ranked-auto-trait-3.rs:43:9 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^ - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: higher-ranked subtype error - --> $DIR/higher-ranked-auto-trait-3.rs:63:5 - | -LL | / fn call_2<'s, 'cx>(&'s self, cx: &'cx ()) -> Self::Future2<'cx> -LL | | where -LL | | 's: 'cx, - | |________________^ - -error: higher-ranked subtype error - --> $DIR/higher-ranked-auto-trait-3.rs:63:5 - | -LL | / fn call_2<'s, 'cx>(&'s self, cx: &'cx ()) -> Self::Future2<'cx> -LL | | where -LL | | 's: 'cx, - | |________________^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:67:9 - | -LL | / async { -LL | | self.fi_2.get_iter(cx).await; -LL | | } - | |_________^ - | -note: the lifetime `'cx` defined here... - --> $DIR/higher-ranked-auto-trait-3.rs:43:13 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^^ -note: ...must outlive the lifetime `'s` defined here - --> $DIR/higher-ranked-auto-trait-3.rs:43:9 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^ - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:67:9 - | -LL | / async { -LL | | self.fi_2.get_iter(cx).await; -LL | | } - | |_________^ - | -note: the lifetime `'cx` defined here... - --> $DIR/higher-ranked-auto-trait-3.rs:43:13 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^^ -note: ...must outlive the lifetime `'s` defined here - --> $DIR/higher-ranked-auto-trait-3.rs:43:9 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^ - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: aborting due to 17 previous errors - diff --git a/tests/ui/async-await/higher-ranked-auto-trait-3.no_assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-3.no_assumptions.stderr deleted file mode 100644 index 1c5aa3af7d1e..000000000000 --- a/tests/ui/async-await/higher-ranked-auto-trait-3.no_assumptions.stderr +++ /dev/null @@ -1,312 +0,0 @@ -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:54:5 - | -LL | / fn call_1<'s, 'cx>(&'s self, cx: &'cx ()) -> Self::Future1<'cx> -LL | | where -LL | | 's: 'cx, - | |________________^ - | -note: the lifetime `'cx` defined here... - --> $DIR/higher-ranked-auto-trait-3.rs:43:13 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^^ -note: ...must outlive the lifetime `'s` defined here - --> $DIR/higher-ranked-auto-trait-3.rs:43:9 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^ - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:54:5 - | -LL | / fn call_1<'s, 'cx>(&'s self, cx: &'cx ()) -> Self::Future1<'cx> -LL | | where -LL | | 's: 'cx, - | |________________^ - | -note: the lifetime `'cx` defined here... - --> $DIR/higher-ranked-auto-trait-3.rs:43:13 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^^ -note: ...must outlive the lifetime `'s` defined here - --> $DIR/higher-ranked-auto-trait-3.rs:43:9 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^ - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:63:5 - | -LL | / fn call_2<'s, 'cx>(&'s self, cx: &'cx ()) -> Self::Future2<'cx> -LL | | where -LL | | 's: 'cx, - | |________________^ - | -note: the lifetime `'cx` defined here... - --> $DIR/higher-ranked-auto-trait-3.rs:43:13 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^^ -note: ...must outlive the lifetime `'s` defined here - --> $DIR/higher-ranked-auto-trait-3.rs:43:9 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^ - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:63:5 - | -LL | / fn call_2<'s, 'cx>(&'s self, cx: &'cx ()) -> Self::Future2<'cx> -LL | | where -LL | | 's: 'cx, - | |________________^ - | -note: the lifetime `'cx` defined here... - --> $DIR/higher-ranked-auto-trait-3.rs:43:13 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^^ -note: ...must outlive the lifetime `'s` defined here - --> $DIR/higher-ranked-auto-trait-3.rs:43:9 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^ - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:40:31 - | -LL | impl IterCaller for UseIter - | ^^^^^^^^^^^^^^^^^ - | -note: the lifetime `'cx` defined here... - --> $DIR/higher-ranked-auto-trait-3.rs:43:13 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^^ -note: ...must outlive the lifetime `'s` defined here - --> $DIR/higher-ranked-auto-trait-3.rs:43:9 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^ - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:46:5 - | -LL | type Future1<'cx> = impl Future + Send + 'cx - | ^^^^^^^^^^^^^^^^^ - | -note: the lifetime `'cx` defined here... - --> $DIR/higher-ranked-auto-trait-3.rs:43:13 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^^ -note: ...must outlive the lifetime `'s` defined here - --> $DIR/higher-ranked-auto-trait-3.rs:43:9 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^ - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:50:5 - | -LL | type Future2<'cx> = impl Future + Send + 'cx - | ^^^^^^^^^^^^^^^^^ - | -note: the lifetime `'cx` defined here... - --> $DIR/higher-ranked-auto-trait-3.rs:43:13 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^^ -note: ...must outlive the lifetime `'s` defined here - --> $DIR/higher-ranked-auto-trait-3.rs:43:9 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^ - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:54:50 - | -LL | fn call_1<'s, 'cx>(&'s self, cx: &'cx ()) -> Self::Future1<'cx> - | ^^^^^^^^^^^^^^^^^^ - | -note: the lifetime `'cx` defined here... - --> $DIR/higher-ranked-auto-trait-3.rs:43:13 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^^ -note: ...must outlive the lifetime `'s` defined here - --> $DIR/higher-ranked-auto-trait-3.rs:43:9 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^ - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:63:50 - | -LL | fn call_2<'s, 'cx>(&'s self, cx: &'cx ()) -> Self::Future2<'cx> - | ^^^^^^^^^^^^^^^^^^ - | -note: the lifetime `'cx` defined here... - --> $DIR/higher-ranked-auto-trait-3.rs:43:13 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^^ -note: ...must outlive the lifetime `'s` defined here - --> $DIR/higher-ranked-auto-trait-3.rs:43:9 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^ - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - -error: higher-ranked subtype error - --> $DIR/higher-ranked-auto-trait-3.rs:54:5 - | -LL | / fn call_1<'s, 'cx>(&'s self, cx: &'cx ()) -> Self::Future1<'cx> -LL | | where -LL | | 's: 'cx, - | |________________^ - -error: higher-ranked subtype error - --> $DIR/higher-ranked-auto-trait-3.rs:54:5 - | -LL | / fn call_1<'s, 'cx>(&'s self, cx: &'cx ()) -> Self::Future1<'cx> -LL | | where -LL | | 's: 'cx, - | |________________^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:58:9 - | -LL | / async { -LL | | self.fi_1.get_iter(cx).await; -LL | | } - | |_________^ - | -note: the lifetime `'cx` defined here... - --> $DIR/higher-ranked-auto-trait-3.rs:43:13 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^^ -note: ...must outlive the lifetime `'s` defined here - --> $DIR/higher-ranked-auto-trait-3.rs:43:9 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^ - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:58:9 - | -LL | / async { -LL | | self.fi_1.get_iter(cx).await; -LL | | } - | |_________^ - | -note: the lifetime `'cx` defined here... - --> $DIR/higher-ranked-auto-trait-3.rs:43:13 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^^ -note: ...must outlive the lifetime `'s` defined here - --> $DIR/higher-ranked-auto-trait-3.rs:43:9 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^ - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:58:9 - | -LL | / async { -LL | | self.fi_1.get_iter(cx).await; -LL | | } - | |_________^ - | - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - -error: higher-ranked subtype error - --> $DIR/higher-ranked-auto-trait-3.rs:63:5 - | -LL | / fn call_2<'s, 'cx>(&'s self, cx: &'cx ()) -> Self::Future2<'cx> -LL | | where -LL | | 's: 'cx, - | |________________^ - -error: higher-ranked subtype error - --> $DIR/higher-ranked-auto-trait-3.rs:63:5 - | -LL | / fn call_2<'s, 'cx>(&'s self, cx: &'cx ()) -> Self::Future2<'cx> -LL | | where -LL | | 's: 'cx, - | |________________^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:67:9 - | -LL | / async { -LL | | self.fi_2.get_iter(cx).await; -LL | | } - | |_________^ - | -note: the lifetime `'cx` defined here... - --> $DIR/higher-ranked-auto-trait-3.rs:43:13 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^^ -note: ...must outlive the lifetime `'s` defined here - --> $DIR/higher-ranked-auto-trait-3.rs:43:9 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^ - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:67:9 - | -LL | / async { -LL | | self.fi_2.get_iter(cx).await; -LL | | } - | |_________^ - | -note: the lifetime `'cx` defined here... - --> $DIR/higher-ranked-auto-trait-3.rs:43:13 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^^ -note: ...must outlive the lifetime `'s` defined here - --> $DIR/higher-ranked-auto-trait-3.rs:43:9 - | -LL | for<'s, 'cx> FI1::Future<'s, 'cx>: Send, - | ^^ - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-auto-trait-3.rs:67:9 - | -LL | / async { -LL | | self.fi_2.get_iter(cx).await; -LL | | } - | |_________^ - | - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - -error: aborting due to 19 previous errors - diff --git a/tests/ui/async-await/higher-ranked-auto-trait-3.rs b/tests/ui/async-await/higher-ranked-auto-trait-3.rs index 2ab986a097a6..2b7990d5f3f1 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-3.rs +++ b/tests/ui/async-await/higher-ranked-auto-trait-3.rs @@ -1,10 +1,8 @@ // Repro for . +//@ check-pass //@ edition: 2021 //@ revisions: assumptions no_assumptions //@[assumptions] compile-flags: -Zhigher-ranked-assumptions -//@[assumptions] check-fail -//@[assumptions] known-bug: #110338 -//@[no_assumptions] known-bug: #110338 #![feature(impl_trait_in_assoc_type)] diff --git a/tests/ui/async-await/higher-ranked-auto-trait-7.no_assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-7.no_assumptions.stderr deleted file mode 100644 index dcb8075566e6..000000000000 --- a/tests/ui/async-await/higher-ranked-auto-trait-7.no_assumptions.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: `S` does not live long enough - --> $DIR/higher-ranked-auto-trait-7.rs:26:5 - | -LL | future::<'a, S, _>(async move { - | ^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/async-await/higher-ranked-auto-trait-7.rs b/tests/ui/async-await/higher-ranked-auto-trait-7.rs index abded5a88d3a..558bd6de4429 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-7.rs +++ b/tests/ui/async-await/higher-ranked-auto-trait-7.rs @@ -1,9 +1,8 @@ // Repro for . +//@ check-pass //@ edition: 2021 //@ revisions: assumptions no_assumptions //@[assumptions] compile-flags: -Zhigher-ranked-assumptions -//@[assumptions] check-pass -//@[no_assumptions] known-bug: #110338 #![allow(dropping_copy_types)] diff --git a/tests/ui/dyn-compatibility/assoc_type_bounds_sized_used.rs b/tests/ui/dyn-compatibility/assoc_type_bounds_sized_used.rs index d59fc1712ea7..8243803c86d7 100644 --- a/tests/ui/dyn-compatibility/assoc_type_bounds_sized_used.rs +++ b/tests/ui/dyn-compatibility/assoc_type_bounds_sized_used.rs @@ -9,7 +9,8 @@ trait Bop { fn bop() { let _ = ::Bar::default(); - //~^ ERROR: trait bounds were not satisfied + //~^ ERROR: the size for values of type `T` cannot be known at compilation time + //~| ERROR: the size for values of type `T` cannot be known at compilation time //~| ERROR: the size for values of type `T` cannot be known at compilation time } diff --git a/tests/ui/dyn-compatibility/assoc_type_bounds_sized_used.stderr b/tests/ui/dyn-compatibility/assoc_type_bounds_sized_used.stderr index 7b152adea492..fe048c87775a 100644 --- a/tests/ui/dyn-compatibility/assoc_type_bounds_sized_used.stderr +++ b/tests/ui/dyn-compatibility/assoc_type_bounds_sized_used.stderr @@ -24,21 +24,58 @@ help: consider relaxing the implicit `Sized` restriction LL | type Bar: Default + ?Sized | ++++++++ -error[E0599]: the function or associated item `default` exists for associated type `::Bar`, but its trait bounds were not satisfied - --> $DIR/assoc_type_bounds_sized_used.rs:11:30 +error[E0277]: the size for values of type `T` cannot be known at compilation time + --> $DIR/assoc_type_bounds_sized_used.rs:11:13 | +LL | fn bop() { + | - this type parameter needs to be `Sized` LL | let _ = ::Bar::default(); - | ^^^^^^^ function or associated item cannot be called on `::Bar` due to unsatisfied trait bounds + | ^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | - = note: the following trait bounds were not satisfied: - `T: Sized` - which is required by `::Bar: Default` -help: consider restricting the type parameter to satisfy the trait bound +note: required by a bound in `Bop::Bar` + --> $DIR/assoc_type_bounds_sized_used.rs:7:15 | -LL | fn bop() where T: Sized { - | ++++++++++++++ +LL | type Bar: Default + | --- required by a bound in this associated type +LL | where +LL | Self: Sized; + | ^^^^^ required by this bound in `Bop::Bar` +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - fn bop() { +LL + fn bop() { + | +help: consider relaxing the implicit `Sized` restriction + | +LL | type Bar: Default + ?Sized + | ++++++++ -error: aborting due to 2 previous errors +error[E0277]: the size for values of type `T` cannot be known at compilation time + --> $DIR/assoc_type_bounds_sized_used.rs:11:13 + | +LL | fn bop() { + | - this type parameter needs to be `Sized` +LL | let _ = ::Bar::default(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time + | +note: required by a bound in `Bop::Bar` + --> $DIR/assoc_type_bounds_sized_used.rs:7:15 + | +LL | type Bar: Default + | --- required by a bound in this associated type +LL | where +LL | Self: Sized; + | ^^^^^ required by this bound in `Bop::Bar` +help: consider removing the `?Sized` bound to make the type parameter `Sized` + | +LL - fn bop() { +LL + fn bop() { + | +help: consider relaxing the implicit `Sized` restriction + | +LL | type Bar: Default + ?Sized + | ++++++++ -Some errors have detailed explanations: E0277, E0599. -For more information about an error, try `rustc --explain E0277`. +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/generic-associated-types/higher-ranked-coroutine-param-outlives-2.no_assumptions.stderr b/tests/ui/generic-associated-types/higher-ranked-coroutine-param-outlives-2.no_assumptions.stderr deleted file mode 100644 index 8b62fb6a2547..000000000000 --- a/tests/ui/generic-associated-types/higher-ranked-coroutine-param-outlives-2.no_assumptions.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: lifetime bound not satisfied - --> $DIR/higher-ranked-coroutine-param-outlives-2.rs:14:5 - | -LL | / async { // a coroutine checked for autotrait impl `Send` -LL | | let x = None::>; // a type referencing GAT -LL | | async {}.await; // a yield point -LL | | } - | |_____^ - | - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - -error: lifetime bound not satisfied - --> $DIR/higher-ranked-coroutine-param-outlives-2.rs:21:5 - | -LL | / async { // a coroutine checked for autotrait impl `Send` -LL | | let x = None::>; // a type referencing GAT -LL | | async {}.await; // a yield point -LL | | } - | |_____^ - | - = note: this is a known limitation that will be removed in the future (see issue #100013 for more information) - -error: aborting due to 2 previous errors - diff --git a/tests/ui/generic-associated-types/higher-ranked-coroutine-param-outlives-2.rs b/tests/ui/generic-associated-types/higher-ranked-coroutine-param-outlives-2.rs index a5ed162d62c9..96ff23cbc087 100644 --- a/tests/ui/generic-associated-types/higher-ranked-coroutine-param-outlives-2.rs +++ b/tests/ui/generic-associated-types/higher-ranked-coroutine-param-outlives-2.rs @@ -1,8 +1,7 @@ +//@ check-pass //@ edition: 2021 //@ revisions: assumptions no_assumptions //@[assumptions] compile-flags: -Zhigher-ranked-assumptions -//@[assumptions] check-pass -//@[no_assumptions] known-bug: #110338 pub trait FutureIterator { type Future<'s, 'cx>: Send diff --git a/tests/ui/generic-associated-types/higher-ranked-coroutine-param-outlives.no_assumptions.stderr b/tests/ui/generic-associated-types/higher-ranked-coroutine-param-outlives.no_assumptions.stderr deleted file mode 100644 index f747ba9a7334..000000000000 --- a/tests/ui/generic-associated-types/higher-ranked-coroutine-param-outlives.no_assumptions.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: `C` does not live long enough - --> $DIR/higher-ranked-coroutine-param-outlives.rs:21:5 - | -LL | async move { c.connect().await } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/generic-associated-types/higher-ranked-coroutine-param-outlives.rs b/tests/ui/generic-associated-types/higher-ranked-coroutine-param-outlives.rs index 5f683bd82fa4..0c7d29d1256a 100644 --- a/tests/ui/generic-associated-types/higher-ranked-coroutine-param-outlives.rs +++ b/tests/ui/generic-associated-types/higher-ranked-coroutine-param-outlives.rs @@ -1,8 +1,7 @@ +//@ check-pass //@ edition:2018 //@ revisions: assumptions no_assumptions //@[assumptions] compile-flags: -Zhigher-ranked-assumptions -//@[assumptions] check-pass -//@[no_assumptions] known-bug: #110338 use std::future::Future; diff --git a/tests/ui/generic-associated-types/issue-93262.rs b/tests/ui/generic-associated-types/issue-93262.rs index c964606fef0b..c4a6f0dbaa07 100644 --- a/tests/ui/generic-associated-types/issue-93262.rs +++ b/tests/ui/generic-associated-types/issue-93262.rs @@ -1,4 +1,4 @@ -//@ check-fail +//@ check-pass pub trait Trait { type Assoc<'a> where Self: 'a; @@ -11,7 +11,7 @@ where pub struct Type; -impl Foo for Type //~ ERROR: the parameter type `T` may not live long enough +impl Foo for Type where for<'a> T::Assoc<'a>: Clone {} diff --git a/tests/ui/generic-associated-types/issue-93262.stderr b/tests/ui/generic-associated-types/issue-93262.stderr deleted file mode 100644 index 91d3e65f3de8..000000000000 --- a/tests/ui/generic-associated-types/issue-93262.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0311]: the parameter type `T` may not live long enough - --> $DIR/issue-93262.rs:14:16 - | -LL | impl Foo for Type - | ^^^^^^ - | | - | the parameter type `T` must be valid for lifetime `'a`... - | ...so that the type `T` will meet its required lifetime bounds... - | -note: ...that is required by this bound - --> $DIR/issue-93262.rs:9:27 - | -LL | for<'a> T::Assoc<'a>: Clone - | ^^^^^ - = help: consider adding an explicit lifetime bound `T: 'a`... - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0311`. diff --git a/tests/ui/sized-hierarchy/bound-on-assoc-type-projection-1.rs b/tests/ui/sized-hierarchy/bound-on-assoc-type-projection-1.rs new file mode 100644 index 000000000000..4a20ed2cafb1 --- /dev/null +++ b/tests/ui/sized-hierarchy/bound-on-assoc-type-projection-1.rs @@ -0,0 +1,21 @@ +//@ check-pass +//@ compile-flags: --crate-type=lib +//@ revisions: old next +//@[next] compile-flags: -Znext-solver + +use std::marker::PhantomData; + +pub trait ZeroMapKV<'a> { + type Container; +} + +pub trait ZeroFrom<'zf, C: ?Sized> {} + +pub struct ZeroMap<'a, K: ZeroMapKV<'a>>(PhantomData<&'a K>); + +impl<'zf, 's, K> ZeroFrom<'zf, ZeroMap<'s, K>> for ZeroMap<'zf, K> +where + K: for<'b> ZeroMapKV<'b>, + >::Container: ZeroFrom<'zf, >::Container>, +{ +}