Skip to content

Commit 2d38234

Browse files
committed
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.
1 parent 5997694 commit 2d38234

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+101
-39
lines changed

src/compiletest/compiletest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
#![crate_type = "bin"]
12-
#![feature(phase)]
12+
#![feature(phase, slicing_syntax)]
1313

1414
#![deny(warnings)]
1515

src/doc/reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3837,7 +3837,7 @@ type signature of `print`, and the cast expression in `main`.
38373837
Within the body of an item that has type parameter declarations, the names of
38383838
its type parameters are types:
38393839

3840-
```
3840+
```ignore
38413841
fn map<A: Clone, B: Clone>(f: |A| -> B, xs: &[A]) -> Vec<B> {
38423842
if xs.len() == 0 {
38433843
return vec![];

src/libcollections/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
html_root_url = "http://doc.rust-lang.org/master/",
2020
html_playground_url = "http://play.rust-lang.org/")]
2121

22+
#![allow(unknown_features)]
2223
#![feature(macro_rules, default_type_params, phase, globs)]
23-
#![feature(unsafe_destructor, import_shadowing)]
24+
#![feature(unsafe_destructor, import_shadowing, slicing_syntax)]
2425
#![no_std]
2526

2627
#[phase(plugin, link)] extern crate core;

src/libcollections/slice.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,12 @@
5252
//! interval `[a, b)`:
5353
//!
5454
//! ```rust
55-
//! let numbers = [0i, 1i, 2i];
56-
//! let last_numbers = numbers[1..3];
57-
//! // last_numbers is now &[1i, 2i]
55+
//! #![feature(slicing_syntax)]
56+
//! fn main() {
57+
//! let numbers = [0i, 1i, 2i];
58+
//! let last_numbers = numbers[1..3];
59+
//! // last_numbers is now &[1i, 2i]
60+
//! }
5861
//! ```
5962
//!
6063
//! ## Implementations of other traits

src/libcore/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@
5757
html_playground_url = "http://play.rust-lang.org/")]
5858

5959
#![no_std]
60+
#![allow(unknown_features)]
6061
#![feature(globs, intrinsics, lang_items, macro_rules, phase)]
61-
#![feature(simd, unsafe_destructor)]
62+
#![feature(simd, unsafe_destructor, slicing_syntax)]
6263
#![deny(missing_doc)]
6364

6465
mod macros;

src/libcore/ops.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ pub trait IndexMut<Index, Result> {
684684
* A trivial implementation of `Slice`. When `Foo[..Foo]` happens, it ends up
685685
* calling `slice_to`, and therefore, `main` prints `Slicing!`.
686686
*
687-
* ```
687+
* ```ignore
688688
* struct Foo;
689689
*
690690
* impl ::core::ops::Slice<Foo, Foo> for Foo {
@@ -734,7 +734,7 @@ pub trait Slice<Idx, Sized? Result> for Sized? {
734734
* A trivial implementation of `SliceMut`. When `Foo[Foo..]` happens, it ends up
735735
* calling `slice_from_mut`, and therefore, `main` prints `Slicing!`.
736736
*
737-
* ```
737+
* ```ignore
738738
* struct Foo;
739739
*
740740
* impl ::core::ops::SliceMut<Foo, Foo> for Foo {
@@ -756,7 +756,7 @@ pub trait Slice<Idx, Sized? Result> for Sized? {
756756
* }
757757
* }
758758
*
759-
* fn main() {
759+
* pub fn main() {
760760
* Foo[mut Foo..];
761761
* }
762762
* ```

src/libcoretest/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
10-
#![feature(globs, unsafe_destructor, macro_rules)]
10+
#![feature(globs, unsafe_destructor, macro_rules, slicing_syntax)]
1111

1212
extern crate core;
1313
extern crate test;

src/libnative/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@
5757

5858
#![deny(unused_result, unused_must_use)]
5959
#![allow(non_camel_case_types, deprecated)]
60-
#![feature(default_type_params, lang_items)]
60+
#![allow(unknown_features)]
61+
#![feature(default_type_params, lang_items, slicing_syntax)]
6162

6263
// NB this crate explicitly does *not* allow glob imports, please seriously
6364
// consider whether they're needed before adding that feature here (the

src/libnum/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
//!
4444
//! [newt]: https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method
4545
46-
#![feature(macro_rules)]
46+
#![allow(unknown_features)]
47+
#![feature(macro_rules, slicing_syntax)]
4748
#![feature(default_type_params)]
4849

4950
#![crate_name = "num"]

src/librbml/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
2525
html_root_url = "http://doc.rust-lang.org/master/",
2626
html_playground_url = "http://play.rust-lang.org/")]
27-
#![feature(macro_rules, phase)]
27+
#![allow(unknown_features)]
28+
#![feature(macro_rules, phase, slicing_syntax)]
2829
#![allow(missing_doc)]
2930

3031
extern crate serialize;

0 commit comments

Comments
 (0)