diff options
| author | Michael Goulet <michael@errs.io> | 2024-05-01 22:39:49 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-05-02 22:03:01 -0400 |
| commit | 92861517aa7b97aaaeb444fa898dec3ede29f2aa (patch) | |
| tree | f9c10621c25385b9c7223a381d178ccad9ac5e82 /compiler/rustc_trait_selection/src/traits/engine.rs | |
| parent | d9eb5232b6fea1d902650727f71b4c1bbf69079a (diff) | |
| download | rust-92861517aa7b97aaaeb444fa898dec3ede29f2aa.tar.gz rust-92861517aa7b97aaaeb444fa898dec3ede29f2aa.zip | |
Take ocx by move for pending obligations
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits/engine.rs')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/engine.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/engine.rs b/compiler/rustc_trait_selection/src/traits/engine.rs index 9eaaef1eb22..551c8e7702e 100644 --- a/compiler/rustc_trait_selection/src/traits/engine.rs +++ b/compiler/rustc_trait_selection/src/traits/engine.rs @@ -195,8 +195,15 @@ impl<'a, 'tcx> ObligationCtxt<'a, 'tcx> { self.engine.borrow_mut().select_all_or_error(self.infcx) } + /// Returns the not-yet-processed and stalled obligations from the + /// `ObligationCtxt`. + /// + /// Takes ownership of the context as doing operations such as + /// [`ObligationCtxt::eq`] afterwards will result in other obligations + /// getting ignored. You can make a new `ObligationCtxt` if this + /// needs to be done in a loop, for example. #[must_use] - pub fn pending_obligations(&self) -> Vec<PredicateObligation<'tcx>> { + pub fn into_pending_obligations(self) -> Vec<PredicateObligation<'tcx>> { self.engine.borrow().pending_obligations() } |
