about summary refs log tree commit diff
path: root/src/libcollections
diff options
context:
space:
mode:
authorNick Cameron <ncameron@mozilla.com>2014-09-26 17:48:16 +1200
committerNick Cameron <ncameron@mozilla.com>2014-10-02 13:23:36 +1300
commit95cfc35607ccf5f02f02de56a35a9ef50fa23a82 (patch)
tree85cb0f79ec42469ac7203cdcc09ffee5247cded7 /src/libcollections
parentdf2f1fa7680a86ba228f004e7de731e91a1df1fe (diff)
downloadrust-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/libcollections')
-rw-r--r--src/libcollections/lib.rs3
-rw-r--r--src/libcollections/slice.rs9
-rw-r--r--src/libcollections/string.rs4
3 files changed, 10 insertions, 6 deletions
diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs
index 8b9a0ec796e..4d0aaf83907 100644
--- a/src/libcollections/lib.rs
+++ b/src/libcollections/lib.rs
@@ -19,8 +19,9 @@
        html_root_url = "http://doc.rust-lang.org/master/",
        html_playground_url = "http://play.rust-lang.org/")]
 
+#![allow(unknown_features)]
 #![feature(macro_rules, managed_boxes, default_type_params, phase, globs)]
-#![feature(unsafe_destructor, import_shadowing)]
+#![feature(unsafe_destructor, import_shadowing, slicing_syntax)]
 #![no_std]
 
 #[phase(plugin, link)] extern crate core;
diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs
index 9cd01617916..60692ceb401 100644
--- a/src/libcollections/slice.rs
+++ b/src/libcollections/slice.rs
@@ -51,9 +51,12 @@
 //! interval `[a, b)`:
 //!
 //! ```rust
-//! let numbers = [0i, 1i, 2i];
-//! let last_numbers = numbers[1..3];
-//! // last_numbers is now &[1i, 2i]
+//! #![feature(slicing_syntax)]
+//! fn main() {
+//!     let numbers = [0i, 1i, 2i];
+//!     let last_numbers = numbers[1..3];
+//!     // last_numbers is now &[1i, 2i]
+//! }
 //! ```
 //!
 //! ## Implementations of other traits
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs
index 31bd377a8de..206e392f664 100644
--- a/src/libcollections/string.rs
+++ b/src/libcollections/string.rs
@@ -160,7 +160,7 @@ impl String {
 
         if i > 0 {
             unsafe {
-                res.as_mut_vec().push_all(v.[..i])
+                res.as_mut_vec().push_all(v[..i])
             };
         }
 
@@ -177,7 +177,7 @@ impl String {
             macro_rules! error(() => ({
                 unsafe {
                     if subseqidx != i_ {
-                        res.as_mut_vec().push_all(vv[subseqidx..i_]);
+                        res.as_mut_vec().push_all(v[subseqidx..i_]);
                     }
                     subseqidx = i;
                     res.as_mut_vec().push_all(REPLACEMENT);