Rollup merge of #99557 - pierwill:patch-6, r=tmiasko

Edit `rustc_index::vec::IndexVec::pick3_mut` docs

Clarify when this method will panic.

Part of #93792.
This commit is contained in:
Matthias Krüger 2022-07-21 18:42:10 +02:00 committed by GitHub
commit 14c385d3d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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());
@ -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());