Skip to content

Commit

Permalink
Rollup merge of rust-lang#99557 - pierwill:patch-6, r=tmiasko
Browse files Browse the repository at this point in the history
Edit `rustc_index::vec::IndexVec::pick3_mut` docs

Clarify when this method will panic.

Part of rust-lang#93792.
  • Loading branch information
matthiaskrgr committed Jul 21, 2022
2 parents e44326e + aad1aa3 commit 0a1b6ed
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions compiler/rustc_index/src/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ impl<I: Idx, T> IndexVec<I, T> {
self.raw.get_mut(index.index())
}

/// Returns mutable references to two distinct elements, a and b. Panics if a == b.
/// Returns mutable references to two distinct elements, `a` and `b`.
///
/// Panics if `a == b`.
#[inline]
pub fn pick2_mut(&mut self, a: I, b: I) -> (&mut T, &mut T) {
let (ai, bi) = (a.index(), b.index());
Expand All @@ -249,7 +251,9 @@ impl<I: Idx, T> IndexVec<I, T> {
}
}

/// Returns mutable references to three distinct elements or panics otherwise.
/// Returns mutable references to three distinct elements.
///
/// Panics if the elements are not distinct.
#[inline]
pub fn pick3_mut(&mut self, a: I, b: I, c: I) -> (&mut T, &mut T, &mut T) {
let (ai, bi, ci) = (a.index(), b.index(), c.index());
Expand Down

0 comments on commit 0a1b6ed

Please sign in to comment.