forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request rust-lang#26 from rust-lang-nursery/gh14
Make sure we don't talk about unstable things
- Loading branch information
Showing
7 changed files
with
61 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
target |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(()) | ||
} |