diff options
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/edition.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/libsyntax/edition.rs b/src/libsyntax/edition.rs index 4c1d52d7b07..3fc1c279f5a 100644 --- a/src/libsyntax/edition.rs +++ b/src/libsyntax/edition.rs @@ -24,7 +24,8 @@ pub enum Edition { // when adding new editions, be sure to update: // - // - the list in the `parse_edition` static in librustc::session::config + // - Update the `ALL_EDITIONS` const + // - Update the EDITION_NAME_LIST const // - add a `rust_####()` function to the session // - update the enum in Cargo's sources as well } @@ -32,6 +33,8 @@ pub enum Edition { // must be in order from oldest to newest pub const ALL_EDITIONS: &[Edition] = &[Edition::Edition2015, Edition::Edition2018]; +pub const EDITION_NAME_LIST: &'static str = "2015|2018"; + pub const DEFAULT_EDITION: Edition = Edition::Edition2015; impl fmt::Display for Edition { @@ -58,6 +61,13 @@ impl Edition { Edition::Edition2018 => "rust_2018_preview", } } + + pub fn is_stable(&self) -> bool { + match *self { + Edition::Edition2015 => true, + Edition::Edition2018 => false, + } + } } impl FromStr for Edition { |
