-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
rust-lang/rust
#139828Labels
from-craterA regression found via a crater run, not part of our test suiteA regression found via a crater run, not part of our test suite
Description
Minimized:
use std::{future::Future, pin::Pin};
pub trait FromRequest<'r> {
type Assoc;
fn from_request() -> Pin<Box<dyn Future<Output = Self::Assoc> + Send>>;
}
fn from_request<'r, T: FromRequest<'r>>() -> Pin<Box<dyn Future<Output = ()> + Send>> {
Box::pin(async move {
T::from_request().await;
})
}
Metadata
Metadata
Assignees
Labels
from-craterA regression found via a crater run, not part of our test suiteA regression found via a crater run, not part of our test suite
Type
Projects
Status
done
Milestone
Relationships
Development
Select code repository
Activity
compiler-errors commentedon Apr 11, 2025
compiler-errors commentedon Apr 11, 2025
Has to do with the leak check and higher ranked trait bounds b/c of coroutine witness erasure.
I think we're somewhat unnecessarily requiring thatdyn Future<Output = Self::Assoc> + Send
implements all of its bounds in order for it to implementSend
.Proving the coroutine is
Send
requires proving(dyn Future<Output = <T as FromRequest<'!0>>::Assoc> + Send): Send
. Note that'!0
is some higher ranked lifetime due to coroutine lifetime erasure.Checking this goal goes through assemble_object_bound_candidates -> probe_and_consider_object_bound_candidate, which equates the self type with itself. That emits an alias-relate goal
<T as FromRequest<'!0>>::Assoc == <T as FromRequest<'!0>>::Assoc
, which ends up normalizing<T as FromRequest<'!0>>::Assoc
, which is rigid, which ends up checkingT: FromRequest<'!0>
for alias wf.Since all we know is that
T: FromRequest<'r>
from the param-env, we end up failing (I believe due to the leak check here).compiler-errors commentedon Apr 13, 2025
The reason this doesn't fail in the old solver is b/c we don't check that rigid projections implement their trait goal, lol.
compiler-errors commentedon Apr 13, 2025
I'm curious to know exactly what the fallout of this is in the old solver: rust-lang/rust#139763
Rollup merge of rust-lang#139828 - compiler-errors:rigid-trait, r=lcnr
Unrolled build for rust-lang#139828
[-]rocket regression[/-][+]rocket regression: rigid alias don't require trait to hold[/+]1 remaining item