diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2014-09-26 17:48:16 +1200 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2014-10-02 13:23:36 +1300 |
| commit | 95cfc35607ccf5f02f02de56a35a9ef50fa23a82 (patch) | |
| tree | 85cb0f79ec42469ac7203cdcc09ffee5247cded7 /src/libcore | |
| parent | df2f1fa7680a86ba228f004e7de731e91a1df1fe (diff) | |
| download | rust-95cfc35607ccf5f02f02de56a35a9ef50fa23a82.tar.gz rust-95cfc35607ccf5f02f02de56a35a9ef50fa23a82.zip | |
Put slicing syntax behind a feature gate.
[breaking-change] If you are using slicing syntax you will need to add #![feature(slicing_syntax)] to your crate.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/lib.rs | 3 | ||||
| -rw-r--r-- | src/libcore/ops.rs | 6 | ||||
| -rw-r--r-- | src/libcore/slice.rs | 4 |
3 files changed, 7 insertions, 6 deletions
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 7e2ea492d4c..4890dc2bb73 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -57,8 +57,9 @@ html_playground_url = "http://play.rust-lang.org/")] #![no_std] +#![allow(unknown_features)] #![feature(globs, intrinsics, lang_items, macro_rules, managed_boxes, phase)] -#![feature(simd, unsafe_destructor)] +#![feature(simd, unsafe_destructor, slicing_syntax)] #![deny(missing_doc)] mod macros; diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs index 77cee2b9863..422c496995b 100644 --- a/src/libcore/ops.rs +++ b/src/libcore/ops.rs @@ -684,7 +684,7 @@ pub trait IndexMut<Index, Result> { * A trivial implementation of `Slice`. When `Foo[..Foo]` happens, it ends up * calling `slice_to`, and therefore, `main` prints `Slicing!`. * - * ``` + * ```ignore * struct Foo; * * impl ::core::ops::Slice<Foo, Foo> for Foo { @@ -749,7 +749,7 @@ pub trait Slice<Idx, Sized? Result> for Sized? { * A trivial implementation of `SliceMut`. When `Foo[Foo..]` happens, it ends up * calling `slice_from_mut`, and therefore, `main` prints `Slicing!`. * - * ``` + * ```ignore * struct Foo; * * impl ::core::ops::SliceMut<Foo, Foo> for Foo { @@ -771,7 +771,7 @@ pub trait Slice<Idx, Sized? Result> for Sized? { * } * } * - * fn main() { + * pub fn main() { * Foo[mut Foo..]; * } * ``` diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index 68b3a3199df..2ff0fd2ef00 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -814,13 +814,13 @@ impl<'a,T> MutableSlice<'a, T> for &'a mut [T] { #[inline] fn tail_mut(self) -> &'a mut [T] { let len = self.len(); - self.slice_mut(1, len) + self[mut 1..len] } #[inline] fn init_mut(self) -> &'a mut [T] { let len = self.len(); - self.slice_mut(0, len - 1) + self[mut 0..len - 1] } #[inline] |
