Skip to content

Commit eabd306

Browse files
committed
Document PredicateSet::insert
I always forget what the `bool` means :/
1 parent b657dc5 commit eabd306

File tree

1 file changed

+7
-0
lines changed
  • compiler/rustc_infer/src/traits

1 file changed

+7
-0
lines changed

compiler/rustc_infer/src/traits/util.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ impl<'tcx> PredicateSet<'tcx> {
2525
Self { tcx, set: Default::default() }
2626
}
2727

28+
/// Adds a predicate to the set.
29+
///
30+
/// Returns whether the predicate was newly inserted. That is:
31+
/// - If the set did not previously contain this predicate, `true` is returned.
32+
/// - If the set already contained this predicate, `false` is returned,
33+
/// and the set is not modified: original predicate is not replaced,
34+
/// and the predicate passed as argument is dropped.
2835
pub fn insert(&mut self, pred: ty::Predicate<'tcx>) -> bool {
2936
// We have to be careful here because we want
3037
//

0 commit comments

Comments
 (0)