diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2023-07-19 09:44:40 +0000 |
|---|---|---|
| committer | Maybe Waffle <waffle.lapkin@gmail.com> | 2023-07-19 09:44:40 +0000 |
| commit | eabd306265911c30641dbf8b263e0191a7e07f9a (patch) | |
| tree | c073e281b47226727cd6b24be08cb4755d7a0a87 /compiler/rustc_infer/src/traits/util.rs | |
| parent | b657dc555b1ecf837cc4ea471fbae6a731529d55 (diff) | |
| download | rust-eabd306265911c30641dbf8b263e0191a7e07f9a.tar.gz rust-eabd306265911c30641dbf8b263e0191a7e07f9a.zip | |
Document `PredicateSet::insert`
I always forget what the `bool` means :/
Diffstat (limited to 'compiler/rustc_infer/src/traits/util.rs')
| -rw-r--r-- | compiler/rustc_infer/src/traits/util.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_infer/src/traits/util.rs b/compiler/rustc_infer/src/traits/util.rs index 074ff7ec97f..87ba6b3ec50 100644 --- a/compiler/rustc_infer/src/traits/util.rs +++ b/compiler/rustc_infer/src/traits/util.rs @@ -25,6 +25,13 @@ impl<'tcx> PredicateSet<'tcx> { Self { tcx, set: Default::default() } } + /// Adds a predicate to the set. + /// + /// Returns whether the predicate was newly inserted. That is: + /// - If the set did not previously contain this predicate, `true` is returned. + /// - If the set already contained this predicate, `false` is returned, + /// and the set is not modified: original predicate is not replaced, + /// and the predicate passed as argument is dropped. pub fn insert(&mut self, pred: ty::Predicate<'tcx>) -> bool { // We have to be careful here because we want // |
