diff --git a/.travis.yml b/.travis.yml index 7cc0f74881af6..db5946ee2a460 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,3 +8,4 @@ before_script: script: - export PATH=$PATH:/home/travis/.cargo/bin && mdbook test + - cd stable-check && cargo run -- ../src diff --git a/src/expressions.md b/src/expressions.md index d69afc2a6a620..dbff080c221b4 100644 --- a/src/expressions.md +++ b/src/expressions.md @@ -308,25 +308,6 @@ let y = 0..10; assert_eq!(x, y); ``` -Similarly, the `...` operator will construct an object of one of the -`std::ops::RangeInclusive` variants. - -```rust -# #![feature(inclusive_range_syntax)] -1...2; // std::ops::RangeInclusive -...4; // std::ops::RangeToInclusive -``` - -The following expressions are equivalent. - -```rust -# #![feature(inclusive_range_syntax, inclusive_range)] -let x = std::ops::RangeInclusive::NonEmpty {start: 0, end: 10}; -let y = 0...10; - -assert_eq!(x, y); -``` - ## Unary operator expressions Rust defines the following unary operators. With the exception of `?`, they are diff --git a/src/items.md b/src/items.md index ba3f4195ba62d..710a6778f6840 100644 --- a/src/items.md +++ b/src/items.md @@ -665,13 +665,12 @@ type of the value is not required to ascribe to `Sync`. #### `'static` lifetime elision -[Unstable] Both constant and static declarations of reference types have -*implicit* `'static` lifetimes unless an explicit lifetime is specified. As -such, the constant declarations involving `'static` above may be written -without the lifetimes. Returning to our previous example: +Both constant and static declarations of reference types have *implicit* +`'static` lifetimes unless an explicit lifetime is specified. As such, the +constant declarations involving `'static` above may be written without the +lifetimes. Returning to our previous example: ```rust -# #![feature(static_in_const)] const BIT1: u32 = 1 << 0; const BIT2: u32 = 1 << 1; diff --git a/stable-check/.gitignore b/stable-check/.gitignore new file mode 100644 index 0000000000000..eb5a316cbd195 --- /dev/null +++ b/stable-check/.gitignore @@ -0,0 +1 @@ +target diff --git a/stable-check/Cargo.lock b/stable-check/Cargo.lock new file mode 100644 index 0000000000000..9a3b307c967ae --- /dev/null +++ b/stable-check/Cargo.lock @@ -0,0 +1,4 @@ +[root] +name = "stable-check" +version = "0.1.0" + diff --git a/stable-check/Cargo.toml b/stable-check/Cargo.toml new file mode 100644 index 0000000000000..691722a0b26f4 --- /dev/null +++ b/stable-check/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "stable-check" +version = "0.1.0" +authors = ["steveklabnik "] + +[dependencies] diff --git a/stable-check/src/main.rs b/stable-check/src/main.rs new file mode 100644 index 0000000000000..724e918147435 --- /dev/null +++ b/stable-check/src/main.rs @@ -0,0 +1,45 @@ +use std::error::Error; +use std::env; +use std::fs; +use std::fs::File; +use std::io::prelude::*; +use std::path::Path; + +fn main() { + let arg = env::args().nth(1).unwrap_or_else(|| { + println!("Please pass a src directory as the first argument"); + std::process::exit(1); + }); + + match check_directory(&Path::new(&arg)) { + Ok(()) => println!("passed!"), + Err(e) => { + println!("Error: {}", e); + std::process::exit(1); + } + } +} + +fn check_directory(dir: &Path) -> Result<(), Box> { + for entry in fs::read_dir(dir)? { + let entry = entry?; + let path = entry.path(); + + if path.is_dir() { + continue; + } + + let mut file = File::open(&path)?; + let mut contents = String::new(); + file.read_to_string(&mut contents)?; + + if contents.contains("#![feature") { + // attributes.md contains this and it is legitimate + if !contents.contains("#![feature(feature1, feature2, feature3)]") { + return Err(From::from(format!("Feature flag found in {:?}", path))); + } + } + } + + Ok(()) +}