Skip to content

Commit 2801aa4

Browse files
committed
cleanup try_evaluate_added_goals
1 parent 4f84cc7 commit 2801aa4

File tree

1 file changed

+5
-14
lines changed
  • compiler/rustc_next_trait_solver/src/solve/eval_ctxt

1 file changed

+5
-14
lines changed

compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -633,28 +633,19 @@ where
633633
// the certainty of all the goals.
634634
#[instrument(level = "trace", skip(self))]
635635
pub(super) fn try_evaluate_added_goals(&mut self) -> Result<Certainty, NoSolution> {
636-
let mut response = Ok(Certainty::overflow(false));
637636
for _ in 0..FIXPOINT_STEP_LIMIT {
638-
// FIXME: This match is a bit ugly, it might be nice to change the inspect
639-
// stuff to use a closure instead. which should hopefully simplify this a bit.
640637
match self.evaluate_added_goals_step() {
641-
Ok(Some(cert)) => {
642-
response = Ok(cert);
643-
break;
644-
}
645638
Ok(None) => {}
639+
Ok(Some(cert)) => return Ok(cert),
646640
Err(NoSolution) => {
647-
response = Err(NoSolution);
648-
break;
641+
self.tainted = Err(NoSolution);
642+
return Err(NoSolution);
649643
}
650644
}
651645
}
652646

653-
if response.is_err() {
654-
self.tainted = Err(NoSolution);
655-
}
656-
657-
response
647+
debug!("try_evaluate_added_goals: encountered overflow");
648+
Ok(Certainty::overflow(false))
658649
}
659650

660651
/// Iterate over all added goals: returning `Ok(Some(_))` in case we can stop rerunning.

0 commit comments

Comments
 (0)