Unstall obligations by looking for coroutines in old solver
This commit is contained in:
@@ -255,7 +255,7 @@ where
|
||||
&mut self,
|
||||
infcx: &InferCtxt<'tcx>,
|
||||
) -> PredicateObligations<'tcx> {
|
||||
let stalled_generators = match infcx.typing_mode() {
|
||||
let stalled_coroutines = match infcx.typing_mode() {
|
||||
TypingMode::Analysis { defining_opaque_types_and_generators } => {
|
||||
defining_opaque_types_and_generators
|
||||
}
|
||||
@@ -265,7 +265,7 @@ where
|
||||
| TypingMode::PostAnalysis => return Default::default(),
|
||||
};
|
||||
|
||||
if stalled_generators.is_empty() {
|
||||
if stalled_coroutines.is_empty() {
|
||||
return Default::default();
|
||||
}
|
||||
|
||||
@@ -276,7 +276,7 @@ where
|
||||
.visit_proof_tree(
|
||||
obl.as_goal(),
|
||||
&mut StalledOnCoroutines {
|
||||
stalled_generators,
|
||||
stalled_coroutines,
|
||||
span: obl.cause.span,
|
||||
cache: Default::default(),
|
||||
},
|
||||
@@ -298,10 +298,10 @@ where
|
||||
///
|
||||
/// This function can be also return false positives, which will lead to poor diagnostics
|
||||
/// so we want to keep this visitor *precise* too.
|
||||
struct StalledOnCoroutines<'tcx> {
|
||||
stalled_generators: &'tcx ty::List<LocalDefId>,
|
||||
span: Span,
|
||||
cache: DelayedSet<Ty<'tcx>>,
|
||||
pub struct StalledOnCoroutines<'tcx> {
|
||||
pub stalled_coroutines: &'tcx ty::List<LocalDefId>,
|
||||
pub span: Span,
|
||||
pub cache: DelayedSet<Ty<'tcx>>,
|
||||
}
|
||||
|
||||
impl<'tcx> inspect::ProofTreeVisitor<'tcx> for StalledOnCoroutines<'tcx> {
|
||||
@@ -331,7 +331,7 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for StalledOnCoroutines<'tcx> {
|
||||
}
|
||||
|
||||
if let ty::CoroutineWitness(def_id, _) = *ty.kind()
|
||||
&& def_id.as_local().is_some_and(|def_id| self.stalled_generators.contains(&def_id))
|
||||
&& def_id.as_local().is_some_and(|def_id| self.stalled_coroutines.contains(&def_id))
|
||||
{
|
||||
ControlFlow::Break(())
|
||||
} else if ty.has_coroutines() {
|
||||
|
||||
Reference in New Issue
Block a user