diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-09-10 14:17:37 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-10 14:17:37 +0200 |
| commit | d0ba5e33ff7e05f6ccd365fe97b822e33beaed6b (patch) | |
| tree | ecea9bfea80225b32c4c14944ac3653395d5aa13 /compiler/rustc_index | |
| parent | 7ad23f43a225546c095123de52cc07d8719f8e2b (diff) | |
| parent | 8d0c07f1a1ccc46f58d2c6dbf0dbf32dc0b0d6b9 (diff) | |
| download | rust-d0ba5e33ff7e05f6ccd365fe97b822e33beaed6b.tar.gz rust-d0ba5e33ff7e05f6ccd365fe97b822e33beaed6b.zip | |
Rollup merge of #144765 - Qelxiros:range-inclusive-last, r=jhpratt
inclusive `Range`s: change `end` to `last` Tracking issue: rust-lang/rust#125687 ACP: rust-lang/libs-team#511
Diffstat (limited to 'compiler/rustc_index')
| -rw-r--r-- | compiler/rustc_index/src/idx.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/rustc_index/src/idx.rs b/compiler/rustc_index/src/idx.rs index 33f406e2113..9cd7134659c 100644 --- a/compiler/rustc_index/src/idx.rs +++ b/compiler/rustc_index/src/idx.rs @@ -130,7 +130,22 @@ impl<I: Idx, T> IntoSliceIdx<I, [T]> for core::range::RangeFrom<I> { impl<I: Idx, T> IntoSliceIdx<I, [T]> for core::range::RangeInclusive<I> { type Output = core::range::RangeInclusive<usize>; #[inline] + #[cfg(bootstrap)] fn into_slice_idx(self) -> Self::Output { core::range::RangeInclusive { start: self.start.index(), end: self.end.index() } } + #[inline] + #[cfg(not(bootstrap))] + fn into_slice_idx(self) -> Self::Output { + core::range::RangeInclusive { start: self.start.index(), last: self.last.index() } + } +} + +#[cfg(all(feature = "nightly", not(bootstrap)))] +impl<I: Idx, T> IntoSliceIdx<I, [T]> for core::range::RangeToInclusive<I> { + type Output = core::range::RangeToInclusive<usize>; + #[inline] + fn into_slice_idx(self) -> Self::Output { + core::range::RangeToInclusive { last: self.last.index() } + } } |
