Skip to content

Commit

Permalink
Revert "Put slicing syntax behind a feature gate."
Browse files Browse the repository at this point in the history
This reverts commit 95cfc35.
  • Loading branch information
aturon committed Oct 2, 2014
1 parent 2f365ff commit 7bf56df
Show file tree
Hide file tree
Showing 43 changed files with 43 additions and 105 deletions.
2 changes: 1 addition & 1 deletion src/compiletest/compiletest.rs
Expand Up @@ -9,7 +9,7 @@
// except according to those terms.

#![crate_type = "bin"]
#![feature(phase, slicing_syntax)]
#![feature(phase)]

#![deny(warnings)]

Expand Down
2 changes: 1 addition & 1 deletion src/doc/reference.md
Expand Up @@ -3828,7 +3828,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<A: Clone, B: Clone>(f: |A| -> B, xs: &[A]) -> Vec<B> {
if xs.len() == 0 {
return vec![];
Expand Down
3 changes: 1 addition & 2 deletions src/libcollections/lib.rs
Expand Up @@ -19,9 +19,8 @@
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, slicing_syntax)]
#![feature(unsafe_destructor, import_shadowing)]
#![no_std]

#[phase(plugin, link)] extern crate core;
Expand Down
9 changes: 3 additions & 6 deletions src/libcollections/slice.rs
Expand Up @@ -51,12 +51,9 @@
//! interval `[a, b)`:
//!
//! ```rust
//! #![feature(slicing_syntax)]
//! fn main() {
//! let numbers = [0i, 1i, 2i];
//! let last_numbers = numbers[1..3];
//! // last_numbers is now &[1i, 2i]
//! }
//! let numbers = [0i, 1i, 2i];
//! let last_numbers = numbers[1..3];
//! // last_numbers is now &[1i, 2i]
//! ```
//!
//! ## Implementations of other traits
Expand Down
4 changes: 2 additions & 2 deletions src/libcollections/string.rs
Expand Up @@ -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])
};
}

Expand All @@ -177,7 +177,7 @@ impl String {
macro_rules! error(() => ({
unsafe {
if subseqidx != i_ {
res.as_mut_vec().push_all(v[subseqidx..i_]);
res.as_mut_vec().push_all(vv[subseqidx..i_]);
}
subseqidx = i;
res.as_mut_vec().push_all(REPLACEMENT);
Expand Down
3 changes: 1 addition & 2 deletions src/libcore/lib.rs
Expand Up @@ -57,9 +57,8 @@
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, slicing_syntax)]
#![feature(simd, unsafe_destructor)]
#![deny(missing_doc)]

mod macros;
Expand Down
6 changes: 3 additions & 3 deletions src/libcore/ops.rs
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand All @@ -771,7 +771,7 @@ pub trait Slice<Idx, Sized? Result> for Sized? {
* }
* }
*
* pub fn main() {
* fn main() {
* Foo[mut Foo..];
* }
* ```
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/slice.rs
Expand Up @@ -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[mut 1..len]
self.slice_mut(1, len)
}

#[inline]
fn init_mut(self) -> &'a mut [T] {
let len = self.len();
self[mut 0..len - 1]
self.slice_mut(0, len - 1)
}

#[inline]
Expand Down
2 changes: 1 addition & 1 deletion src/libcoretest/lib.rs
Expand Up @@ -7,7 +7,7 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(globs, unsafe_destructor, macro_rules, slicing_syntax)]
#![feature(globs, unsafe_destructor, macro_rules)]

extern crate core;
extern crate test;
Expand Down
3 changes: 1 addition & 2 deletions src/libnative/lib.rs
Expand Up @@ -57,8 +57,7 @@

#![deny(unused_result, unused_must_use)]
#![allow(non_camel_case_types, deprecated)]
#![allow(unknown_features)]
#![feature(default_type_params, lang_items, slicing_syntax)]
#![feature(default_type_params, lang_items)]

// NB this crate explicitly does *not* allow glob imports, please seriously
// consider whether they're needed before adding that feature here (the
Expand Down
3 changes: 1 addition & 2 deletions src/libnum/lib.rs
Expand Up @@ -43,8 +43,7 @@
//!
//! [newt]: https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method

#![allow(unknown_features)]
#![feature(macro_rules, slicing_syntax)]
#![feature(macro_rules)]
#![feature(default_type_params)]

#![crate_name = "num"]
Expand Down
3 changes: 1 addition & 2 deletions src/librbml/lib.rs
Expand Up @@ -24,8 +24,7 @@
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/")]
#![allow(unknown_features)]
#![feature(macro_rules, phase, slicing_syntax)]
#![feature(macro_rules, phase)]
#![allow(missing_doc)]

extern crate serialize;
Expand Down
3 changes: 1 addition & 2 deletions src/libregex/lib.rs
Expand Up @@ -368,8 +368,7 @@
html_root_url = "http://doc.rust-lang.org/master/",
html_playground_url = "http://play.rust-lang.org/")]

#![allow(unknown_features)]
#![feature(macro_rules, phase, slicing_syntax)]
#![feature(macro_rules, phase)]
#![deny(missing_doc)]

#[cfg(test)]
Expand Down
3 changes: 1 addition & 2 deletions src/librustc/lib.rs
Expand Up @@ -29,9 +29,8 @@ 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, slicing_syntax)]
#![feature(default_type_params, phase, unsafe_destructor)]

#![feature(rustc_diagnostic_macros)]
#![feature(import_shadowing)]
Expand Down
3 changes: 1 addition & 2 deletions src/librustc_back/lib.rs
Expand Up @@ -31,8 +31,7 @@
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
html_root_url = "http://doc.rust-lang.org/")]

#![allow(unknown_features)]
#![feature(globs, phase, macro_rules, slicing_syntax)]
#![feature(globs, phase, macro_rules)]

#[phase(plugin, link)]
extern crate log;
Expand Down
3 changes: 1 addition & 2 deletions src/librustdoc/lib.rs
Expand Up @@ -15,8 +15,7 @@
#![crate_type = "dylib"]
#![crate_type = "rlib"]

#![allow(unknown_features)]
#![feature(globs, struct_variant, managed_boxes, macro_rules, phase, slicing_syntax)]
#![feature(globs, struct_variant, managed_boxes, macro_rules, phase)]

extern crate arena;
extern crate debug;
Expand Down
3 changes: 1 addition & 2 deletions src/librustrt/lib.rs
Expand Up @@ -16,10 +16,9 @@
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, managed_boxes, asm)]
#![feature(linkage, lang_items, unsafe_destructor, default_type_params)]
#![feature(import_shadowing, slicing_syntax)]
#![feature(import_shadowing)]
#![no_std]
#![experimental]

Expand Down
3 changes: 1 addition & 2 deletions src/libserialize/lib.rs
Expand Up @@ -23,8 +23,7 @@ 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/")]
#![allow(unknown_features)]
#![feature(macro_rules, managed_boxes, default_type_params, phase, slicing_syntax)]
#![feature(macro_rules, managed_boxes, default_type_params, phase)]

// test harness access
#[cfg(test)]
Expand Down
33 changes: 15 additions & 18 deletions src/libstd/io/net/udp.rs
Expand Up @@ -35,29 +35,26 @@ 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 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)
/// 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);
/// }
/// drop(socket); // close the socket
/// Err(e) => println!("couldn't receive a datagram: {}", e)
/// }
/// drop(socket); // close the socket
/// ```
pub struct UdpSocket {
obj: Box<RtioUdpSocket + Send>,
Expand Down
3 changes: 1 addition & 2 deletions src/libstd/lib.rs
Expand Up @@ -105,10 +105,9 @@
html_root_url = "http://doc.rust-lang.org/master/",
html_playground_url = "http://play.rust-lang.org/")]

#![allow(unknown_features)]
#![feature(macro_rules, globs, managed_boxes, linkage)]
#![feature(default_type_params, phase, lang_items, unsafe_destructor)]
#![feature(import_shadowing, slicing_syntax)]
#![feature(import_shadowing)]

// Don't link to std. We are std.
#![no_std]
Expand Down
6 changes: 0 additions & 6 deletions src/libsyntax/feature_gate.rs
Expand Up @@ -70,7 +70,6 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
("tuple_indexing", Active),
("associated_types", Active),
("visible_private_types", Active),
("slicing_syntax", Active),

("if_let", Active),

Expand Down Expand Up @@ -363,11 +362,6 @@ 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);
Expand Down
3 changes: 1 addition & 2 deletions src/libsyntax/lib.rs
Expand Up @@ -23,8 +23,7 @@
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, globs, default_type_params, phase, slicing_syntax)]
#![feature(macro_rules, globs, default_type_params, phase)]
#![feature(quote, struct_variant, unsafe_destructor, import_shadowing)]
#![allow(deprecated)]

Expand Down
3 changes: 1 addition & 2 deletions src/libterm/lib.rs
Expand Up @@ -49,8 +49,7 @@
html_root_url = "http://doc.rust-lang.org/master/",
html_playground_url = "http://play.rust-lang.org/")]

#![allow(unknown_features)]
#![feature(macro_rules, phase, slicing_syntax)]
#![feature(macro_rules, phase)]

#![deny(missing_doc)]

Expand Down
2 changes: 0 additions & 2 deletions src/test/bench/shootout-fannkuch-redux.rs
Expand Up @@ -38,8 +38,6 @@
// 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;

Expand Down
2 changes: 0 additions & 2 deletions src/test/bench/shootout-fasta-redux.rs
Expand Up @@ -38,8 +38,6 @@
// 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;
Expand Down
2 changes: 0 additions & 2 deletions src/test/bench/shootout-fasta.rs
Expand Up @@ -38,8 +38,6 @@
// 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;
Expand Down
2 changes: 0 additions & 2 deletions src/test/bench/shootout-k-nucleotide-pipes.rs
Expand Up @@ -13,8 +13,6 @@

// multi tasking k-nucleotide

#![feature(slicing_syntax)]

extern crate collections;

use std::collections::HashMap;
Expand Down
2 changes: 0 additions & 2 deletions src/test/bench/shootout-k-nucleotide.rs
Expand Up @@ -40,8 +40,6 @@

// ignore-android see #10393 #13206

#![feature(slicing_syntax)]

use std::string::String;
use std::slice;
use std::sync::{Arc, Future};
Expand Down
2 changes: 1 addition & 1 deletion src/test/bench/shootout-regex-dna.rs
Expand Up @@ -41,7 +41,7 @@
// ignore-stage1
// ignore-cross-compile #12102

#![feature(macro_rules, phase, slicing_syntax)]
#![feature(macro_rules, phase)]

extern crate regex;
#[phase(plugin)]extern crate regex_macros;
Expand Down
2 changes: 0 additions & 2 deletions src/test/bench/shootout-reverse-complement.rs
Expand Up @@ -41,8 +41,6 @@
// 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};

Expand Down
2 changes: 0 additions & 2 deletions src/test/compile-fail/issue-15730.rs
Expand Up @@ -8,8 +8,6 @@
// 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
Expand Down
2 changes: 0 additions & 2 deletions src/test/compile-fail/slice-2.rs
Expand Up @@ -10,8 +10,6 @@

// Test that slicing syntax gives errors if we have not implemented the trait.

#![feature(slicing_syntax)]

struct Foo;

fn main() {
Expand Down

0 comments on commit 7bf56df

Please sign in to comment.