Skip to content

Commit 4bd6be9

Browse files
committed
Inclusive range updated to ..= syntax
1 parent 525b81d commit 4bd6be9

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed

src/libcore/slice/mod.rs

+6-9
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
1717
#![stable(feature = "rust1", since = "1.0.0")]
1818

19-
// FIXME: after next stage0, change RangeInclusive { ... } back to ..=
20-
use ops::RangeInclusive;
21-
2219
// How this module is organized.
2320
//
2421
// The library infrastructure for slices is fairly messy. There's
@@ -1047,32 +1044,32 @@ impl<T> SliceIndex<[T]> for ops::RangeToInclusive<usize> {
10471044

10481045
#[inline]
10491046
fn get(self, slice: &[T]) -> Option<&[T]> {
1050-
(RangeInclusive { start: 0, end: self.end }).get(slice)
1047+
(0..=self.end).get(slice)
10511048
}
10521049

10531050
#[inline]
10541051
fn get_mut(self, slice: &mut [T]) -> Option<&mut [T]> {
1055-
(RangeInclusive { start: 0, end: self.end }).get_mut(slice)
1052+
(0..=self.end).get_mut(slice)
10561053
}
10571054

10581055
#[inline]
10591056
unsafe fn get_unchecked(self, slice: &[T]) -> &[T] {
1060-
(RangeInclusive { start: 0, end: self.end }).get_unchecked(slice)
1057+
(0..=self.end).get_unchecked(slice)
10611058
}
10621059

10631060
#[inline]
10641061
unsafe fn get_unchecked_mut(self, slice: &mut [T]) -> &mut [T] {
1065-
(RangeInclusive { start: 0, end: self.end }).get_unchecked_mut(slice)
1062+
(0..=self.end).get_unchecked_mut(slice)
10661063
}
10671064

10681065
#[inline]
10691066
fn index(self, slice: &[T]) -> &[T] {
1070-
(RangeInclusive { start: 0, end: self.end }).index(slice)
1067+
(0..=self.end).index(slice)
10711068
}
10721069

10731070
#[inline]
10741071
fn index_mut(self, slice: &mut [T]) -> &mut [T] {
1075-
(RangeInclusive { start: 0, end: self.end }).index_mut(slice)
1072+
(0..=self.end).index_mut(slice)
10761073
}
10771074
}
10781075

src/librustc/ty/maps/on_disk_cache.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ impl<'a> CacheDecoder<'a> {
165165
fn find_filemap_prev_bytepos(&self,
166166
prev_bytepos: BytePos)
167167
-> Option<(BytePos, StableFilemapId)> {
168-
for (start, id) in self.prev_filemap_starts.range(BytePos(0) ... prev_bytepos).rev() {
168+
for (start, id) in self.prev_filemap_starts.range(BytePos(0) ..= prev_bytepos).rev() {
169169
return Some((*start, *id))
170170
}
171171

src/libsyntax/print/pprust.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2203,7 +2203,7 @@ impl<'a> State<'a> {
22032203
if limits == ast::RangeLimits::HalfOpen {
22042204
self.s.word("..")?;
22052205
} else {
2206-
self.s.word("...")?;
2206+
self.s.word("..=")?;
22072207
}
22082208
if let Some(ref e) = *end {
22092209
self.print_expr_maybe_paren(e, fake_prec)?;

src/test/run-pass-fulldeps/issue-35829.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ fn main() {
4141
let raw_byte_string_lit_kind = LitKind::ByteStr(Rc::new(b"#\"two\"#".to_vec()));
4242
assert_eq!(raw_byte_string.node, ExprKind::Lit(P(dummy_spanned(raw_byte_string_lit_kind))));
4343

44-
// check dotdotdot
45-
let closed_range = quote_expr!(&cx, 0 ... 1);
44+
// check dotdoteq
45+
let closed_range = quote_expr!(&cx, 0 ..= 1);
4646
assert_eq!(closed_range.node, ExprKind::Range(
4747
Some(quote_expr!(&cx, 0)),
4848
Some(quote_expr!(&cx, 1)),

0 commit comments

Comments
 (0)