Skip to content

Commit 1c30399

Browse files
committed
Add documentation for select_where_possible and select_all_or_error
1 parent 0bd2ee3 commit 1c30399

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

compiler/rustc_infer/src/traits/engine.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,27 @@ pub trait TraitEngine<'tcx, E: 'tcx>: 'tcx {
7272
self.register_predicate_obligation(infcx, obligation);
7373
}
7474
}
75-
75+
/// Go over the list of pending obligations and try to evaluate them.
76+
///
77+
/// For each result:
78+
/// Ok: remove the obligation from the list
79+
/// Ambiguous: leave the obligation in the list to be evaluated later
80+
/// Err: remove the obligation from the list and return an error
81+
///
82+
/// Returns a list of errors from obligations that evaluated to Err.
7683
#[must_use]
7784
fn select_where_possible(&mut self, infcx: &InferCtxt<'tcx>) -> Vec<E>;
7885

7986
fn collect_remaining_errors(&mut self, infcx: &InferCtxt<'tcx>) -> Vec<E>;
8087

88+
/// Evaluate all pending obligations, return error if they can't be evaluated.
89+
///
90+
/// For each result:
91+
/// Ok: remove the obligation from the list
92+
/// Ambiguous: remove the obligation from the list and return an error
93+
/// Err: remove the obligation from the list and return an error
94+
///
95+
/// Returns a list of errors from obligations that evaluated to Ambiguous or Err.
8196
#[must_use]
8297
fn select_all_or_error(&mut self, infcx: &InferCtxt<'tcx>) -> Vec<E> {
8398
let errors = self.select_where_possible(infcx);

0 commit comments

Comments
 (0)