Skip to content

Commit 3eaca33

Browse files
committed
Make sure we don't talk about unstable things
Fixes rust-lang#14
1 parent 927ffc2 commit 3eaca33

File tree

7 files changed

+61
-24
lines changed

7 files changed

+61
-24
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ before_script:
88

99
script:
1010
- export PATH=$PATH:/home/travis/.cargo/bin && mdbook test
11+
- cd stable-check && cargo run -- ../src

src/expressions.md

-19
Original file line numberDiff line numberDiff line change
@@ -308,25 +308,6 @@ let y = 0..10;
308308
assert_eq!(x, y);
309309
```
310310

311-
Similarly, the `...` operator will construct an object of one of the
312-
`std::ops::RangeInclusive` variants.
313-
314-
```rust
315-
# #![feature(inclusive_range_syntax)]
316-
1...2; // std::ops::RangeInclusive
317-
...4; // std::ops::RangeToInclusive
318-
```
319-
320-
The following expressions are equivalent.
321-
322-
```rust
323-
# #![feature(inclusive_range_syntax, inclusive_range)]
324-
let x = std::ops::RangeInclusive::NonEmpty {start: 0, end: 10};
325-
let y = 0...10;
326-
327-
assert_eq!(x, y);
328-
```
329-
330311
## Unary operator expressions
331312

332313
Rust defines the following unary operators. With the exception of `?`, they are

src/items.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -665,13 +665,12 @@ type of the value is not required to ascribe to `Sync`.
665665

666666
#### `'static` lifetime elision
667667

668-
[Unstable] Both constant and static declarations of reference types have
669-
*implicit* `'static` lifetimes unless an explicit lifetime is specified. As
670-
such, the constant declarations involving `'static` above may be written
671-
without the lifetimes. Returning to our previous example:
668+
Both constant and static declarations of reference types have *implicit*
669+
`'static` lifetimes unless an explicit lifetime is specified. As such, the
670+
constant declarations involving `'static` above may be written without the
671+
lifetimes. Returning to our previous example:
672672

673673
```rust
674-
# #![feature(static_in_const)]
675674
const BIT1: u32 = 1 << 0;
676675
const BIT2: u32 = 1 << 1;
677676

stable-check/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
target

stable-check/Cargo.lock

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

stable-check/Cargo.toml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[package]
2+
name = "stable-check"
3+
version = "0.1.0"
4+
authors = ["steveklabnik <[email protected]>"]
5+
6+
[dependencies]

stable-check/src/main.rs

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
use std::error::Error;
2+
use std::env;
3+
use std::fs;
4+
use std::fs::File;
5+
use std::io::prelude::*;
6+
use std::path::Path;
7+
8+
fn main() {
9+
let arg = env::args().nth(1).unwrap_or_else(|| {
10+
println!("Please pass a src directory as the first argument");
11+
std::process::exit(1);
12+
});
13+
14+
match check_directory(&Path::new(&arg)) {
15+
Ok(()) => println!("passed!"),
16+
Err(e) => {
17+
println!("Error: {}", e);
18+
std::process::exit(1);
19+
}
20+
}
21+
}
22+
23+
fn check_directory(dir: &Path) -> Result<(), Box<Error>> {
24+
for entry in fs::read_dir(dir)? {
25+
let entry = entry?;
26+
let path = entry.path();
27+
28+
if path.is_dir() {
29+
continue;
30+
}
31+
32+
let mut file = File::open(&path)?;
33+
let mut contents = String::new();
34+
file.read_to_string(&mut contents)?;
35+
36+
if contents.contains("#![feature") {
37+
// attributes.md contains this and it is legitimate
38+
if !contents.contains("#![feature(feature1, feature2, feature3)]") {
39+
return Err(From::from(format!("Feature flag found in {:?}", path)));
40+
}
41+
}
42+
}
43+
44+
Ok(())
45+
}

0 commit comments

Comments
 (0)