Skip to content

Commit 3684df7

Browse files
Auto merge of #144475 - compiler-errors:pending-faster, r=<try>
Don't loop if there are no pending obligations
2 parents 430d6ed + 3213399 commit 3684df7

File tree

1 file changed

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

1 file changed

+7
-0
lines changed

compiler/rustc_trait_selection/src/solve/fulfill.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ impl<'tcx> ObligationStorage<'tcx> {
118118
);
119119
})
120120
}
121+
122+
fn num_pending(&self) -> usize {
123+
self.pending.len()
124+
}
121125
}
122126

123127
impl<'tcx, E: 'tcx> FulfillmentCtxt<'tcx, E> {
@@ -181,6 +185,9 @@ where
181185

182186
fn select_where_possible(&mut self, infcx: &InferCtxt<'tcx>) -> Vec<E> {
183187
assert_eq!(self.usable_in_snapshot, infcx.num_open_snapshots());
188+
if self.obligations.num_pending() == 0 {
189+
return vec![];
190+
}
184191
let mut errors = Vec::new();
185192
loop {
186193
let mut any_changed = false;

0 commit comments

Comments
 (0)