From 2d3823441fe5324f747f7bf51ffc07b9434f827f Mon Sep 17 00:00:00 2001 From: Nick Cameron Date: Fri, 26 Sep 2014 17:48:16 +1200 Subject: [PATCH] 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. --- src/compiletest/compiletest.rs | 2 +- src/doc/reference.md | 2 +- src/libcollections/lib.rs | 3 +- src/libcollections/slice.rs | 9 +++-- src/libcore/lib.rs | 3 +- src/libcore/ops.rs | 6 ++-- src/libcoretest/lib.rs | 2 +- src/libnative/lib.rs | 3 +- src/libnum/lib.rs | 3 +- src/librbml/lib.rs | 3 +- src/libregex/lib.rs | 3 +- src/librustc/lib.rs | 3 +- src/librustc_back/lib.rs | 3 +- src/librustdoc/lib.rs | 3 +- src/librustrt/lib.rs | 3 +- src/libserialize/lib.rs | 3 +- src/libstd/io/net/udp.rs | 33 ++++++++++--------- src/libstd/lib.rs | 3 +- src/libsyntax/feature_gate.rs | 6 ++++ src/libsyntax/lib.rs | 3 +- src/libterm/lib.rs | 3 +- src/test/bench/shootout-fannkuch-redux.rs | 2 ++ src/test/bench/shootout-fasta-redux.rs | 2 ++ src/test/bench/shootout-fasta.rs | 2 ++ src/test/bench/shootout-k-nucleotide-pipes.rs | 2 ++ src/test/bench/shootout-k-nucleotide.rs | 2 ++ src/test/bench/shootout-regex-dna.rs | 2 +- src/test/bench/shootout-reverse-complement.rs | 2 ++ src/test/compile-fail/issue-15730.rs | 2 ++ src/test/compile-fail/slice-2.rs | 2 ++ src/test/compile-fail/slice-borrow.rs | 2 ++ src/test/compile-fail/slice-mut-2.rs | 2 ++ src/test/compile-fail/slice-mut.rs | 2 ++ src/test/debuginfo/vec-slices.rs | 1 + src/test/run-pass/issue-3888-2.rs | 2 ++ src/test/run-pass/issue-4464.rs | 2 ++ src/test/run-pass/issue-8898.rs | 1 + src/test/run-pass/slice-2.rs | 2 ++ src/test/run-pass/slice-fail-1.rs | 2 ++ src/test/run-pass/slice-fail-2.rs | 2 ++ src/test/run-pass/slice.rs | 2 ++ 41 files changed, 101 insertions(+), 39 deletions(-) diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index 0a486ef0305..1e5e3ebdb34 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -9,7 +9,7 @@ // except according to those terms. #![crate_type = "bin"] -#![feature(phase)] +#![feature(phase, slicing_syntax)] #![deny(warnings)] diff --git a/src/doc/reference.md b/src/doc/reference.md index 9a02a3b815e..a9e247ab93b 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -3837,7 +3837,7 @@ type signature of `print`, and the cast expression in `main`. Within the body of an item that has type parameter declarations, the names of its type parameters are types: -``` +```ignore fn map(f: |A| -> B, xs: &[A]) -> Vec { if xs.len() == 0 { return vec![]; diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index 64369855ef8..b74324c85c0 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, 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 2ea1b2607ff..253375aabe8 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -52,9 +52,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/libcore/lib.rs b/src/libcore/lib.rs index 93c6f5bed85..584d09c75c8 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, 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 ad0f128a02e..e7b62e020a3 100644 --- a/src/libcore/ops.rs +++ b/src/libcore/ops.rs @@ -684,7 +684,7 @@ pub trait IndexMut { * 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 for Foo { @@ -734,7 +734,7 @@ pub trait Slice 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 for Foo { @@ -756,7 +756,7 @@ pub trait Slice for Sized? { * } * } * - * fn main() { + * pub fn main() { * Foo[mut Foo..]; * } * ``` diff --git a/src/libcoretest/lib.rs b/src/libcoretest/lib.rs index 7866d2f4a11..5f31ed35f1b 100644 --- a/src/libcoretest/lib.rs +++ b/src/libcoretest/lib.rs @@ -7,7 +7,7 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(globs, unsafe_destructor, macro_rules)] +#![feature(globs, unsafe_destructor, macro_rules, slicing_syntax)] extern crate core; extern crate test; diff --git a/src/libnative/lib.rs b/src/libnative/lib.rs index 267ff3d2a81..5def99d8ef3 100644 --- a/src/libnative/lib.rs +++ b/src/libnative/lib.rs @@ -57,7 +57,8 @@ #![deny(unused_result, unused_must_use)] #![allow(non_camel_case_types, deprecated)] -#![feature(default_type_params, lang_items)] +#![allow(unknown_features)] +#![feature(default_type_params, lang_items, slicing_syntax)] // NB this crate explicitly does *not* allow glob imports, please seriously // consider whether they're needed before adding that feature here (the diff --git a/src/libnum/lib.rs b/src/libnum/lib.rs index 17071d22dee..fa41cf37112 100644 --- a/src/libnum/lib.rs +++ b/src/libnum/lib.rs @@ -43,7 +43,8 @@ //! //! [newt]: https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method -#![feature(macro_rules)] +#![allow(unknown_features)] +#![feature(macro_rules, slicing_syntax)] #![feature(default_type_params)] #![crate_name = "num"] diff --git a/src/librbml/lib.rs b/src/librbml/lib.rs index fa327fb3b4c..7480cf320cf 100644 --- a/src/librbml/lib.rs +++ b/src/librbml/lib.rs @@ -24,7 +24,8 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/master/", html_playground_url = "http://play.rust-lang.org/")] -#![feature(macro_rules, phase)] +#![allow(unknown_features)] +#![feature(macro_rules, phase, slicing_syntax)] #![allow(missing_doc)] extern crate serialize; diff --git a/src/libregex/lib.rs b/src/libregex/lib.rs index 9ff65fe3e2a..fdfd8c1eae2 100644 --- a/src/libregex/lib.rs +++ b/src/libregex/lib.rs @@ -368,7 +368,8 @@ html_root_url = "http://doc.rust-lang.org/master/", html_playground_url = "http://play.rust-lang.org/")] -#![feature(macro_rules, phase)] +#![allow(unknown_features)] +#![feature(macro_rules, phase, slicing_syntax)] #![deny(missing_doc)] #[cfg(test)] diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index b807be422be..e38f1f24f01 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -29,8 +29,9 @@ This API is completely unstable and subject to change. html_root_url = "http://doc.rust-lang.org/master/")] #![allow(deprecated)] +#![allow(unknown_features)] #![feature(macro_rules, globs, struct_variant, quote)] -#![feature(default_type_params, phase, unsafe_destructor)] +#![feature(default_type_params, phase, unsafe_destructor, slicing_syntax)] #![feature(rustc_diagnostic_macros)] #![feature(import_shadowing)] diff --git a/src/librustc_back/lib.rs b/src/librustc_back/lib.rs index e48f9df7564..6486442deb8 100644 --- a/src/librustc_back/lib.rs +++ b/src/librustc_back/lib.rs @@ -31,7 +31,8 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/")] -#![feature(globs, phase, macro_rules)] +#![allow(unknown_features)] +#![feature(globs, phase, macro_rules, slicing_syntax)] #[phase(plugin, link)] extern crate log; diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 8fef0404a01..77d63224fcd 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -15,7 +15,8 @@ #![crate_type = "dylib"] #![crate_type = "rlib"] -#![feature(globs, struct_variant, macro_rules, phase)] +#![allow(unknown_features)] +#![feature(globs, struct_variant, macro_rules, phase, slicing_syntax)] extern crate arena; extern crate debug; diff --git a/src/librustrt/lib.rs b/src/librustrt/lib.rs index b6782b37584..d3ea07291a4 100644 --- a/src/librustrt/lib.rs +++ b/src/librustrt/lib.rs @@ -16,9 +16,10 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/master/")] +#![allow(unknown_features)] #![feature(macro_rules, phase, globs, thread_local, asm)] #![feature(linkage, lang_items, unsafe_destructor, default_type_params)] -#![feature(import_shadowing)] +#![feature(import_shadowing, slicing_syntax)] #![no_std] #![experimental] diff --git a/src/libserialize/lib.rs b/src/libserialize/lib.rs index 4213a3e3b72..6de8ca19844 100644 --- a/src/libserialize/lib.rs +++ b/src/libserialize/lib.rs @@ -23,7 +23,8 @@ Core encoding and decoding interfaces. html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/master/", html_playground_url = "http://play.rust-lang.org/")] -#![feature(macro_rules, default_type_params, phase)] +#![allow(unknown_features)] +#![feature(macro_rules, default_type_params, phase, slicing_syntax)] // test harness access #[cfg(test)] diff --git a/src/libstd/io/net/udp.rs b/src/libstd/io/net/udp.rs index 4dd6f448ee5..b8fb187548c 100644 --- a/src/libstd/io/net/udp.rs +++ b/src/libstd/io/net/udp.rs @@ -35,26 +35,29 @@ use rt::rtio; /// /// ```rust,no_run /// # #![allow(unused_must_use)] +/// #![feature(slicing_syntax)] +/// /// use std::io::net::udp::UdpSocket; /// use std::io::net::ip::{Ipv4Addr, SocketAddr}; +/// fn main() { +/// let addr = SocketAddr { ip: Ipv4Addr(127, 0, 0, 1), port: 34254 }; +/// let mut socket = match UdpSocket::bind(addr) { +/// Ok(s) => s, +/// Err(e) => fail!("couldn't bind socket: {}", e), +/// }; /// -/// let addr = SocketAddr { ip: Ipv4Addr(127, 0, 0, 1), port: 34254 }; -/// let mut socket = match UdpSocket::bind(addr) { -/// Ok(s) => s, -/// Err(e) => fail!("couldn't bind socket: {}", e), -/// }; -/// -/// let mut buf = [0, ..10]; -/// match socket.recv_from(buf) { -/// Ok((amt, src)) => { -/// // Send a reply to the socket we received data from -/// let buf = buf[mut ..amt]; -/// buf.reverse(); -/// socket.send_to(buf, src); +/// let mut buf = [0, ..10]; +/// match socket.recv_from(buf) { +/// Ok((amt, src)) => { +/// // Send a reply to the socket we received data from +/// let buf = buf[mut ..amt]; +/// buf.reverse(); +/// socket.send_to(buf, src); +/// } +/// Err(e) => println!("couldn't receive a datagram: {}", e) /// } -/// Err(e) => println!("couldn't receive a datagram: {}", e) +/// drop(socket); // close the socket /// } -/// drop(socket); // close the socket /// ``` pub struct UdpSocket { obj: Box, diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index c7e8da09e69..19b4d430562 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -105,9 +105,10 @@ html_root_url = "http://doc.rust-lang.org/master/", html_playground_url = "http://play.rust-lang.org/")] +#![allow(unknown_features)] #![feature(macro_rules, globs, linkage)] #![feature(default_type_params, phase, lang_items, unsafe_destructor)] -#![feature(import_shadowing)] +#![feature(import_shadowing, slicing_syntax)] // Don't link to std. We are std. #![no_std] diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 5d4a9025827..c3c36d04442 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -70,6 +70,7 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[ ("tuple_indexing", Active), ("associated_types", Active), ("visible_private_types", Active), + ("slicing_syntax", Active), ("if_let", Active), @@ -350,6 +351,11 @@ impl<'a, 'v> Visitor<'v> for Context<'a> { self.gate_feature("if_let", e.span, "`if let` syntax is experimental"); } + ast::ExprSlice(..) => { + self.gate_feature("slicing_syntax", + e.span, + "slicing syntax is experimental"); + } _ => {} } visit::walk_expr(self, e); diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index a4271544146..64dedd45923 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -23,7 +23,8 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/master/")] -#![feature(macro_rules, globs, default_type_params, phase)] +#![allow(unknown_features)] +#![feature(macro_rules, globs, default_type_params, phase, slicing_syntax)] #![feature(quote, struct_variant, unsafe_destructor, import_shadowing)] #![allow(deprecated)] diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs index 3fc631422d5..b05e0a4bff3 100644 --- a/src/libterm/lib.rs +++ b/src/libterm/lib.rs @@ -49,7 +49,8 @@ html_root_url = "http://doc.rust-lang.org/master/", html_playground_url = "http://play.rust-lang.org/")] -#![feature(macro_rules, phase)] +#![allow(unknown_features)] +#![feature(macro_rules, phase, slicing_syntax)] #![deny(missing_doc)] diff --git a/src/test/bench/shootout-fannkuch-redux.rs b/src/test/bench/shootout-fannkuch-redux.rs index 1260cc33725..b4292c2b050 100644 --- a/src/test/bench/shootout-fannkuch-redux.rs +++ b/src/test/bench/shootout-fannkuch-redux.rs @@ -38,6 +38,8 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED // OF THE POSSIBILITY OF SUCH DAMAGE. +#![feature(slicing_syntax)] + use std::{cmp, iter, mem}; use std::sync::Future; diff --git a/src/test/bench/shootout-fasta-redux.rs b/src/test/bench/shootout-fasta-redux.rs index 3f8c929aecf..b8af76ce17c 100644 --- a/src/test/bench/shootout-fasta-redux.rs +++ b/src/test/bench/shootout-fasta-redux.rs @@ -38,6 +38,8 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED // OF THE POSSIBILITY OF SUCH DAMAGE. +#![feature(slicing_syntax)] + use std::cmp::min; use std::io::{stdout, IoResult}; use std::os; diff --git a/src/test/bench/shootout-fasta.rs b/src/test/bench/shootout-fasta.rs index ed8ddcaa0ed..7565525bc8c 100644 --- a/src/test/bench/shootout-fasta.rs +++ b/src/test/bench/shootout-fasta.rs @@ -38,6 +38,8 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED // OF THE POSSIBILITY OF SUCH DAMAGE. +#![feature(slicing_syntax)] + use std::io; use std::io::{BufferedWriter, File}; use std::cmp::min; diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs index 80d623bbeb1..86c1bd82e9f 100644 --- a/src/test/bench/shootout-k-nucleotide-pipes.rs +++ b/src/test/bench/shootout-k-nucleotide-pipes.rs @@ -13,6 +13,8 @@ // multi tasking k-nucleotide +#![feature(slicing_syntax)] + extern crate collections; use std::collections::HashMap; diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs index 70fd937d2a3..8c08fc4caa1 100644 --- a/src/test/bench/shootout-k-nucleotide.rs +++ b/src/test/bench/shootout-k-nucleotide.rs @@ -40,6 +40,8 @@ // ignore-android see #10393 #13206 +#![feature(slicing_syntax)] + use std::string::String; use std::slice; use std::sync::{Arc, Future}; diff --git a/src/test/bench/shootout-regex-dna.rs b/src/test/bench/shootout-regex-dna.rs index 0adb80c2689..dccdafe9cf8 100644 --- a/src/test/bench/shootout-regex-dna.rs +++ b/src/test/bench/shootout-regex-dna.rs @@ -41,7 +41,7 @@ // ignore-stage1 // ignore-cross-compile #12102 -#![feature(macro_rules, phase)] +#![feature(macro_rules, phase, slicing_syntax)] extern crate regex; #[phase(plugin)]extern crate regex_macros; diff --git a/src/test/bench/shootout-reverse-complement.rs b/src/test/bench/shootout-reverse-complement.rs index e5f22a3d07c..e3fa6334f77 100644 --- a/src/test/bench/shootout-reverse-complement.rs +++ b/src/test/bench/shootout-reverse-complement.rs @@ -41,6 +41,8 @@ // ignore-pretty very bad with line comments // ignore-android doesn't terminate? +#![feature(slicing_syntax)] + use std::iter::range_step; use std::io::{stdin, stdout, File}; diff --git a/src/test/compile-fail/issue-15730.rs b/src/test/compile-fail/issue-15730.rs index fc8c4e36075..c29e74af03c 100644 --- a/src/test/compile-fail/issue-15730.rs +++ b/src/test/compile-fail/issue-15730.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(slicing_syntax)] + fn main() { let mut array = [1, 2, 3]; //~^ ERROR cannot determine a type for this local variable: cannot determine the type of this integ diff --git a/src/test/compile-fail/slice-2.rs b/src/test/compile-fail/slice-2.rs index fbfc438321c..63f79c808ae 100644 --- a/src/test/compile-fail/slice-2.rs +++ b/src/test/compile-fail/slice-2.rs @@ -10,6 +10,8 @@ // Test that slicing syntax gives errors if we have not implemented the trait. +#![feature(slicing_syntax)] + struct Foo; fn main() { diff --git a/src/test/compile-fail/slice-borrow.rs b/src/test/compile-fail/slice-borrow.rs index 3d12511134f..00783b71ea1 100644 --- a/src/test/compile-fail/slice-borrow.rs +++ b/src/test/compile-fail/slice-borrow.rs @@ -10,6 +10,8 @@ // Test slicing expressions doesn't defeat the borrow checker. +#![feature(slicing_syntax)] + fn main() { let y; { diff --git a/src/test/compile-fail/slice-mut-2.rs b/src/test/compile-fail/slice-mut-2.rs index 1176b637cec..09019448a67 100644 --- a/src/test/compile-fail/slice-mut-2.rs +++ b/src/test/compile-fail/slice-mut-2.rs @@ -10,6 +10,8 @@ // Test mutability and slicing syntax. +#![feature(slicing_syntax)] + fn main() { let x: &[int] = &[1, 2, 3, 4, 5]; // Can't mutably slice an immutable slice diff --git a/src/test/compile-fail/slice-mut.rs b/src/test/compile-fail/slice-mut.rs index 8cd7c4ed0bb..cbfa3ed85fd 100644 --- a/src/test/compile-fail/slice-mut.rs +++ b/src/test/compile-fail/slice-mut.rs @@ -10,6 +10,8 @@ // Test mutability and slicing syntax. +#![feature(slicing_syntax)] + fn main() { let x: &[int] = &[1, 2, 3, 4, 5]; // Immutable slices are not mutable. diff --git a/src/test/debuginfo/vec-slices.rs b/src/test/debuginfo/vec-slices.rs index 392a025b1f0..67e621fe556 100644 --- a/src/test/debuginfo/vec-slices.rs +++ b/src/test/debuginfo/vec-slices.rs @@ -80,6 +80,7 @@ // lldb-check:[...]$5 = &[AStruct { x: 10, y: 11, z: 12 }, AStruct { x: 13, y: 14, z: 15 }] #![allow(unused_variable)] +#![feature(slicing_syntax)] struct AStruct { x: i16, diff --git a/src/test/run-pass/issue-3888-2.rs b/src/test/run-pass/issue-3888-2.rs index 20629673619..10add853ee7 100644 --- a/src/test/run-pass/issue-3888-2.rs +++ b/src/test/run-pass/issue-3888-2.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(slicing_syntax)] + fn vec_peek<'r, T>(v: &'r [T]) -> &'r [T] { v[1..5] } diff --git a/src/test/run-pass/issue-4464.rs b/src/test/run-pass/issue-4464.rs index 0f3f9149536..f2c1a715b51 100644 --- a/src/test/run-pass/issue-4464.rs +++ b/src/test/run-pass/issue-4464.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(slicing_syntax)] + fn broken(v: &[u8], i: uint, j: uint) -> &[u8] { v[i..j] } pub fn main() {} diff --git a/src/test/run-pass/issue-8898.rs b/src/test/run-pass/issue-8898.rs index 5348476fad7..3fff58410a4 100644 --- a/src/test/run-pass/issue-8898.rs +++ b/src/test/run-pass/issue-8898.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(slicing_syntax)] extern crate debug; diff --git a/src/test/run-pass/slice-2.rs b/src/test/run-pass/slice-2.rs index 3c0933a055c..768c28cb8de 100644 --- a/src/test/run-pass/slice-2.rs +++ b/src/test/run-pass/slice-2.rs @@ -10,6 +10,8 @@ // Test slicing expressions on slices and Vecs. +#![feature(slicing_syntax)] + fn main() { let x: &[int] = &[1, 2, 3, 4, 5]; let cmp: &[int] = &[1, 2, 3, 4, 5]; diff --git a/src/test/run-pass/slice-fail-1.rs b/src/test/run-pass/slice-fail-1.rs index f6972023a72..b07cf595968 100644 --- a/src/test/run-pass/slice-fail-1.rs +++ b/src/test/run-pass/slice-fail-1.rs @@ -10,6 +10,8 @@ // Test that is a slicing expr[..] fails, the correct cleanups happen. +#![feature(slicing_syntax)] + use std::task; struct Foo; diff --git a/src/test/run-pass/slice-fail-2.rs b/src/test/run-pass/slice-fail-2.rs index cbe65fcd83d..a2aecc1d5cd 100644 --- a/src/test/run-pass/slice-fail-2.rs +++ b/src/test/run-pass/slice-fail-2.rs @@ -10,6 +10,8 @@ // Test that is a slicing expr[..] fails, the correct cleanups happen. +#![feature(slicing_syntax)] + use std::task; struct Foo; diff --git a/src/test/run-pass/slice.rs b/src/test/run-pass/slice.rs index 39feb075add..7d969a0864e 100644 --- a/src/test/run-pass/slice.rs +++ b/src/test/run-pass/slice.rs @@ -10,6 +10,8 @@ // Test slicing sugar. +#![feature(slicing_syntax)] + extern crate core; use core::ops::{Slice,SliceMut};