You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
traitView{}traitHasAssoc{typeAssoc;}structStableVec<T>(T);impl<T>ViewforStableVec<T>{}fnassert_view<F:View>(f:F) -> F{ f }fnstore<T>() -> StableVec<T::Assoc>whereT:HasAssoc,StableVec<T>:View,{let x = todo!();assert_view(x)}
This errors with
error[E0271]: type mismatch resolving `T == <T as HasAssoc>::Assoc`
--> src/main.rs:17:17
|
17 | assert_view(x)
| ^ types differ
error[E0308]: mismatched types
--> src/main.rs:17:5
|
11 | fn store<T>() -> StableVec<T::Assoc>
| ------------------- expected `StableVec<<T as HasAssoc>::Assoc>` because of return type
...
17 | assert_view(x)
| ^^^^^^^^^^^^^^ types differ
|
= note: expected struct `StableVec<<T as HasAssoc>::Assoc>`
found struct `StableVec<T>`
Further minimizing this is really hard. See the zulip thread for what I think is going on. I think the fix here is related to the fix for #191.
Generalization should try to actually normalize aliases instead of just replacing them with infer vars and emitting an AliasRelate goal. We should also do this for aliases with escaping bound vars, except there we also need to replace the bound vars with placeholders and need to make sure we lower the universes of anything we fail to map back to bound vars after trying to normalize (and we replace it with an alias again if normalization was ambig)
traitHasAssoc{typeAssoc;}traitBlanket<N,R>{}structImplsBlanket;impl<N,R>Blanket<N,R>forImplsBlanket{}structU1;structWrapper<N,R>(N,R);impl<N,R>Wrapper<N,R>{fnrequires_blanket()whereImplsBlanket:Blanket<N,R>,{}}fntest<N>()whereN:HasAssoc,ImplsBlanket:Blanket<N,U1>,{// we have the obligation `ImplsBlanket: Blanket<?t, U1>`.// the first param is an infer var because the projection `N::Assoc` is normalized to an infer var.// we have two candidates for the trait goal.// the env one: unify `?t` with `N`.// the impl one: ambiguous due to unsatisfied `?t: Sized`.// so we end up with `?t = N` which causes error in the projection alias relate goal later.Wrapper::<N::Assoc,U1>::requires_blanket();}
Activity
lcnr commentedon Jan 22, 2026
see https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/.E2.9C.94.20.60husky.60.20candidate.20preference.20thingy/near/569275328
lcnr commentedon Feb 25, 2026
likely also the cause of the regression in
bacon-scihttps://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/crater.20triage.20.3A3/near/575461950lcnr commentedon Mar 4, 2026
likely also the cause of
claw-qlhttps://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/crater.20triage.20.3A3/near/577136564Auto merge of #151746 - jdonszelmann:eagerly-normalize-in-generalize,…
Auto merge of #151746 - jdonszelmann:eagerly-normalize-in-generalize,…
Auto merge of #151746 - jdonszelmann:eagerly-normalize-in-generalize,…
Auto merge of #151746 - jdonszelmann:eagerly-normalize-in-generalize,…
Auto merge of #151746 - jdonszelmann:eagerly-normalize-in-generalize,…
Auto merge of #151746 - jdonszelmann:eagerly-normalize-in-generalize,…
Auto merge of #151746 - jdonszelmann:eagerly-normalize-in-generalize,…
lcnr commentedon Jul 27, 2026
This was fixed by adding rigid aliases rust-lang/rust#156742
Rollup merge of rust-lang#160304 - Randl:new_tests, r=adwinwhite
Rollup merge of rust-lang#160304 - Randl:new_tests, r=adwinwhite
Rollup merge of rust-lang#160304 - Randl:new_tests, r=adwinwhite
Rollup merge of rust-lang#160304 - Randl:new_tests, r=adwinwhite
Rollup merge of rust-lang#160304 - Randl:new_tests, r=adwinwhite
Rollup merge of rust-lang#160304 - Randl:new_tests, r=adwinwhite
Unrolled build for #160304
Auto merge of #151746 - jdonszelmann:eagerly-normalize-in-generalize,…