From 36ef29abf7fa14dc9361d6b30ff7f8d18bfb4157 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 24 Mar 2015 18:13:54 -0700 Subject: [PATCH] Register new snapshots --- src/driver/driver.rs | 4 +- src/libcollections/bit.rs | 12 - src/libcollections/btree/map.rs | 14 - src/libcollections/btree/node.rs | 61 --- src/libcollections/string.rs | 28 -- src/libcollections/vec.rs | 74 --- src/libcollections/vec_deque.rs | 14 - src/libcollections/vec_map.rs | 23 - src/libcore/intrinsics.rs | 23 - src/libcore/ops.rs | 62 --- src/libcore/slice.rs | 185 -------- src/libcore/str/mod.rs | 88 ---- src/liblibc/lib.rs | 2 +- src/librustc/lib.rs | 2 +- src/librustc_borrowck/lib.rs | 2 +- src/librustc_driver/lib.rs | 2 +- src/librustc_trans/lib.rs | 2 +- src/librustdoc/lib.rs | 4 +- src/libserialize/json.rs | 23 - src/libstd/collections/hash/map.rs | 16 - src/libstd/ffi/os_str.rs | 12 - src/libstd/lib.rs | 6 +- src/libstd/old_io/mem.rs | 2 +- src/libstd/sys/common/wtf8.rs | 79 ---- src/libsyntax/lib.rs | 2 +- src/libtest/lib.rs | 2 +- src/libunicode/char.rs | 424 ------------------ src/snapshots.txt | 10 + .../borrowck-overloaded-index-autoderef.rs | 13 - 29 files changed, 25 insertions(+), 1166 deletions(-) diff --git a/src/driver/driver.rs b/src/driver/driver.rs index 6b56c2b630346..c5c58bb49ac36 100644 --- a/src/driver/driver.rs +++ b/src/driver/driver.rs @@ -12,9 +12,9 @@ #![cfg_attr(rustdoc, feature(rustdoc))] #[cfg(rustdoc)] -extern crate "rustdoc" as this; +extern crate rustdoc as this; #[cfg(rustc)] -extern crate "rustc_driver" as this; +extern crate rustc_driver as this; fn main() { this::main() } diff --git a/src/libcollections/bit.rs b/src/libcollections/bit.rs index 377b52a3dbe29..fcf8c8156944c 100644 --- a/src/libcollections/bit.rs +++ b/src/libcollections/bit.rs @@ -171,18 +171,6 @@ pub struct BitVec { impl Index for BitVec { type Output = bool; - - #[cfg(stage0)] - #[inline] - fn index(&self, i: &usize) -> &bool { - if self.get(*i).expect("index out of bounds") { - &TRUE - } else { - &FALSE - } - } - - #[cfg(not(stage0))] #[inline] fn index(&self, i: usize) -> &bool { if self.get(i).expect("index out of bounds") { diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs index c2f6fbc0b2602..1f48f904e5fb0 100644 --- a/src/libcollections/btree/map.rs +++ b/src/libcollections/btree/map.rs @@ -915,20 +915,6 @@ impl Debug for BTreeMap { } } -#[cfg(stage0)] -#[stable(feature = "rust1", since = "1.0.0")] -impl Index for BTreeMap - where K: Borrow, Q: Ord -{ - type Output = V; - - #[inline] - fn index(&self, key: &Q) -> &V { - self.get(key).expect("no entry found for key") - } -} - -#[cfg(not(stage0))] #[stable(feature = "rust1", since = "1.0.0")] impl<'a, K: Ord, Q: ?Sized, V> Index<&'a Q> for BTreeMap where K: Borrow, Q: Ord diff --git a/src/libcollections/btree/node.rs b/src/libcollections/btree/node.rs index 23eafa41d8a01..66f04d94ca131 100644 --- a/src/libcollections/btree/node.rs +++ b/src/libcollections/btree/node.rs @@ -1524,36 +1524,6 @@ macro_rules! node_slice_impl { } /// Returns a sub-slice with elements starting with `min_key`. - #[cfg(stage0)] - pub fn slice_from(self, min_key: &K) -> $NodeSlice<'a, K, V> { - // _______________ - // |_1_|_3_|_5_|_7_| - // | | | | | - // 0 0 1 1 2 2 3 3 4 index - // | | | | | - // \___|___|___|___/ slice_from(&0); pos = 0 - // \___|___|___/ slice_from(&2); pos = 1 - // |___|___|___/ slice_from(&3); pos = 1; result.head_is_edge = false - // \___|___/ slice_from(&4); pos = 2 - // \___/ slice_from(&6); pos = 3 - // \|/ slice_from(&999); pos = 4 - let (pos, pos_is_kv) = self.search_linear(min_key); - $NodeSlice { - has_edges: self.has_edges, - edges: if !self.has_edges { - self.edges - } else { - self.edges.$index(&(pos ..)) - }, - keys: &self.keys[pos ..], - vals: self.vals.$index(&(pos ..)), - head_is_edge: !pos_is_kv, - tail_is_edge: self.tail_is_edge, - } - } - - /// Returns a sub-slice with elements starting with `min_key`. - #[cfg(not(stage0))] pub fn slice_from(self, min_key: &K) -> $NodeSlice<'a, K, V> { // _______________ // |_1_|_3_|_5_|_7_| @@ -1582,37 +1552,6 @@ macro_rules! node_slice_impl { } /// Returns a sub-slice with elements up to and including `max_key`. - #[cfg(stage0)] - pub fn slice_to(self, max_key: &K) -> $NodeSlice<'a, K, V> { - // _______________ - // |_1_|_3_|_5_|_7_| - // | | | | | - // 0 0 1 1 2 2 3 3 4 index - // | | | | | - //\|/ | | | | slice_to(&0); pos = 0 - // \___/ | | | slice_to(&2); pos = 1 - // \___|___| | | slice_to(&3); pos = 1; result.tail_is_edge = false - // \___|___/ | | slice_to(&4); pos = 2 - // \___|___|___/ | slice_to(&6); pos = 3 - // \___|___|___|___/ slice_to(&999); pos = 4 - let (pos, pos_is_kv) = self.search_linear(max_key); - let pos = pos + if pos_is_kv { 1 } else { 0 }; - $NodeSlice { - has_edges: self.has_edges, - edges: if !self.has_edges { - self.edges - } else { - self.edges.$index(&(.. (pos + 1))) - }, - keys: &self.keys[..pos], - vals: self.vals.$index(&(.. pos)), - head_is_edge: self.head_is_edge, - tail_is_edge: !pos_is_kv, - } - } - - /// Returns a sub-slice with elements up to and including `max_key`. - #[cfg(not(stage0))] pub fn slice_to(self, max_key: &K) -> $NodeSlice<'a, K, V> { // _______________ // |_1_|_3_|_5_|_7_| diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index a61eaecd2b1ea..7131c1cd881b4 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -903,13 +903,6 @@ impl<'a> Add<&'a str> for String { impl ops::Index> for String { type Output = str; - #[cfg(stage0)] - #[inline] - fn index(&self, index: &ops::Range) -> &str { - &self[..][*index] - } - - #[cfg(not(stage0))] #[inline] fn index(&self, index: ops::Range) -> &str { &self[..][index] @@ -919,13 +912,6 @@ impl ops::Index> for String { impl ops::Index> for String { type Output = str; - #[cfg(stage0)] - #[inline] - fn index(&self, index: &ops::RangeTo) -> &str { - &self[..][*index] - } - - #[cfg(not(stage0))] #[inline] fn index(&self, index: ops::RangeTo) -> &str { &self[..][index] @@ -935,13 +921,6 @@ impl ops::Index> for String { impl ops::Index> for String { type Output = str; - #[cfg(stage0)] - #[inline] - fn index(&self, index: &ops::RangeFrom) -> &str { - &self[..][*index] - } - - #[cfg(not(stage0))] #[inline] fn index(&self, index: ops::RangeFrom) -> &str { &self[..][index] @@ -951,13 +930,6 @@ impl ops::Index> for String { impl ops::Index for String { type Output = str; - #[cfg(stage0)] - #[inline] - fn index(&self, _index: &ops::RangeFull) -> &str { - unsafe { mem::transmute(&*self.vec) } - } - - #[cfg(not(stage0))] #[inline] fn index(&self, _index: ops::RangeFull) -> &str { unsafe { mem::transmute(&*self.vec) } diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index e71077c96c774..ee528255ae7a5 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -1343,15 +1343,6 @@ impl Hash for Vec { impl Index for Vec { type Output = T; - - #[cfg(stage0)] - #[inline] - fn index(&self, index: &usize) -> &T { - // NB built-in indexing via `&[T]` - &(**self)[*index] - } - - #[cfg(not(stage0))] #[inline] fn index(&self, index: usize) -> &T { // NB built-in indexing via `&[T]` @@ -1361,15 +1352,6 @@ impl Index for Vec { #[stable(feature = "rust1", since = "1.0.0")] impl IndexMut for Vec { - - #[cfg(stage0)] - #[inline] - fn index_mut(&mut self, index: &usize) -> &mut T { - // NB built-in indexing via `&mut [T]` - &mut (**self)[*index] - } - - #[cfg(not(stage0))] #[inline] fn index_mut(&mut self, index: usize) -> &mut T { // NB built-in indexing via `&mut [T]` @@ -1382,13 +1364,6 @@ impl IndexMut for Vec { impl ops::Index> for Vec { type Output = [T]; - #[cfg(stage0)] - #[inline] - fn index(&self, index: &ops::Range) -> &[T] { - Index::index(&**self, index) - } - - #[cfg(not(stage0))] #[inline] fn index(&self, index: ops::Range) -> &[T] { Index::index(&**self, index) @@ -1398,13 +1373,6 @@ impl ops::Index> for Vec { impl ops::Index> for Vec { type Output = [T]; - #[cfg(stage0)] - #[inline] - fn index(&self, index: &ops::RangeTo) -> &[T] { - Index::index(&**self, index) - } - - #[cfg(not(stage0))] #[inline] fn index(&self, index: ops::RangeTo) -> &[T] { Index::index(&**self, index) @@ -1414,13 +1382,6 @@ impl ops::Index> for Vec { impl ops::Index> for Vec { type Output = [T]; - #[cfg(stage0)] - #[inline] - fn index(&self, index: &ops::RangeFrom) -> &[T] { - Index::index(&**self, index) - } - - #[cfg(not(stage0))] #[inline] fn index(&self, index: ops::RangeFrom) -> &[T] { Index::index(&**self, index) @@ -1430,13 +1391,6 @@ impl ops::Index> for Vec { impl ops::Index for Vec { type Output = [T]; - #[cfg(stage0)] - #[inline] - fn index(&self, _index: &ops::RangeFull) -> &[T] { - self - } - - #[cfg(not(stage0))] #[inline] fn index(&self, _index: ops::RangeFull) -> &[T] { self @@ -1446,13 +1400,6 @@ impl ops::Index for Vec { #[stable(feature = "rust1", since = "1.0.0")] impl ops::IndexMut> for Vec { - #[cfg(stage0)] - #[inline] - fn index_mut(&mut self, index: &ops::Range) -> &mut [T] { - IndexMut::index_mut(&mut **self, index) - } - - #[cfg(not(stage0))] #[inline] fn index_mut(&mut self, index: ops::Range) -> &mut [T] { IndexMut::index_mut(&mut **self, index) @@ -1461,13 +1408,6 @@ impl ops::IndexMut> for Vec { #[stable(feature = "rust1", since = "1.0.0")] impl ops::IndexMut> for Vec { - #[cfg(stage0)] - #[inline] - fn index_mut(&mut self, index: &ops::RangeTo) -> &mut [T] { - IndexMut::index_mut(&mut **self, index) - } - - #[cfg(not(stage0))] #[inline] fn index_mut(&mut self, index: ops::RangeTo) -> &mut [T] { IndexMut::index_mut(&mut **self, index) @@ -1476,13 +1416,6 @@ impl ops::IndexMut> for Vec { #[stable(feature = "rust1", since = "1.0.0")] impl ops::IndexMut> for Vec { - #[cfg(stage0)] - #[inline] - fn index_mut(&mut self, index: &ops::RangeFrom) -> &mut [T] { - IndexMut::index_mut(&mut **self, index) - } - - #[cfg(not(stage0))] #[inline] fn index_mut(&mut self, index: ops::RangeFrom) -> &mut [T] { IndexMut::index_mut(&mut **self, index) @@ -1491,13 +1424,6 @@ impl ops::IndexMut> for Vec { #[stable(feature = "rust1", since = "1.0.0")] impl ops::IndexMut for Vec { - #[cfg(stage0)] - #[inline] - fn index_mut(&mut self, _index: &ops::RangeFull) -> &mut [T] { - self.as_mut_slice() - } - - #[cfg(not(stage0))] #[inline] fn index_mut(&mut self, _index: ops::RangeFull) -> &mut [T] { self.as_mut_slice() diff --git a/src/libcollections/vec_deque.rs b/src/libcollections/vec_deque.rs index af9db46f810b9..f5702be2f4588 100644 --- a/src/libcollections/vec_deque.rs +++ b/src/libcollections/vec_deque.rs @@ -1705,13 +1705,6 @@ impl Hash for VecDeque { impl Index for VecDeque { type Output = A; - #[cfg(stage0)] - #[inline] - fn index(&self, i: &usize) -> &A { - self.get(*i).expect("Out of bounds access") - } - - #[cfg(not(stage0))] #[inline] fn index(&self, i: usize) -> &A { self.get(i).expect("Out of bounds access") @@ -1720,13 +1713,6 @@ impl Index for VecDeque { #[stable(feature = "rust1", since = "1.0.0")] impl IndexMut for VecDeque { - #[cfg(stage0)] - #[inline] - fn index_mut(&mut self, i: &usize) -> &mut A { - self.get_mut(*i).expect("Out of bounds access") - } - - #[cfg(not(stage0))] #[inline] fn index_mut(&mut self, i: usize) -> &mut A { self.get_mut(i).expect("Out of bounds access") diff --git a/src/libcollections/vec_map.rs b/src/libcollections/vec_map.rs index c994064d34724..980131b9711e0 100644 --- a/src/libcollections/vec_map.rs +++ b/src/libcollections/vec_map.rs @@ -821,17 +821,6 @@ impl Extend<(usize, V)> for VecMap { } } -#[cfg(stage0)] -impl Index for VecMap { - type Output = V; - - #[inline] - fn index<'a>(&'a self, i: &usize) -> &'a V { - self.get(i).expect("key not present") - } -} - -#[cfg(not(stage0))] impl Index for VecMap { type Output = V; @@ -841,7 +830,6 @@ impl Index for VecMap { } } -#[cfg(not(stage0))] impl<'a,V> Index<&'a usize> for VecMap { type Output = V; @@ -851,16 +839,6 @@ impl<'a,V> Index<&'a usize> for VecMap { } } -#[cfg(stage0)] -#[stable(feature = "rust1", since = "1.0.0")] -impl IndexMut for VecMap { - #[inline] - fn index_mut(&mut self, i: &usize) -> &mut V { - self.get_mut(&i).expect("key not present") - } -} - -#[cfg(not(stage0))] #[stable(feature = "rust1", since = "1.0.0")] impl IndexMut for VecMap { #[inline] @@ -869,7 +847,6 @@ impl IndexMut for VecMap { } } -#[cfg(not(stage0))] #[stable(feature = "rust1", since = "1.0.0")] impl<'a, V> IndexMut<&'a usize> for VecMap { #[inline] diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 1f1044b0b2152..211b0152c33ce 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -44,10 +44,6 @@ use marker::Sized; -#[cfg(stage0)] pub use self::copy_memory as copy; -#[cfg(stage0)] pub use self::set_memory as write_bytes; -#[cfg(stage0)] pub use self::copy_nonoverlapping_memory as copy_nonoverlapping; - extern "rust-intrinsic" { // NB: These intrinsics take unsafe pointers because they mutate aliased @@ -183,7 +179,6 @@ extern "rust-intrinsic" { pub fn pref_align_of() -> usize; /// Gets a static string slice containing the name of a type. - #[cfg(not(stage0))] pub fn type_name() -> &'static str; /// Gets an identifier which is globally unique to the specified type. This @@ -287,14 +282,8 @@ extern "rust-intrinsic" { /// } /// ``` #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(not(stage0))] pub fn copy_nonoverlapping(dst: *mut T, src: *const T, count: usize); - /// dox - #[stable(feature = "rust1", since = "1.0.0")] - #[cfg(stage0)] - pub fn copy_nonoverlapping_memory(dst: *mut T, src: *const T, count: usize); - /// Copies `count * size_of` bytes from `src` to `dst`. The source /// and destination may overlap. /// @@ -323,26 +312,14 @@ extern "rust-intrinsic" { /// } /// ``` /// - #[cfg(not(stage0))] #[stable(feature = "rust1", since = "1.0.0")] pub fn copy(dst: *mut T, src: *const T, count: usize); - /// dox - #[cfg(stage0)] - #[stable(feature = "rust1", since = "1.0.0")] - pub fn copy_memory(dst: *mut T, src: *const T, count: usize); - /// Invokes memset on the specified pointer, setting `count * size_of::()` /// bytes of memory starting at `dst` to `c`. - #[cfg(not(stage0))] #[stable(feature = "rust1", since = "1.0.0")] pub fn write_bytes(dst: *mut T, val: u8, count: usize); - /// dox - #[cfg(stage0)] - #[stable(feature = "rust1", since = "1.0.0")] - pub fn set_memory(dst: *mut T, val: u8, count: usize); - /// Equivalent to the appropriate `llvm.memcpy.p0i8.0i8.*` intrinsic, with /// a size of `count` * `size_of::()` and an alignment of /// `min_align_of::()` diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs index 16d03901239b3..26deb80d8c51f 100644 --- a/src/libcore/ops.rs +++ b/src/libcore/ops.rs @@ -917,12 +917,6 @@ pub trait Index { type Output: ?Sized; /// The method for the indexing (`Foo[Bar]`) operation - #[cfg(stage0)] - #[stable(feature = "rust1", since = "1.0.0")] - fn index<'a>(&'a self, index: &Idx) -> &'a Self::Output; - - /// The method for the indexing (`Foo[Bar]`) operation - #[cfg(not(stage0))] #[stable(feature = "rust1", since = "1.0.0")] fn index<'a>(&'a self, index: Idx) -> &'a Self::Output; } @@ -966,12 +960,6 @@ pub trait Index { #[stable(feature = "rust1", since = "1.0.0")] pub trait IndexMut: Index { /// The method for the indexing (`Foo[Bar]`) operation - #[cfg(stage0)] - #[stable(feature = "rust1", since = "1.0.0")] - fn index_mut<'a>(&'a mut self, index: &Idx) -> &'a mut Self::Output; - - /// The method for the indexing (`Foo[Bar]`) operation - #[cfg(not(stage0))] #[stable(feature = "rust1", since = "1.0.0")] fn index_mut<'a>(&'a mut self, index: Idx) -> &'a mut Self::Output; } @@ -1149,20 +1137,6 @@ impl<'a, T: ?Sized> DerefMut for &'a mut T { #[lang="fn"] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_paren_sugar] -#[cfg(stage0)] -pub trait Fn { - /// The returned type after the call operator is used. - type Output; - - /// This is called when the call operator is used. - extern "rust-call" fn call(&self, args: Args) -> Self::Output; -} - -/// A version of the call operator that takes an immutable receiver. -#[lang="fn"] -#[stable(feature = "rust1", since = "1.0.0")] -#[rustc_paren_sugar] -#[cfg(not(stage0))] pub trait Fn : FnMut { /// This is called when the call operator is used. extern "rust-call" fn call(&self, args: Args) -> Self::Output; @@ -1172,20 +1146,6 @@ pub trait Fn : FnMut { #[lang="fn_mut"] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_paren_sugar] -#[cfg(stage0)] -pub trait FnMut { - /// The returned type after the call operator is used. - type Output; - - /// This is called when the call operator is used. - extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output; -} - -/// A version of the call operator that takes a mutable receiver. -#[lang="fn_mut"] -#[stable(feature = "rust1", since = "1.0.0")] -#[rustc_paren_sugar] -#[cfg(not(stage0))] pub trait FnMut : FnOnce { /// This is called when the call operator is used. extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output; @@ -1202,25 +1162,3 @@ pub trait FnOnce { /// This is called when the call operator is used. extern "rust-call" fn call_once(self, args: Args) -> Self::Output; } - -#[cfg(stage0)] -impl FnMut for F - where F : Fn -{ - type Output = >::Output; - - extern "rust-call" fn call_mut(&mut self, args: A) -> >::Output { - self.call(args) - } -} - -#[cfg(stage0)] -impl FnOnce for F - where F : FnMut -{ - type Output = >::Output; - - extern "rust-call" fn call_once(mut self, args: A) -> >::Output { - self.call_mut(args) - } -} diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index fce29abed7300..d5e8b4ce81e5c 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -263,18 +263,6 @@ impl SliceExt for [T] { #[inline] fn as_mut_slice(&mut self) -> &mut [T] { self } - #[cfg(stage0)] - #[inline] - fn split_at_mut(&mut self, mid: usize) -> (&mut [T], &mut [T]) { - unsafe { - let self2: &mut [T] = mem::transmute_copy(&self); - - (ops::IndexMut::index_mut(self, &ops::RangeTo { end: mid } ), - ops::IndexMut::index_mut(self2, &ops::RangeFrom { start: mid } )) - } - } - - #[cfg(not(stage0))] #[inline] fn split_at_mut(&mut self, mid: usize) -> (&mut [T], &mut [T]) { unsafe { @@ -507,14 +495,6 @@ impl SliceExt for [T] { impl ops::Index for [T] { type Output = T; - #[cfg(stage0)] - fn index(&self, &index: &usize) -> &T { - assert!(index < self.len()); - - unsafe { mem::transmute(self.repr().data.offset(index as isize)) } - } - - #[cfg(not(stage0))] fn index(&self, index: usize) -> &T { assert!(index < self.len()); @@ -524,15 +504,6 @@ impl ops::Index for [T] { #[stable(feature = "rust1", since = "1.0.0")] impl ops::IndexMut for [T] { - #[cfg(stage0)] - #[inline] - fn index_mut(&mut self, &index: &usize) -> &mut T { - assert!(index < self.len()); - - unsafe { mem::transmute(self.repr().data.offset(index as isize)) } - } - - #[cfg(not(stage0))] #[inline] fn index_mut(&mut self, index: usize) -> &mut T { assert!(index < self.len()); @@ -545,20 +516,6 @@ impl ops::IndexMut for [T] { impl ops::Index> for [T] { type Output = [T]; - #[cfg(stage0)] - #[inline] - fn index(&self, index: &ops::Range) -> &[T] { - assert!(index.start <= index.end); - assert!(index.end <= self.len()); - unsafe { - from_raw_parts ( - self.as_ptr().offset(index.start as isize), - index.end - index.start - ) - } - } - - #[cfg(not(stage0))] #[inline] fn index(&self, index: ops::Range) -> &[T] { assert!(index.start <= index.end); @@ -575,13 +532,6 @@ impl ops::Index> for [T] { impl ops::Index> for [T] { type Output = [T]; - #[cfg(stage0)] - #[inline] - fn index(&self, index: &ops::RangeTo) -> &[T] { - self.index(&ops::Range{ start: 0, end: index.end }) - } - - #[cfg(not(stage0))] #[inline] fn index(&self, index: ops::RangeTo) -> &[T] { self.index(ops::Range{ start: 0, end: index.end }) @@ -591,13 +541,6 @@ impl ops::Index> for [T] { impl ops::Index> for [T] { type Output = [T]; - #[cfg(stage0)] - #[inline] - fn index(&self, index: &ops::RangeFrom) -> &[T] { - self.index(&ops::Range{ start: index.start, end: self.len() }) - } - - #[cfg(not(stage0))] #[inline] fn index(&self, index: ops::RangeFrom) -> &[T] { self.index(ops::Range{ start: index.start, end: self.len() }) @@ -607,13 +550,6 @@ impl ops::Index> for [T] { impl ops::Index for [T] { type Output = [T]; - #[cfg(stage0)] - #[inline] - fn index(&self, _index: &RangeFull) -> &[T] { - self - } - - #[cfg(not(stage0))] #[inline] fn index(&self, _index: RangeFull) -> &[T] { self @@ -622,20 +558,6 @@ impl ops::Index for [T] { #[stable(feature = "rust1", since = "1.0.0")] impl ops::IndexMut> for [T] { - #[cfg(stage0)] - #[inline] - fn index_mut(&mut self, index: &ops::Range) -> &mut [T] { - assert!(index.start <= index.end); - assert!(index.end <= self.len()); - unsafe { - from_raw_parts_mut( - self.as_mut_ptr().offset(index.start as isize), - index.end - index.start - ) - } - } - - #[cfg(not(stage0))] #[inline] fn index_mut(&mut self, index: ops::Range) -> &mut [T] { assert!(index.start <= index.end); @@ -650,13 +572,6 @@ impl ops::IndexMut> for [T] { } #[stable(feature = "rust1", since = "1.0.0")] impl ops::IndexMut> for [T] { - #[cfg(stage0)] - #[inline] - fn index_mut(&mut self, index: &ops::RangeTo) -> &mut [T] { - self.index_mut(&ops::Range{ start: 0, end: index.end }) - } - - #[cfg(not(stage0))] #[inline] fn index_mut(&mut self, index: ops::RangeTo) -> &mut [T] { self.index_mut(ops::Range{ start: 0, end: index.end }) @@ -664,14 +579,6 @@ impl ops::IndexMut> for [T] { } #[stable(feature = "rust1", since = "1.0.0")] impl ops::IndexMut> for [T] { - #[cfg(stage0)] - #[inline] - fn index_mut(&mut self, index: &ops::RangeFrom) -> &mut [T] { - let len = self.len(); - self.index_mut(&ops::Range{ start: index.start, end: len }) - } - - #[cfg(not(stage0))] #[inline] fn index_mut(&mut self, index: ops::RangeFrom) -> &mut [T] { let len = self.len(); @@ -680,14 +587,6 @@ impl ops::IndexMut> for [T] { } #[stable(feature = "rust1", since = "1.0.0")] impl ops::IndexMut for [T] { - - #[cfg(stage0)] - #[inline] - fn index_mut(&mut self, _index: &RangeFull) -> &mut [T] { - self - } - - #[cfg(not(stage0))] #[inline] fn index_mut(&mut self, _index: RangeFull) -> &mut [T] { self @@ -875,13 +774,6 @@ unsafe impl<'a, T: Sync> Send for Iter<'a, T> {} impl<'a, T> ops::Index> for Iter<'a, T> { type Output = [T]; - #[cfg(stage0)] - #[inline] - fn index(&self, index: &ops::Range) -> &[T] { - self.as_slice().index(index) - } - - #[cfg(not(stage0))] #[inline] fn index(&self, index: ops::Range) -> &[T] { self.as_slice().index(index) @@ -892,13 +784,6 @@ impl<'a, T> ops::Index> for Iter<'a, T> { impl<'a, T> ops::Index> for Iter<'a, T> { type Output = [T]; - #[cfg(stage0)] - #[inline] - fn index(&self, index: &ops::RangeTo) -> &[T] { - self.as_slice().index(index) - } - - #[cfg(not(stage0))] #[inline] fn index(&self, index: ops::RangeTo) -> &[T] { self.as_slice().index(index) @@ -909,13 +794,6 @@ impl<'a, T> ops::Index> for Iter<'a, T> { impl<'a, T> ops::Index> for Iter<'a, T> { type Output = [T]; - #[cfg(stage0)] - #[inline] - fn index(&self, index: &ops::RangeFrom) -> &[T] { - self.as_slice().index(index) - } - - #[cfg(not(stage0))] #[inline] fn index(&self, index: ops::RangeFrom) -> &[T] { self.as_slice().index(index) @@ -926,13 +804,6 @@ impl<'a, T> ops::Index> for Iter<'a, T> { impl<'a, T> ops::Index for Iter<'a, T> { type Output = [T]; - #[cfg(stage0)] - #[inline] - fn index(&self, _index: &RangeFull) -> &[T] { - self.as_slice() - } - - #[cfg(not(stage0))] #[inline] fn index(&self, _index: RangeFull) -> &[T] { self.as_slice() @@ -1000,13 +871,6 @@ unsafe impl<'a, T: Send> Send for IterMut<'a, T> {} impl<'a, T> ops::Index> for IterMut<'a, T> { type Output = [T]; - #[cfg(stage0)] - #[inline] - fn index(&self, index: &ops::Range) -> &[T] { - self.index(&RangeFull).index(index) - } - - #[cfg(not(stage0))] #[inline] fn index(&self, index: ops::Range) -> &[T] { self.index(RangeFull).index(index) @@ -1016,13 +880,6 @@ impl<'a, T> ops::Index> for IterMut<'a, T> { impl<'a, T> ops::Index> for IterMut<'a, T> { type Output = [T]; - #[cfg(stage0)] - #[inline] - fn index(&self, index: &ops::RangeTo) -> &[T] { - self.index(&RangeFull).index(index) - } - - #[cfg(not(stage0))] #[inline] fn index(&self, index: ops::RangeTo) -> &[T] { self.index(RangeFull).index(index) @@ -1032,13 +889,6 @@ impl<'a, T> ops::Index> for IterMut<'a, T> { impl<'a, T> ops::Index> for IterMut<'a, T> { type Output = [T]; - #[cfg(stage0)] - #[inline] - fn index(&self, index: &ops::RangeFrom) -> &[T] { - self.index(&RangeFull).index(index) - } - - #[cfg(not(stage0))] #[inline] fn index(&self, index: ops::RangeFrom) -> &[T] { self.index(RangeFull).index(index) @@ -1048,13 +898,6 @@ impl<'a, T> ops::Index> for IterMut<'a, T> { impl<'a, T> ops::Index for IterMut<'a, T> { type Output = [T]; - #[cfg(stage0)] - #[inline] - fn index(&self, _index: &RangeFull) -> &[T] { - make_slice!(T => &[T]: self.ptr, self.end) - } - - #[cfg(not(stage0))] #[inline] fn index(&self, _index: RangeFull) -> &[T] { make_slice!(T => &[T]: self.ptr, self.end) @@ -1063,13 +906,6 @@ impl<'a, T> ops::Index for IterMut<'a, T> { #[unstable(feature = "core")] impl<'a, T> ops::IndexMut> for IterMut<'a, T> { - #[cfg(stage0)] - #[inline] - fn index_mut(&mut self, index: &ops::Range) -> &mut [T] { - self.index_mut(&RangeFull).index_mut(index) - } - - #[cfg(not(stage0))] #[inline] fn index_mut(&mut self, index: ops::Range) -> &mut [T] { self.index_mut(RangeFull).index_mut(index) @@ -1078,13 +914,6 @@ impl<'a, T> ops::IndexMut> for IterMut<'a, T> { #[unstable(feature = "core")] impl<'a, T> ops::IndexMut> for IterMut<'a, T> { - #[cfg(stage0)] - #[inline] - fn index_mut(&mut self, index: &ops::RangeTo) -> &mut [T] { - self.index_mut(&RangeFull).index_mut(index) - } - - #[cfg(not(stage0))] #[inline] fn index_mut(&mut self, index: ops::RangeTo) -> &mut [T] { self.index_mut(RangeFull).index_mut(index) @@ -1093,13 +922,6 @@ impl<'a, T> ops::IndexMut> for IterMut<'a, T> { #[unstable(feature = "core")] impl<'a, T> ops::IndexMut> for IterMut<'a, T> { - #[cfg(stage0)] - #[inline] - fn index_mut(&mut self, index: &ops::RangeFrom) -> &mut [T] { - self.index_mut(&RangeFull).index_mut(index) - } - - #[cfg(not(stage0))] #[inline] fn index_mut(&mut self, index: ops::RangeFrom) -> &mut [T] { self.index_mut(RangeFull).index_mut(index) @@ -1108,13 +930,6 @@ impl<'a, T> ops::IndexMut> for IterMut<'a, T> { #[unstable(feature = "core")] impl<'a, T> ops::IndexMut for IterMut<'a, T> { - #[cfg(stage0)] - #[inline] - fn index_mut(&mut self, _index: &RangeFull) -> &mut [T] { - make_mut_slice!(T => &mut [T]: self.ptr, self.end) - } - - #[cfg(not(stage0))] #[inline] fn index_mut(&mut self, _index: RangeFull) -> &mut [T] { make_mut_slice!(T => &mut [T]: self.ptr, self.end) diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index a629e0308e982..7fe3758ed9554 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -541,17 +541,6 @@ delegate_iter!{exact u8 : Bytes<'a>} #[derive(Copy, Clone)] struct BytesDeref; -#[cfg(stage0)] -impl<'a> Fn<(&'a u8,)> for BytesDeref { - type Output = u8; - - #[inline] - extern "rust-call" fn call(&self, (ptr,): (&'a u8,)) -> u8 { - *ptr - } -} - -#[cfg(not(stage0))] impl<'a> Fn<(&'a u8,)> for BytesDeref { #[inline] extern "rust-call" fn call(&self, (ptr,): (&'a u8,)) -> u8 { @@ -559,7 +548,6 @@ impl<'a> Fn<(&'a u8,)> for BytesDeref { } } -#[cfg(not(stage0))] impl<'a> FnMut<(&'a u8,)> for BytesDeref { #[inline] extern "rust-call" fn call_mut(&mut self, (ptr,): (&'a u8,)) -> u8 { @@ -567,7 +555,6 @@ impl<'a> FnMut<(&'a u8,)> for BytesDeref { } } -#[cfg(not(stage0))] impl<'a> FnOnce<(&'a u8,)> for BytesDeref { type Output = u8; @@ -1319,50 +1306,6 @@ mod traits { /// // byte 100 is outside the string /// // &s[3 .. 100]; /// ``` - #[cfg(stage0)] - #[stable(feature = "rust1", since = "1.0.0")] - impl ops::Index> for str { - type Output = str; - #[inline] - fn index(&self, index: &ops::Range) -> &str { - // is_char_boundary checks that the index is in [0, .len()] - if index.start <= index.end && - self.is_char_boundary(index.start) && - self.is_char_boundary(index.end) { - unsafe { self.slice_unchecked(index.start, index.end) } - } else { - super::slice_error_fail(self, index.start, index.end) - } - } - } - - /// Returns a slice of the given string from the byte range - /// [`begin`..`end`). - /// - /// This operation is `O(1)`. - /// - /// Panics when `begin` and `end` do not point to valid characters - /// or point beyond the last character of the string. - /// - /// # Examples - /// - /// ``` - /// let s = "Löwe 老虎 Léopard"; - /// assert_eq!(&s[0 .. 1], "L"); - /// - /// assert_eq!(&s[1 .. 9], "öwe 老"); - /// - /// // these will panic: - /// // byte 2 lies within `ö`: - /// // &s[2 ..3]; - /// - /// // byte 8 lies within `老` - /// // &s[1 .. 8]; - /// - /// // byte 100 is outside the string - /// // &s[3 .. 100]; - /// ``` - #[cfg(not(stage0))] #[stable(feature = "rust1", since = "1.0.0")] impl ops::Index> for str { type Output = str; @@ -1390,18 +1333,6 @@ mod traits { impl ops::Index> for str { type Output = str; - #[cfg(stage0)] - #[inline] - fn index(&self, index: &ops::RangeTo) -> &str { - // is_char_boundary checks that the index is in [0, .len()] - if self.is_char_boundary(index.end) { - unsafe { self.slice_unchecked(0, index.end) } - } else { - super::slice_error_fail(self, 0, index.end) - } - } - - #[cfg(not(stage0))] #[inline] fn index(&self, index: ops::RangeTo) -> &str { // is_char_boundary checks that the index is in [0, .len()] @@ -1423,18 +1354,6 @@ mod traits { impl ops::Index> for str { type Output = str; - #[cfg(stage0)] - #[inline] - fn index(&self, index: &ops::RangeFrom) -> &str { - // is_char_boundary checks that the index is in [0, .len()] - if self.is_char_boundary(index.start) { - unsafe { self.slice_unchecked(index.start, self.len()) } - } else { - super::slice_error_fail(self, index.start, self.len()) - } - } - - #[cfg(not(stage0))] #[inline] fn index(&self, index: ops::RangeFrom) -> &str { // is_char_boundary checks that the index is in [0, .len()] @@ -1450,13 +1369,6 @@ mod traits { impl ops::Index for str { type Output = str; - #[cfg(stage0)] - #[inline] - fn index(&self, _index: &ops::RangeFull) -> &str { - self - } - - #[cfg(not(stage0))] #[inline] fn index(&self, _index: ops::RangeFull) -> &str { self diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs index 89843979cd015..7174b2d2c29fe 100644 --- a/src/liblibc/lib.rs +++ b/src/liblibc/lib.rs @@ -76,7 +76,7 @@ #![allow(bad_style, raw_pointer_derive)] #![cfg_attr(target_os = "nacl", allow(unused_imports))] -#[cfg(feature = "cargo-build")] extern crate "std" as core; +#[cfg(feature = "cargo-build")] extern crate std as core; #[cfg(not(feature = "cargo-build"))] extern crate core; #[cfg(test)] extern crate std; diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index e8af07e438159..90d9324b9090c 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -65,7 +65,7 @@ extern crate collections; #[macro_use] extern crate syntax; #[macro_use] #[no_link] extern crate rustc_bitflags; -extern crate "serialize" as rustc_serialize; // used by deriving +extern crate serialize as rustc_serialize; // used by deriving #[cfg(test)] extern crate test; diff --git a/src/librustc_borrowck/lib.rs b/src/librustc_borrowck/lib.rs index e927ea5b86cdd..99f19ad711086 100644 --- a/src/librustc_borrowck/lib.rs +++ b/src/librustc_borrowck/lib.rs @@ -35,7 +35,7 @@ // for "clarity", rename the graphviz crate to dot; graphviz within `borrowck` // refers to the borrowck-specific graphviz adapter traits. -extern crate "graphviz" as dot; +extern crate graphviz as dot; extern crate rustc; pub use borrowck::check_crate; diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 5e6f2fb835bb2..c433aed4ae94a 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -55,7 +55,7 @@ extern crate rustc_resolve; extern crate rustc_trans; extern crate rustc_typeck; extern crate serialize; -extern crate "rustc_llvm" as llvm; +extern crate rustc_llvm as llvm; #[macro_use] extern crate log; #[macro_use] extern crate syntax; diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs index 99a64156d667b..83525dffaaeb7 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_trans/lib.rs @@ -54,7 +54,7 @@ extern crate libc; extern crate rustc; extern crate rustc_back; extern crate serialize; -extern crate "rustc_llvm" as llvm; +extern crate rustc_llvm as llvm; #[macro_use] extern crate log; #[macro_use] extern crate syntax; diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 9f1d876432c38..62c9199a0fa46 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -51,11 +51,11 @@ extern crate rustc_lint; extern crate rustc_back; extern crate serialize; extern crate syntax; -extern crate "test" as testing; +extern crate test as testing; extern crate unicode; #[macro_use] extern crate log; -extern crate "serialize" as rustc_serialize; // used by deriving +extern crate serialize as rustc_serialize; // used by deriving use std::cell::RefCell; use std::collections::HashMap; diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 0d6ed91d52981..d5f494d2ae98e 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -1218,16 +1218,6 @@ impl Json { } } -#[cfg(stage0)] -impl<'a> Index<&'a str> for Json { - type Output = Json; - - fn index(&self, idx: & &str) -> &Json { - self.find(*idx).unwrap() - } -} - -#[cfg(not(stage0))] impl<'a> Index<&'a str> for Json { type Output = Json; @@ -1236,19 +1226,6 @@ impl<'a> Index<&'a str> for Json { } } -#[cfg(stage0)] -impl Index for Json { - type Output = Json; - - fn index<'a>(&'a self, idx: &uint) -> &'a Json { - match self { - &Json::Array(ref v) => &v[*idx], - _ => panic!("can only index Json with uint if it is an array") - } - } -} - -#[cfg(not(stage0))] impl Index for Json { type Output = Json; diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index f9558b85825d2..91f53cb2987fb 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -1247,22 +1247,6 @@ impl Default for HashMap } } -#[cfg(stage0)] -#[stable(feature = "rust1", since = "1.0.0")] -impl Index for HashMap - where K: Eq + Hash + Borrow, - Q: Eq + Hash, - S: HashState, -{ - type Output = V; - - #[inline] - fn index<'a>(&'a self, index: &Q) -> &'a V { - self.get(index).expect("no entry found for key") - } -} - -#[cfg(not(stage0))] #[stable(feature = "rust1", since = "1.0.0")] impl<'a, K, Q: ?Sized, V, S> Index<&'a Q> for HashMap where K: Eq + Hash + Borrow, diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index 5851c6e299809..99cbd26bcd1a8 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -133,18 +133,6 @@ impl<'a> From<&'a OsStr> for OsString { } } -#[cfg(stage0)] -#[stable(feature = "rust1", since = "1.0.0")] -impl ops::Index for OsString { - type Output = OsStr; - - #[inline] - fn index(&self, _index: &ops::RangeFull) -> &OsStr { - unsafe { mem::transmute(self.inner.as_slice()) } - } -} - -#[cfg(not(stage0))] #[stable(feature = "rust1", since = "1.0.0")] impl ops::Index for OsString { type Output = OsStr; diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index cca6bb747d43c..7eb575a3a689b 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -149,9 +149,9 @@ extern crate core; #[macro_use] #[macro_reexport(vec, format)] -extern crate "collections" as core_collections; +extern crate collections as core_collections; -#[allow(deprecated)] extern crate "rand" as core_rand; +#[allow(deprecated)] extern crate rand as core_rand; extern crate alloc; extern crate unicode; extern crate libc; @@ -159,7 +159,7 @@ extern crate libc; #[macro_use] #[no_link] extern crate rustc_bitflags; // Make std testable by not duplicating lang items. See #2912 -#[cfg(test)] extern crate "std" as realstd; +#[cfg(test)] extern crate std as realstd; #[cfg(test)] pub use realstd::marker; #[cfg(test)] pub use realstd::ops; #[cfg(test)] pub use realstd::cmp; diff --git a/src/libstd/old_io/mem.rs b/src/libstd/old_io/mem.rs index d877a60b079d7..298085806bdec 100644 --- a/src/libstd/old_io/mem.rs +++ b/src/libstd/old_io/mem.rs @@ -397,7 +397,7 @@ impl<'a> Buffer for BufReader<'a> { #[cfg(test)] mod test { - extern crate "test" as test_crate; + extern crate test as test_crate; use old_io::{SeekSet, SeekCur, SeekEnd, Reader, Writer, Seek, Buffer}; use prelude::v1::{Ok, Err, Vec, AsSlice}; use prelude::v1::IteratorExt; diff --git a/src/libstd/sys/common/wtf8.rs b/src/libstd/sys/common/wtf8.rs index 9f3dae34c7a4b..0d83e4497f7e2 100644 --- a/src/libstd/sys/common/wtf8.rs +++ b/src/libstd/sys/common/wtf8.rs @@ -634,30 +634,6 @@ impl Wtf8 { /// /// Panics when `begin` and `end` do not point to code point boundaries, /// or point beyond the end of the string. -#[cfg(stage0)] -impl ops::Index> for Wtf8 { - type Output = Wtf8; - - #[inline] - fn index(&self, range: &ops::Range) -> &Wtf8 { - // is_code_point_boundary checks that the index is in [0, .len()] - if range.start <= range.end && - is_code_point_boundary(self, range.start) && - is_code_point_boundary(self, range.end) { - unsafe { slice_unchecked(self, range.start, range.end) } - } else { - slice_error_fail(self, range.start, range.end) - } - } -} - -/// Return a slice of the given string for the byte range [`begin`..`end`). -/// -/// # Panics -/// -/// Panics when `begin` and `end` do not point to code point boundaries, -/// or point beyond the end of the string. -#[cfg(not(stage0))] impl ops::Index> for Wtf8 { type Output = Wtf8; @@ -680,28 +656,6 @@ impl ops::Index> for Wtf8 { /// /// Panics when `begin` is not at a code point boundary, /// or is beyond the end of the string. -#[cfg(stage0)] -impl ops::Index> for Wtf8 { - type Output = Wtf8; - - #[inline] - fn index(&self, range: &ops::RangeFrom) -> &Wtf8 { - // is_code_point_boundary checks that the index is in [0, .len()] - if is_code_point_boundary(self, range.start) { - unsafe { slice_unchecked(self, range.start, self.len()) } - } else { - slice_error_fail(self, range.start, self.len()) - } - } -} - -/// Return a slice of the given string from byte `begin` to its end. -/// -/// # Panics -/// -/// Panics when `begin` is not at a code point boundary, -/// or is beyond the end of the string. -#[cfg(not(stage0))] impl ops::Index> for Wtf8 { type Output = Wtf8; @@ -722,28 +676,6 @@ impl ops::Index> for Wtf8 { /// /// Panics when `end` is not at a code point boundary, /// or is beyond the end of the string. -#[cfg(stage0)] -impl ops::Index> for Wtf8 { - type Output = Wtf8; - - #[inline] - fn index(&self, range: &ops::RangeTo) -> &Wtf8 { - // is_code_point_boundary checks that the index is in [0, .len()] - if is_code_point_boundary(self, range.end) { - unsafe { slice_unchecked(self, 0, range.end) } - } else { - slice_error_fail(self, 0, range.end) - } - } -} - -/// Return a slice of the given string from its beginning to byte `end`. -/// -/// # Panics -/// -/// Panics when `end` is not at a code point boundary, -/// or is beyond the end of the string. -#[cfg(not(stage0))] impl ops::Index> for Wtf8 { type Output = Wtf8; @@ -758,17 +690,6 @@ impl ops::Index> for Wtf8 { } } -#[cfg(stage0)] -impl ops::Index for Wtf8 { - type Output = Wtf8; - - #[inline] - fn index(&self, _range: &ops::RangeFull) -> &Wtf8 { - self - } -} - -#[cfg(not(stage0))] impl ops::Index for Wtf8 { type Output = Wtf8; diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 9af7b9ab63311..79132b2e54321 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -50,7 +50,7 @@ extern crate libc; #[macro_use] extern crate log; #[macro_use] #[no_link] extern crate rustc_bitflags; -extern crate "serialize" as rustc_serialize; // used by deriving +extern crate serialize as rustc_serialize; // used by deriving pub mod util { pub mod interner; diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index c48c7e413d03b..3e26a68d5909e 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -50,7 +50,7 @@ extern crate getopts; extern crate serialize; -extern crate "serialize" as rustc_serialize; +extern crate serialize as rustc_serialize; extern crate term; extern crate libc; diff --git a/src/libunicode/char.rs b/src/libunicode/char.rs index db5a25b9bedca..2aeade5066fde 100644 --- a/src/libunicode/char.rs +++ b/src/libunicode/char.rs @@ -41,430 +41,6 @@ pub use normalize::{decompose_canonical, decompose_compatible, compose}; pub use tables::normalization::canonical_combining_class; pub use tables::UNICODE_VERSION; -#[cfg(stage0)] -/// Functionality for manipulating `char`. -#[stable(feature = "rust1", since = "1.0.0")] -pub trait CharExt { - /// Checks if a `char` parses as a numeric digit in the given radix. - /// - /// Compared to `is_numeric()`, this function only recognizes the characters - /// `0-9`, `a-z` and `A-Z`. - /// - /// # Return value - /// - /// Returns `true` if `c` is a valid digit under `radix`, and `false` - /// otherwise. - /// - /// # Panics - /// - /// Panics if given a radix > 36. - /// - /// # Examples - /// - /// ``` - /// let c = '1'; - /// - /// assert!(c.is_digit(10)); - /// - /// assert!('f'.is_digit(16)); - /// ``` - #[stable(feature = "rust1", since = "1.0.0")] - fn is_digit(self, radix: u32) -> bool; - - /// Converts a character to the corresponding digit. - /// - /// # Return value - /// - /// If `c` is between '0' and '9', the corresponding value between 0 and - /// 9. If `c` is 'a' or 'A', 10. If `c` is 'b' or 'B', 11, etc. Returns - /// none if the character does not refer to a digit in the given radix. - /// - /// # Panics - /// - /// Panics if given a radix outside the range [0..36]. - /// - /// # Examples - /// - /// ``` - /// let c = '1'; - /// - /// assert_eq!(c.to_digit(10), Some(1)); - /// - /// assert_eq!('f'.to_digit(16), Some(15)); - /// ``` - #[stable(feature = "rust1", since = "1.0.0")] - fn to_digit(self, radix: u32) -> Option; - - /// Returns an iterator that yields the hexadecimal Unicode escape of a - /// character, as `char`s. - /// - /// All characters are escaped with Rust syntax of the form `\\u{NNNN}` - /// where `NNNN` is the shortest hexadecimal representation of the code - /// point. - /// - /// # Examples - /// - /// ``` - /// for i in '❤'.escape_unicode() { - /// println!("{}", i); - /// } - /// ``` - /// - /// This prints: - /// - /// ```text - /// \ - /// u - /// { - /// 2 - /// 7 - /// 6 - /// 4 - /// } - /// ``` - /// - /// Collecting into a `String`: - /// - /// ``` - /// let heart: String = '❤'.escape_unicode().collect(); - /// - /// assert_eq!(heart, r"\u{2764}"); - /// ``` - #[stable(feature = "rust1", since = "1.0.0")] - fn escape_unicode(self) -> EscapeUnicode; - - /// Returns an iterator that yields the 'default' ASCII and - /// C++11-like literal escape of a character, as `char`s. - /// - /// The default is chosen with a bias toward producing literals that are - /// legal in a variety of languages, including C++11 and similar C-family - /// languages. The exact rules are: - /// - /// * Tab, CR and LF are escaped as '\t', '\r' and '\n' respectively. - /// * Single-quote, double-quote and backslash chars are backslash- - /// escaped. - /// * Any other chars in the range [0x20,0x7e] are not escaped. - /// * Any other chars are given hex Unicode escapes; see `escape_unicode`. - /// - /// # Examples - /// - /// ``` - /// for i in '"'.escape_default() { - /// println!("{}", i); - /// } - /// ``` - /// - /// This prints: - /// - /// ```text - /// \ - /// " - /// ``` - /// - /// Collecting into a `String`: - /// - /// ``` - /// let quote: String = '"'.escape_default().collect(); - /// - /// assert_eq!(quote, "\\\""); - /// ``` - #[stable(feature = "rust1", since = "1.0.0")] - fn escape_default(self) -> EscapeDefault; - - /// Returns the number of bytes this character would need if encoded in - /// UTF-8. - /// - /// # Examples - /// - /// ``` - /// let n = 'ß'.len_utf8(); - /// - /// assert_eq!(n, 2); - /// ``` - #[stable(feature = "rust1", since = "1.0.0")] - fn len_utf8(self) -> usize; - - /// Returns the number of 16-bit code units this character would need if - /// encoded in UTF-16. - /// - /// # Examples - /// - /// ``` - /// let n = 'ß'.len_utf16(); - /// - /// assert_eq!(n, 1); - /// ``` - #[stable(feature = "rust1", since = "1.0.0")] - fn len_utf16(self) -> usize; - - /// Encodes this character as UTF-8 into the provided byte buffer, and then - /// returns the number of bytes written. - /// - /// If the buffer is not large enough, nothing will be written into it and a - /// `None` will be returned. A buffer of length four is large enough to - /// encode any `char`. - /// - /// # Examples - /// - /// In both of these examples, 'ß' takes two bytes to encode. - /// - /// ``` - /// # #![feature(unicode)] - /// let mut b = [0; 2]; - /// - /// let result = 'ß'.encode_utf8(&mut b); - /// - /// assert_eq!(result, Some(2)); - /// ``` - /// - /// A buffer that's too small: - /// - /// ``` - /// # #![feature(unicode)] - /// let mut b = [0; 1]; - /// - /// let result = 'ß'.encode_utf8(&mut b); - /// - /// assert_eq!(result, None); - /// ``` - #[unstable(feature = "unicode", - reason = "pending decision about Iterator/Writer/Reader")] - fn encode_utf8(self, dst: &mut [u8]) -> Option; - - /// Encodes this character as UTF-16 into the provided `u16` buffer, and - /// then returns the number of `u16`s written. - /// - /// If the buffer is not large enough, nothing will be written into it and a - /// `None` will be returned. A buffer of length 2 is large enough to encode - /// any `char`. - /// - /// # Examples - /// - /// In both of these examples, 'ß' takes one `u16` to encode. - /// - /// ``` - /// # #![feature(unicode)] - /// let mut b = [0; 1]; - /// - /// let result = 'ß'.encode_utf16(&mut b); - /// - /// assert_eq!(result, Some(1)); - /// ``` - /// - /// A buffer that's too small: - /// - /// ``` - /// # #![feature(unicode)] - /// let mut b = [0; 0]; - /// - /// let result = 'ß'.encode_utf8(&mut b); - /// - /// assert_eq!(result, None); - /// ``` - #[unstable(feature = "unicode", - reason = "pending decision about Iterator/Writer/Reader")] - fn encode_utf16(self, dst: &mut [u16]) -> Option; - - /// Returns whether the specified character is considered a Unicode - /// alphabetic code point. - #[stable(feature = "rust1", since = "1.0.0")] - fn is_alphabetic(self) -> bool; - - /// Returns whether the specified character satisfies the 'XID_Start' - /// Unicode property. - /// - /// 'XID_Start' is a Unicode Derived Property specified in - /// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications), - /// mostly similar to ID_Start but modified for closure under NFKx. - #[unstable(feature = "unicode", - reason = "mainly needed for compiler internals")] - fn is_xid_start(self) -> bool; - - /// Returns whether the specified `char` satisfies the 'XID_Continue' - /// Unicode property. - /// - /// 'XID_Continue' is a Unicode Derived Property specified in - /// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications), - /// mostly similar to 'ID_Continue' but modified for closure under NFKx. - #[unstable(feature = "unicode", - reason = "mainly needed for compiler internals")] - fn is_xid_continue(self) -> bool; - - /// Indicates whether a character is in lowercase. - /// - /// This is defined according to the terms of the Unicode Derived Core - /// Property `Lowercase`. - #[stable(feature = "rust1", since = "1.0.0")] - fn is_lowercase(self) -> bool; - - /// Indicates whether a character is in uppercase. - /// - /// This is defined according to the terms of the Unicode Derived Core - /// Property `Uppercase`. - #[stable(feature = "rust1", since = "1.0.0")] - fn is_uppercase(self) -> bool; - - /// Indicates whether a character is whitespace. - /// - /// Whitespace is defined in terms of the Unicode Property `White_Space`. - #[stable(feature = "rust1", since = "1.0.0")] - fn is_whitespace(self) -> bool; - - /// Indicates whether a character is alphanumeric. - /// - /// Alphanumericness is defined in terms of the Unicode General Categories - /// 'Nd', 'Nl', 'No' and the Derived Core Property 'Alphabetic'. - #[stable(feature = "rust1", since = "1.0.0")] - fn is_alphanumeric(self) -> bool; - - /// Indicates whether a character is a control code point. - /// - /// Control code points are defined in terms of the Unicode General - /// Category `Cc`. - #[stable(feature = "rust1", since = "1.0.0")] - fn is_control(self) -> bool; - - /// Indicates whether the character is numeric (Nd, Nl, or No). - #[stable(feature = "rust1", since = "1.0.0")] - fn is_numeric(self) -> bool; - - /// Converts a character to its lowercase equivalent. - /// - /// The case-folding performed is the common or simple mapping. See - /// `to_uppercase()` for references and more information. - /// - /// # Return value - /// - /// Returns an iterator which yields the characters corresponding to the - /// lowercase equivalent of the character. If no conversion is possible then - /// the input character is returned. - #[stable(feature = "rust1", since = "1.0.0")] - fn to_lowercase(self) -> ToLowercase; - - /// Converts a character to its uppercase equivalent. - /// - /// The case-folding performed is the common or simple mapping: it maps - /// one Unicode codepoint to its uppercase equivalent according to the - /// Unicode database [1]. The additional [`SpecialCasing.txt`] is not yet - /// considered here, but the iterator returned will soon support this form - /// of case folding. - /// - /// A full reference can be found here [2]. - /// - /// # Return value - /// - /// Returns an iterator which yields the characters corresponding to the - /// uppercase equivalent of the character. If no conversion is possible then - /// the input character is returned. - /// - /// [1]: ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt - /// - /// [`SpecialCasing`.txt`]: ftp://ftp.unicode.org/Public/UNIDATA/SpecialCasing.txt - /// - /// [2]: http://www.unicode.org/versions/Unicode4.0.0/ch03.pdf#G33992 - #[stable(feature = "rust1", since = "1.0.0")] - fn to_uppercase(self) -> ToUppercase; - - /// Returns this character's displayed width in columns, or `None` if it is a - /// control character other than `'\x00'`. - /// - /// `is_cjk` determines behavior for characters in the Ambiguous category: - /// if `is_cjk` is `true`, these are 2 columns wide; otherwise, they are 1. - /// In CJK contexts, `is_cjk` should be `true`, else it should be `false`. - /// [Unicode Standard Annex #11](http://www.unicode.org/reports/tr11/) - /// recommends that these characters be treated as 1 column (i.e., - /// `is_cjk` = `false`) if the context cannot be reliably determined. - #[unstable(feature = "unicode", - reason = "needs expert opinion. is_cjk flag stands out as ugly")] - fn width(self, is_cjk: bool) -> Option; -} - -#[cfg(stage0)] -#[stable(feature = "rust1", since = "1.0.0")] -impl CharExt for char { - #[inline] - fn is_digit(self, radix: u32) -> bool { C::is_digit(self, radix) } - fn to_digit(self, radix: u32) -> Option { C::to_digit(self, radix) } - fn escape_unicode(self) -> EscapeUnicode { C::escape_unicode(self) } - fn escape_default(self) -> EscapeDefault { C::escape_default(self) } - fn len_utf8(self) -> usize { C::len_utf8(self) } - fn len_utf16(self) -> usize { C::len_utf16(self) } - fn encode_utf8(self, dst: &mut [u8]) -> Option { C::encode_utf8(self, dst) } - fn encode_utf16(self, dst: &mut [u16]) -> Option { C::encode_utf16(self, dst) } - - #[inline] - fn is_alphabetic(self) -> bool { - match self { - 'a' ... 'z' | 'A' ... 'Z' => true, - c if c > '\x7f' => derived_property::Alphabetic(c), - _ => false - } - } - - #[inline] - fn is_xid_start(self) -> bool { derived_property::XID_Start(self) } - - #[inline] - fn is_xid_continue(self) -> bool { derived_property::XID_Continue(self) } - - #[inline] - fn is_lowercase(self) -> bool { - match self { - 'a' ... 'z' => true, - c if c > '\x7f' => derived_property::Lowercase(c), - _ => false - } - } - - #[inline] - fn is_uppercase(self) -> bool { - match self { - 'A' ... 'Z' => true, - c if c > '\x7f' => derived_property::Uppercase(c), - _ => false - } - } - - #[inline] - fn is_whitespace(self) -> bool { - match self { - ' ' | '\x09' ... '\x0d' => true, - c if c > '\x7f' => property::White_Space(c), - _ => false - } - } - - #[inline] - fn is_alphanumeric(self) -> bool { - self.is_alphabetic() || self.is_numeric() - } - - #[inline] - fn is_control(self) -> bool { general_category::Cc(self) } - - #[inline] - fn is_numeric(self) -> bool { - match self { - '0' ... '9' => true, - c if c > '\x7f' => general_category::N(c), - _ => false - } - } - - #[inline] - fn to_lowercase(self) -> ToLowercase { - ToLowercase(Some(conversions::to_lower(self))) - } - - #[inline] - fn to_uppercase(self) -> ToUppercase { - ToUppercase(Some(conversions::to_upper(self))) - } - - #[inline] - fn width(self, is_cjk: bool) -> Option { charwidth::width(self, is_cjk) } -} - /// An iterator over the lowercase mapping of a given character, returned from /// the [`to_lowercase` method](../primitive.char.html#method.to_lowercase) on /// characters. diff --git a/src/snapshots.txt b/src/snapshots.txt index 141ddba7db620..8b05f7c895527 100644 --- a/src/snapshots.txt +++ b/src/snapshots.txt @@ -1,3 +1,13 @@ +S 2015-03-25 a923278 + bitrig-x86_64 41de2c7a69a1ac648d3fa3b65e96a29bdc122163 + freebsd-x86_64 cd02c86a9218da73b2a45aff293787010d33bf3e + linux-i386 da50141558eed6dabab97b79b2c6a7de4f2d2c5e + linux-x86_64 bca03458d28d07506bad4b80e5770b2117286244 + macos-i386 522d59b23dd885a45e2c5b33e80e76240bb2d9af + macos-x86_64 82df09d51d73d119a2f4e4d8041879615cb22081 + winnt-i386 5056e8def5ab4f4283b8f3aab160cc10231bb28d + winnt-x86_64 3f6b35ac12625b4b4b42dfd5eee5f6cbf122794e + S 2015-03-17 c64d671 bitrig-x86_64 41de2c7a69a1ac648d3fa3b65e96a29bdc122163 freebsd-x86_64 14ced24e1339a4dd8baa9db69995daa52a948d54 diff --git a/src/test/compile-fail/borrowck-overloaded-index-autoderef.rs b/src/test/compile-fail/borrowck-overloaded-index-autoderef.rs index 55a6e2ac7b8d6..b726c46d5d533 100644 --- a/src/test/compile-fail/borrowck-overloaded-index-autoderef.rs +++ b/src/test/compile-fail/borrowck-overloaded-index-autoderef.rs @@ -18,19 +18,6 @@ struct Foo { y: isize, } -#[cfg(stage0)] -impl Index for Foo { - type Output = isize; - - fn index<'a>(&'a self, z: &String) -> &'a isize { - if *z == "x" { - &self.x - } else { - &self.y - } - } -} - impl<'a> Index<&'a String> for Foo { type Output = isize;