@@ -89,9 +89,14 @@ impl<'tcx> ObligationStorage<'tcx> {
8989 . iter ( )
9090 . filter ( |( _, stalled_on) | {
9191 let Some ( stalled_on) = stalled_on else { return true } ;
92- // Conservative here: if any of its stalled vars are not infer var anymore,
93- // some unification happened, so this goal is no longer stalled.
94- // So include it to re-evaluate in the downstream.
92+ // Don't reuse the sub-unification roots cached on `stalled_on`:
93+ // a later sub-unification merge can have changed which root
94+ // each stalled var belongs to, so the cached info can be stale.
95+ // Walk `stalled_vars` and recompute the current root instead.
96+ //
97+ // Conservative here: if a stalled var no longer resolves to an
98+ // infer var, some unification happened, so the goal is no longer
99+ // stalled. Include it to be re-evaluated downstream.
95100 stalled_on. stalled_vars . iter ( ) . filter_map ( |arg| arg. as_type ( ) ) . any (
96101 |ty| match * infcx. shallow_resolve ( ty) . kind ( ) {
97102 ty:: Infer ( ty:: TyVar ( tv) ) => infcx. sub_unification_table_root_var ( tv) == vid,
@@ -303,6 +308,10 @@ where
303308 infcx : & InferCtxt < ' tcx > ,
304309 vid : ty:: TyVid ,
305310 ) -> PredicateObligations < ' tcx > {
311+ // `-Zdisable-fast-paths`: same gate as the other new-solver fast paths.
312+ if infcx. tcx . disable_trait_solver_fast_paths ( ) {
313+ return self . obligations . clone_pending ( ) ;
314+ }
306315 self . obligations . clone_pending_potentially_referencing_sub_root ( infcx, vid)
307316 }
308317
0 commit comments