Skip to content

Commit a2e7e6f

Browse files
Check if type has coroutines before visiting
1 parent 2801f9a commit a2e7e6f

File tree

1 file changed

+7
-4
lines changed
  • compiler/rustc_trait_selection/src/solve

1 file changed

+7
-4
lines changed

compiler/rustc_trait_selection/src/solve/fulfill.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ use rustc_infer::traits::{
1010
FromSolverError, PredicateObligation, PredicateObligations, TraitEngine,
1111
};
1212
use rustc_middle::ty::{
13-
self, DelayedSet, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitor, TypingMode,
13+
self, DelayedSet, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor,
14+
TypingMode,
1415
};
1516
use rustc_next_trait_solver::delegate::SolverDelegate as _;
1617
use rustc_next_trait_solver::solve::{
@@ -332,10 +333,12 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for StalledOnCoroutines<'tcx> {
332333
if let ty::CoroutineWitness(def_id, _) = *ty.kind()
333334
&& def_id.as_local().is_some_and(|def_id| self.stalled_generators.contains(&def_id))
334335
{
335-
return ControlFlow::Break(());
336+
ControlFlow::Break(())
337+
} else if ty.has_coroutines() {
338+
ty.super_visit_with(self)
339+
} else {
340+
ControlFlow::Continue(())
336341
}
337-
338-
ty.super_visit_with(self)
339342
}
340343
}
341344

0 commit comments

Comments
 (0)