Skip to content

Commit

Permalink
Merge pull request rust-lang#26 from rust-lang-nursery/gh14
Browse files Browse the repository at this point in the history
Make sure we don't talk about unstable things
  • Loading branch information
steveklabnik committed Mar 23, 2017
2 parents 14bb861 + 3eaca33 commit 4076f44
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 24 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ before_script:

script:
- export PATH=$PATH:/home/travis/.cargo/bin && mdbook test
- cd stable-check && cargo run -- ../src
19 changes: 0 additions & 19 deletions src/expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 4 additions & 5 deletions src/items.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions stable-check/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target
4 changes: 4 additions & 0 deletions stable-check/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions stable-check/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "stable-check"
version = "0.1.0"
authors = ["steveklabnik <steve@steveklabnik.com>"]

[dependencies]
45 changes: 45 additions & 0 deletions stable-check/src/main.rs
Original file line number Diff line number Diff line change
@@ -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<Error>> {
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(())
}

0 comments on commit 4076f44

Please sign in to comment.