Skip to content

Commit bf2b473

Browse files
committed
Rename FullRange to RangeFull
1 parent c64a96d commit bf2b473

File tree

17 files changed

+134
-31
lines changed

17 files changed

+134
-31
lines changed

src/libcollections/str.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,13 @@ use core::char::CharExt;
6060
use core::clone::Clone;
6161
use core::iter::AdditiveIterator;
6262
use core::iter::{Iterator, IteratorExt};
63-
use core::ops::{FullRange, Index};
63+
use core::ops::Index;
64+
#[cfg(stage0)]
65+
use core::ops::FullRange as RangeFull;
66+
#[cfg(stage0)]
67+
use core::ops::FullRange;
68+
#[cfg(not(stage0))]
69+
use core::ops::RangeFull;
6470
use core::option::Option::{self, Some, None};
6571
use core::slice::AsSlice;
6672
use core::str as core_str;
@@ -408,7 +414,7 @@ Section: Trait implementations
408414

409415
/// Any string that can be represented as a slice.
410416
#[stable(feature = "rust1", since = "1.0.0")]
411-
pub trait StrExt: Index<FullRange, Output = str> {
417+
pub trait StrExt: Index<RangeFull, Output = str> {
412418
/// Escapes each char in `s` with `char::escape_default`.
413419
#[unstable(feature = "collections",
414420
reason = "return type may change to be an iterator")]

src/libcollections/string.rs

+10
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,7 @@ impl ops::Index<ops::RangeFrom<uint>> for String {
877877
&self[][*index]
878878
}
879879
}
880+
#[cfg(stage0)]
880881
#[stable(feature = "rust1", since = "1.0.0")]
881882
impl ops::Index<ops::FullRange> for String {
882883
type Output = str;
@@ -885,6 +886,15 @@ impl ops::Index<ops::FullRange> for String {
885886
unsafe { mem::transmute(self.vec.as_slice()) }
886887
}
887888
}
889+
#[cfg(not(stage0))]
890+
#[stable(feature = "rust1", since = "1.0.0")]
891+
impl ops::Index<ops::RangeFull> for String {
892+
type Output = str;
893+
#[inline]
894+
fn index(&self, _index: &ops::RangeFull) -> &str {
895+
unsafe { mem::transmute(self.vec.as_slice()) }
896+
}
897+
}
888898

889899
#[stable(feature = "rust1", since = "1.0.0")]
890900
impl ops::Deref for String {

src/libcollections/vec.rs

+20
Original file line numberDiff line numberDiff line change
@@ -1317,6 +1317,7 @@ impl<T> ops::Index<ops::RangeFrom<uint>> for Vec<T> {
13171317
self.as_slice().index(index)
13181318
}
13191319
}
1320+
#[cfg(stage0)]
13201321
#[stable(feature = "rust1", since = "1.0.0")]
13211322
impl<T> ops::Index<ops::FullRange> for Vec<T> {
13221323
type Output = [T];
@@ -1325,6 +1326,15 @@ impl<T> ops::Index<ops::FullRange> for Vec<T> {
13251326
self.as_slice()
13261327
}
13271328
}
1329+
#[cfg(not(stage0))]
1330+
#[stable(feature = "rust1", since = "1.0.0")]
1331+
impl<T> ops::Index<ops::RangeFull> for Vec<T> {
1332+
type Output = [T];
1333+
#[inline]
1334+
fn index(&self, _index: &ops::RangeFull) -> &[T] {
1335+
self.as_slice()
1336+
}
1337+
}
13281338

13291339
#[stable(feature = "rust1", since = "1.0.0")]
13301340
impl<T> ops::IndexMut<ops::Range<uint>> for Vec<T> {
@@ -1350,6 +1360,7 @@ impl<T> ops::IndexMut<ops::RangeFrom<uint>> for Vec<T> {
13501360
self.as_mut_slice().index_mut(index)
13511361
}
13521362
}
1363+
#[cfg(stage0)]
13531364
#[stable(feature = "rust1", since = "1.0.0")]
13541365
impl<T> ops::IndexMut<ops::FullRange> for Vec<T> {
13551366
type Output = [T];
@@ -1358,6 +1369,15 @@ impl<T> ops::IndexMut<ops::FullRange> for Vec<T> {
13581369
self.as_mut_slice()
13591370
}
13601371
}
1372+
#[cfg(not(stage0))]
1373+
#[stable(feature = "rust1", since = "1.0.0")]
1374+
impl<T> ops::IndexMut<ops::RangeFull> for Vec<T> {
1375+
type Output = [T];
1376+
#[inline]
1377+
fn index_mut(&mut self, _index: &ops::RangeFull) -> &mut [T] {
1378+
self.as_mut_slice()
1379+
}
1380+
}
13611381

13621382
#[stable(feature = "rust1", since = "1.0.0")]
13631383
impl<T> ops::Deref for Vec<T> {

src/libcore/ops.rs

+17
Original file line numberDiff line numberDiff line change
@@ -947,18 +947,35 @@ pub trait IndexMut<Index: ?Sized> {
947947
}
948948

949949
/// An unbounded range.
950+
#[cfg(stage0)]
950951
#[derive(Copy, Clone, PartialEq, Eq)]
951952
#[lang="full_range"]
952953
#[unstable(feature = "core", reason = "may be renamed to RangeFull")]
953954
pub struct FullRange;
954955

956+
/// An unbounded range.
957+
#[cfg(not(stage0))]
958+
#[derive(Copy, Clone, PartialEq, Eq)]
959+
#[lang="range_full"]
960+
#[stable(feature = "rust1", since = "1.0.0")]
961+
pub struct RangeFull;
962+
963+
#[cfg(stage0)]
955964
#[stable(feature = "rust1", since = "1.0.0")]
956965
impl fmt::Debug for FullRange {
957966
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
958967
fmt::Debug::fmt("..", fmt)
959968
}
960969
}
961970

971+
#[cfg(not(stage0))]
972+
#[stable(feature = "rust1", since = "1.0.0")]
973+
impl fmt::Debug for RangeFull {
974+
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
975+
fmt::Debug::fmt("..", fmt)
976+
}
977+
}
978+
962979
/// A (half-open) range which is bounded at both ends.
963980
#[derive(Copy, Clone, PartialEq, Eq)]
964981
#[lang="range"]

src/libcore/slice.rs

+28-14
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ use iter::*;
4444
use marker::Copy;
4545
use num::Int;
4646
use ops::{FnMut, self, Index};
47+
#[cfg(stage0)]
48+
use ops::FullRange as RangeFull;
49+
#[cfg(not(stage0))]
50+
use ops::RangeFull;
4751
use option::Option;
4852
use option::Option::{None, Some};
4953
use result::Result;
@@ -543,10 +547,10 @@ impl<T> ops::Index<ops::RangeFrom<uint>> for [T] {
543547
}
544548
}
545549
#[stable(feature = "rust1", since = "1.0.0")]
546-
impl<T> ops::Index<ops::FullRange> for [T] {
550+
impl<T> ops::Index<RangeFull> for [T] {
547551
type Output = [T];
548552
#[inline]
549-
fn index(&self, _index: &ops::FullRange) -> &[T] {
553+
fn index(&self, _index: &RangeFull) -> &[T] {
550554
self
551555
}
552556
}
@@ -584,10 +588,10 @@ impl<T> ops::IndexMut<ops::RangeFrom<uint>> for [T] {
584588
}
585589
}
586590
#[stable(feature = "rust1", since = "1.0.0")]
587-
impl<T> ops::IndexMut<ops::FullRange> for [T] {
591+
impl<T> ops::IndexMut<RangeFull> for [T] {
588592
type Output = [T];
589593
#[inline]
590-
fn index_mut(&mut self, _index: &ops::FullRange) -> &mut [T] {
594+
fn index_mut(&mut self, _index: &RangeFull) -> &mut [T] {
591595
self
592596
}
593597
}
@@ -750,6 +754,7 @@ impl<'a, T> ops::Index<ops::RangeFrom<uint>> for Iter<'a, T> {
750754
}
751755
}
752756

757+
#[cfg(stage0)]
753758
#[unstable(feature = "core")]
754759
impl<'a, T> ops::Index<ops::FullRange> for Iter<'a, T> {
755760
type Output = [T];
@@ -758,6 +763,15 @@ impl<'a, T> ops::Index<ops::FullRange> for Iter<'a, T> {
758763
self.as_slice()
759764
}
760765
}
766+
#[cfg(not(stage0))]
767+
#[unstable(feature = "core")]
768+
impl<'a, T> ops::Index<RangeFull> for Iter<'a, T> {
769+
type Output = [T];
770+
#[inline]
771+
fn index(&self, _index: &RangeFull) -> &[T] {
772+
self.as_slice()
773+
}
774+
}
761775

762776
impl<'a, T> Iter<'a, T> {
763777
/// View the underlying data as a subslice of the original data.
@@ -821,30 +835,30 @@ impl<'a, T> ops::Index<ops::Range<uint>> for IterMut<'a, T> {
821835
type Output = [T];
822836
#[inline]
823837
fn index(&self, index: &ops::Range<uint>) -> &[T] {
824-
self.index(&ops::FullRange).index(index)
838+
self.index(&RangeFull).index(index)
825839
}
826840
}
827841
#[unstable(feature = "core")]
828842
impl<'a, T> ops::Index<ops::RangeTo<uint>> for IterMut<'a, T> {
829843
type Output = [T];
830844
#[inline]
831845
fn index(&self, index: &ops::RangeTo<uint>) -> &[T] {
832-
self.index(&ops::FullRange).index(index)
846+
self.index(&RangeFull).index(index)
833847
}
834848
}
835849
#[unstable(feature = "core")]
836850
impl<'a, T> ops::Index<ops::RangeFrom<uint>> for IterMut<'a, T> {
837851
type Output = [T];
838852
#[inline]
839853
fn index(&self, index: &ops::RangeFrom<uint>) -> &[T] {
840-
self.index(&ops::FullRange).index(index)
854+
self.index(&RangeFull).index(index)
841855
}
842856
}
843857
#[unstable(feature = "core")]
844-
impl<'a, T> ops::Index<ops::FullRange> for IterMut<'a, T> {
858+
impl<'a, T> ops::Index<RangeFull> for IterMut<'a, T> {
845859
type Output = [T];
846860
#[inline]
847-
fn index(&self, _index: &ops::FullRange) -> &[T] {
861+
fn index(&self, _index: &RangeFull) -> &[T] {
848862
make_slice!(T => &[T]: self.ptr, self.end)
849863
}
850864
}
@@ -854,30 +868,30 @@ impl<'a, T> ops::IndexMut<ops::Range<uint>> for IterMut<'a, T> {
854868
type Output = [T];
855869
#[inline]
856870
fn index_mut(&mut self, index: &ops::Range<uint>) -> &mut [T] {
857-
self.index_mut(&ops::FullRange).index_mut(index)
871+
self.index_mut(&RangeFull).index_mut(index)
858872
}
859873
}
860874
#[unstable(feature = "core")]
861875
impl<'a, T> ops::IndexMut<ops::RangeTo<uint>> for IterMut<'a, T> {
862876
type Output = [T];
863877
#[inline]
864878
fn index_mut(&mut self, index: &ops::RangeTo<uint>) -> &mut [T] {
865-
self.index_mut(&ops::FullRange).index_mut(index)
879+
self.index_mut(&RangeFull).index_mut(index)
866880
}
867881
}
868882
#[unstable(feature = "core")]
869883
impl<'a, T> ops::IndexMut<ops::RangeFrom<uint>> for IterMut<'a, T> {
870884
type Output = [T];
871885
#[inline]
872886
fn index_mut(&mut self, index: &ops::RangeFrom<uint>) -> &mut [T] {
873-
self.index_mut(&ops::FullRange).index_mut(index)
887+
self.index_mut(&RangeFull).index_mut(index)
874888
}
875889
}
876890
#[unstable(feature = "core")]
877-
impl<'a, T> ops::IndexMut<ops::FullRange> for IterMut<'a, T> {
891+
impl<'a, T> ops::IndexMut<RangeFull> for IterMut<'a, T> {
878892
type Output = [T];
879893
#[inline]
880-
fn index_mut(&mut self, _index: &ops::FullRange) -> &mut [T] {
894+
fn index_mut(&mut self, _index: &RangeFull) -> &mut [T] {
881895
make_slice!(T => &mut [T]: self.ptr, self.end)
882896
}
883897
}

src/libcore/str/mod.rs

+10
Original file line numberDiff line numberDiff line change
@@ -1249,6 +1249,7 @@ mod traits {
12491249
}
12501250
}
12511251

1252+
#[cfg(stage0)]
12521253
#[stable(feature = "rust1", since = "1.0.0")]
12531254
impl ops::Index<ops::FullRange> for str {
12541255
type Output = str;
@@ -1257,6 +1258,15 @@ mod traits {
12571258
self
12581259
}
12591260
}
1261+
#[cfg(not(stage0))]
1262+
#[stable(feature = "rust1", since = "1.0.0")]
1263+
impl ops::Index<ops::RangeFull> for str {
1264+
type Output = str;
1265+
#[inline]
1266+
fn index(&self, _index: &ops::RangeFull) -> &str {
1267+
self
1268+
}
1269+
}
12601270
}
12611271

12621272
/// Any string that can be represented as a slice

src/librustc/middle/lang_items.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ lets_do_this! {
269269
RangeStructLangItem, "range", range_struct;
270270
RangeFromStructLangItem, "range_from", range_from_struct;
271271
RangeToStructLangItem, "range_to", range_to_struct;
272-
FullRangeStructLangItem, "full_range", full_range_struct;
272+
RangeFullStructLangItem, "range_full", range_full_struct;
273273

274274
UnsafeTypeLangItem, "unsafe", unsafe_type;
275275

src/librustc_trans/trans/expr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1050,8 +1050,8 @@ fn trans_rvalue_dps_unadjusted<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
10501050
(tcx.lang_items.range_to_struct(), fields, vec![node_id_type(bcx, end.id)])
10511051
}
10521052
_ => {
1053-
// Desugar to FullRange
1054-
(tcx.lang_items.full_range_struct(), vec![], vec![])
1053+
// Desugar to RangeFull
1054+
(tcx.lang_items.range_full_struct(), vec![], vec![])
10551055
}
10561056
};
10571057

src/librustc_typeck/check/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4095,8 +4095,8 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
40954095
}
40964096
}
40974097
None => {
4098-
// Neither start nor end => FullRange
4099-
if let Some(did) = tcx.lang_items.full_range_struct() {
4098+
// Neither start nor end => RangeFull
4099+
if let Some(did) = tcx.lang_items.range_full_struct() {
41004100
let substs = Substs::new_type(vec![], vec![]);
41014101
ty::mk_struct(tcx, did, tcx.mk_substs(substs))
41024102
} else {

src/libstd/ffi/os_str.rs

+11
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ impl OsString {
8282
}
8383
}
8484

85+
#[cfg(stage0)]
8586
impl ops::Index<ops::FullRange> for OsString {
8687
type Output = OsStr;
8788

@@ -91,6 +92,16 @@ impl ops::Index<ops::FullRange> for OsString {
9192
}
9293
}
9394

95+
#[cfg(not(stage0))]
96+
impl ops::Index<ops::RangeFull> for OsString {
97+
type Output = OsStr;
98+
99+
#[inline]
100+
fn index(&self, _index: &ops::RangeFull) -> &OsStr {
101+
unsafe { mem::transmute(self.inner.as_slice()) }
102+
}
103+
}
104+
94105
impl ops::Deref for OsString {
95106
type Target = OsStr;
96107

src/libstd/path/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ use fmt;
6868
use iter::IteratorExt;
6969
use option::Option;
7070
use option::Option::{None, Some};
71+
#[cfg(stage0)]
7172
use ops::FullRange;
7273
use str;
7374
use str::StrExt;

src/libstd/path/windows.rs

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use iter::{AdditiveIterator, Extend};
2525
use iter::{Iterator, IteratorExt, Map, repeat};
2626
use mem;
2727
use option::Option::{self, Some, None};
28+
#[cfg(stage0)]
2829
use ops::FullRange;
2930
use slice::{SliceExt, SliceConcatExt};
3031
use str::{SplitTerminator, FromStr, StrExt};

src/libstd/prelude/v1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#[stable(feature = "rust1", since = "1.0.0")]
1919
#[doc(no_inline)] pub use ops::{Drop, Fn, FnMut, FnOnce};
2020

21-
// TEMPORARY
21+
#[cfg(stage0)]
2222
#[unstable(feature = "std_misc")]
2323
#[doc(no_inline)] pub use ops::FullRange;
2424

src/libstd/sys/common/wtf8.rs

+11
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,7 @@ impl ops::Index<ops::RangeTo<usize>> for Wtf8 {
680680
}
681681
}
682682

683+
#[cfg(stage0)]
683684
impl ops::Index<ops::FullRange> for Wtf8 {
684685
type Output = Wtf8;
685686

@@ -689,6 +690,16 @@ impl ops::Index<ops::FullRange> for Wtf8 {
689690
}
690691
}
691692

693+
#[cfg(not(stage0))]
694+
impl ops::Index<ops::RangeFull> for Wtf8 {
695+
type Output = Wtf8;
696+
697+
#[inline]
698+
fn index(&self, _range: &ops::RangeFull) -> &Wtf8 {
699+
self
700+
}
701+
}
702+
692703
#[inline]
693704
fn decode_surrogate(second_byte: u8, third_byte: u8) -> u16 {
694705
// The first byte is assumed to be 0xED

0 commit comments

Comments
 (0)