trait_sel: don't require predicates of aliases hold

No longer require that we prove that the predicates of aliases hold when
checking the well-formedness of the alias. This permits more uses of GATs
and changes the output of yet more tests.
This commit is contained in:
David Wood 2025-06-27 10:11:28 +00:00
parent 321a47eb2c
commit c50aebba78
No known key found for this signature in database
19 changed files with 80 additions and 797 deletions

View file

@ -144,8 +144,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
obligation: &PolyTraitObligation<'tcx>,
idx: usize,
) -> Result<PredicateObligations<'tcx>, 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)
}

View file

@ -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

View file

@ -1,9 +1,8 @@
// Repro for <https://github.com/rust-lang/rust/issues/124757#issue-2279603232>.
//@ 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;

View file

@ -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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/100013> for more information)
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 4 previous errors

View file

@ -1,9 +1,8 @@
// Repro for <https://github.com/rust-lang/rust/issues/111105#issue-1692860759>.
//@ 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;

View file

@ -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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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<FI1, FI2> IterCaller for UseIter<FI1, FI2>
| ^^^^^^^^^^^^^^^^^
|
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 <https://github.com/rust-lang/rust/issues/100013> for more information)
error: lifetime bound not satisfied
--> $DIR/higher-ranked-auto-trait-3.rs:46:5
|
LL | type Future1<'cx> = impl Future<Output = ()> + 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 <https://github.com/rust-lang/rust/issues/100013> for more information)
error: lifetime bound not satisfied
--> $DIR/higher-ranked-auto-trait-3.rs:50:5
|
LL | type Future2<'cx> = impl Future<Output = ()> + 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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/100013> for more information)
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 17 previous errors

View file

@ -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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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<FI1, FI2> IterCaller for UseIter<FI1, FI2>
| ^^^^^^^^^^^^^^^^^
|
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 <https://github.com/rust-lang/rust/issues/100013> for more information)
error: lifetime bound not satisfied
--> $DIR/higher-ranked-auto-trait-3.rs:46:5
|
LL | type Future1<'cx> = impl Future<Output = ()> + 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 <https://github.com/rust-lang/rust/issues/100013> for more information)
error: lifetime bound not satisfied
--> $DIR/higher-ranked-auto-trait-3.rs:50:5
|
LL | type Future2<'cx> = impl Future<Output = ()> + 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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/100013> for more information)
error: aborting due to 19 previous errors

View file

@ -1,10 +1,8 @@
// Repro for <https://github.com/rust-lang/rust/issues/100013#issue-1323807923>.
//@ 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)]

View file

@ -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

View file

@ -1,9 +1,8 @@
// Repro for <https://github.com/rust-lang/rust/issues/90696#issuecomment-963375847>.
//@ 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)]

View file

@ -9,7 +9,8 @@ trait Bop {
fn bop<T: Bop + ?Sized>() {
let _ = <T as Bop>::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
}

View file

@ -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 `<T as Bop>::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<T: Bop + ?Sized>() {
| - this type parameter needs to be `Sized`
LL | let _ = <T as Bop>::Bar::default();
| ^^^^^^^ function or associated item cannot be called on `<T as Bop>::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 `<T as Bop>::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<T: Bop + ?Sized>() 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<T: Bop + ?Sized>() {
LL + fn bop<T: 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<T: Bop + ?Sized>() {
| - this type parameter needs to be `Sized`
LL | let _ = <T as Bop>::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<T: Bop + ?Sized>() {
LL + fn bop<T: 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`.

View file

@ -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::<I::Future<'_, '_>>; // 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 <https://github.com/rust-lang/rust/issues/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::<I::Future<'a, 'b>>; // 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 <https://github.com/rust-lang/rust/issues/100013> for more information)
error: aborting due to 2 previous errors

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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<T: Trait> Foo<T> for Type //~ ERROR: the parameter type `T` may not live long enough
impl<T: Trait> Foo<T> for Type
where
for<'a> T::Assoc<'a>: Clone
{}

View file

@ -1,19 +0,0 @@
error[E0311]: the parameter type `T` may not live long enough
--> $DIR/issue-93262.rs:14:16
|
LL | impl<T: Trait> Foo<T> 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`.

View file

@ -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>,
<K as ZeroMapKV<'zf>>::Container: ZeroFrom<'zf, <K as ZeroMapKV<'s>>::Container>,
{
}