diff options
| author | tiif <pekyuan@gmail.com> | 2025-09-15 09:02:12 +0000 |
|---|---|---|
| committer | tiif <pekyuan@gmail.com> | 2025-09-15 09:02:12 +0000 |
| commit | 1c30399ceae2400e266660a8f98a7504c284fda1 (patch) | |
| tree | 6f6f822f19efb5629f3a2239eabe55e182bd5a47 /compiler/rustc_infer | |
| parent | 0bd2ee3a0c260894eb92f5f0f5f8dd56182cda3f (diff) | |
| download | rust-1c30399ceae2400e266660a8f98a7504c284fda1.tar.gz rust-1c30399ceae2400e266660a8f98a7504c284fda1.zip | |
Add documentation for select_where_possible and select_all_or_error
Diffstat (limited to 'compiler/rustc_infer')
| -rw-r--r-- | compiler/rustc_infer/src/traits/engine.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/compiler/rustc_infer/src/traits/engine.rs b/compiler/rustc_infer/src/traits/engine.rs index 9a66bd0574c..4a252719694 100644 --- a/compiler/rustc_infer/src/traits/engine.rs +++ b/compiler/rustc_infer/src/traits/engine.rs @@ -72,12 +72,27 @@ pub trait TraitEngine<'tcx, E: 'tcx>: 'tcx { self.register_predicate_obligation(infcx, obligation); } } - + /// Go over the list of pending obligations and try to evaluate them. + /// + /// For each result: + /// Ok: remove the obligation from the list + /// Ambiguous: leave the obligation in the list to be evaluated later + /// Err: remove the obligation from the list and return an error + /// + /// Returns a list of errors from obligations that evaluated to Err. #[must_use] fn select_where_possible(&mut self, infcx: &InferCtxt<'tcx>) -> Vec<E>; fn collect_remaining_errors(&mut self, infcx: &InferCtxt<'tcx>) -> Vec<E>; + /// Evaluate all pending obligations, return error if they can't be evaluated. + /// + /// For each result: + /// Ok: remove the obligation from the list + /// Ambiguous: remove the obligation from the list and return an error + /// Err: remove the obligation from the list and return an error + /// + /// Returns a list of errors from obligations that evaluated to Ambiguous or Err. #[must_use] fn select_all_or_error(&mut self, infcx: &InferCtxt<'tcx>) -> Vec<E> { let errors = self.select_where_possible(infcx); |
