]> git.lizzy.rs Git - rust.git/commitdiff
rename epoch to edition
authorKurtis Nusbaum <kcommiter@gmail.com>
Thu, 15 Mar 2018 03:30:06 +0000 (20:30 -0700)
committerKurtis Nusbaum <kcommiter@gmail.com>
Tue, 20 Mar 2018 17:27:02 +0000 (10:27 -0700)
19 files changed:
src/librustc/lint/context.rs
src/librustc/lint/mod.rs
src/librustc/session/config.rs
src/librustc/session/mod.rs
src/librustc_driver/driver.rs
src/librustc_lint/lib.rs
src/librustc_typeck/check/method/probe.rs
src/libsyntax/config.rs
src/libsyntax/edition.rs [new file with mode: 0644]
src/libsyntax/epoch.rs [deleted file]
src/libsyntax/feature_gate.rs
src/libsyntax/lib.rs
src/test/compile-fail/edition-raw-pointer-method-2015.rs [new file with mode: 0644]
src/test/compile-fail/edition-raw-pointer-method-2018.rs [new file with mode: 0644]
src/test/compile-fail/epoch-raw-pointer-method-2015.rs [deleted file]
src/test/compile-fail/epoch-raw-pointer-method-2018.rs [deleted file]
src/test/run-pass/dyn-trait.rs
src/test/run-pass/epoch-gate-feature.rs
src/test/ui/inference-variable-behind-raw-pointer.stderr

index 4fa6594df169cd4af5f33efb3b9172410b6e7cba..936aa71f16cea9c75fd80bcf013260ef7ecc9c5f 100644 (file)
@@ -41,7 +41,7 @@
 use std::default::Default as StdDefault;
 use std::cell::{Ref, RefCell};
 use syntax::ast;
-use syntax::epoch;
+use syntax::edition;
 use syntax_pos::{MultiSpan, Span};
 use errors::DiagnosticBuilder;
 use hir;
@@ -103,9 +103,9 @@ pub struct FutureIncompatibleInfo {
     pub id: LintId,
     /// e.g., a URL for an issue/PR/RFC or error code
     pub reference: &'static str,
-    /// If this is an epoch fixing lint, the epoch in which
+    /// If this is an edition fixing lint, the edition in which
     /// this lint becomes obsolete
-    pub epoch: Option<epoch::Epoch>,
+    pub edition: Option<edition::Edition>,
 }
 
 /// The target of the `by_name` map, which accounts for renaming/deprecation.
@@ -201,11 +201,11 @@ pub fn register_future_incompatible(&mut self,
                                         sess: Option<&Session>,
                                         lints: Vec<FutureIncompatibleInfo>) {
 
-        for epoch in epoch::ALL_EPOCHS {
-            let lints = lints.iter().filter(|f| f.epoch == Some(*epoch)).map(|f| f.id)
+        for edition in edition::ALL_EPOCHS {
+            let lints = lints.iter().filter(|f| f.edition == Some(*edition)).map(|f| f.id)
                              .collect::<Vec<_>>();
             if !lints.is_empty() {
-                self.register_group(sess, false, epoch.lint_name(), lints)
+                self.register_group(sess, false, edition.lint_name(), lints)
             }
         }
 
index 7c103dc2721091b31e2472f1ec0f0f12ce963605..cd038d067a1fd950f7565d1ceefb6e5d08fbd39e 100644 (file)
@@ -42,7 +42,7 @@
 use std::hash;
 use syntax::ast;
 use syntax::codemap::MultiSpan;
-use syntax::epoch::Epoch;
+use syntax::edition::Edition;
 use syntax::symbol::Symbol;
 use syntax::visit as ast_visit;
 use syntax_pos::Span;
@@ -77,8 +77,8 @@ pub struct Lint {
     /// e.g. "imports that are never used"
     pub desc: &'static str,
 
-    /// Deny lint after this epoch
-    pub epoch_deny: Option<Epoch>,
+    /// Deny lint after this edition
+    pub edition_deny: Option<Edition>,
 }
 
 impl Lint {
@@ -88,8 +88,8 @@ pub fn name_lower(&self) -> String {
     }
 
     pub fn default_level(&self, session: &Session) -> Level {
-        if let Some(epoch_deny) = self.epoch_deny {
-            if session.epoch() >= epoch_deny {
+        if let Some(edition_deny) = self.edition_deny {
+            if session.edition() >= edition_deny {
                 return Level::Deny
             }
         }
@@ -100,12 +100,12 @@ pub fn default_level(&self, session: &Session) -> Level {
 /// Declare a static item of type `&'static Lint`.
 #[macro_export]
 macro_rules! declare_lint {
-    ($vis: vis $NAME: ident, $Level: ident, $desc: expr, $epoch: expr) => (
+    ($vis: vis $NAME: ident, $Level: ident, $desc: expr, $edition: expr) => (
         $vis static $NAME: &$crate::lint::Lint = &$crate::lint::Lint {
             name: stringify!($NAME),
             default_level: $crate::lint::$Level,
             desc: $desc,
-            epoch_deny: Some($epoch)
+            edition_deny: Some($edition)
         };
     );
     ($vis: vis $NAME: ident, $Level: ident, $desc: expr) => (
@@ -113,7 +113,7 @@ macro_rules! declare_lint {
             name: stringify!($NAME),
             default_level: $crate::lint::$Level,
             desc: $desc,
-            epoch_deny: None,
+            edition_deny: None,
         };
     );
 }
@@ -499,8 +499,8 @@ pub fn struct_lint_level<'a>(sess: &'a Session,
     // Check for future incompatibility lints and issue a stronger warning.
     let lints = sess.lint_store.borrow();
     if let Some(future_incompatible) = lints.future_incompatible(LintId::of(lint)) {
-        let future = if let Some(epoch) = future_incompatible.epoch {
-            format!("the {} epoch", epoch)
+        let future = if let Some(edition) = future_incompatible.edition {
+            format!("the {} edition", edition)
         } else {
             "a future release".to_owned()
         };
index 0d91074e946bda028c813aebb2804082c91569fe..4ba634f8b25cd26953e9eda384c8a120450dd55d 100644 (file)
@@ -28,7 +28,7 @@
 
 use syntax::ast::{self, IntTy, UintTy};
 use syntax::codemap::{FileName, FilePathMapping};
-use syntax::epoch::Epoch;
+use syntax::edition::Edition;
 use syntax::parse::token;
 use syntax::parse;
 use syntax::symbol::Symbol;
@@ -771,7 +771,7 @@ mod $mod_desc {
             Some("`string` or `string=string`");
         pub const parse_lto: Option<&'static str> =
             Some("one of `thin`, `fat`, or omitted");
-        pub const parse_epoch: Option<&'static str> =
+        pub const parse_edition: Option<&'static str> =
             Some("one of: `2015`, `2018`");
     }
 
@@ -780,7 +780,7 @@ mod $mod_set {
         use super::{$struct_name, Passes, SomePasses, AllPasses, Sanitizer, Lto};
         use rustc_back::{LinkerFlavor, PanicStrategy, RelroLevel};
         use std::path::PathBuf;
-        use syntax::epoch::Epoch;
+        use syntax::edition::Edition;
 
         $(
             pub fn $opt(cg: &mut $struct_name, v: Option<&str>) -> bool {
@@ -983,11 +983,11 @@ fn parse_lto(slot: &mut Lto, v: Option<&str>) -> bool {
             true
         }
 
-        fn parse_epoch(slot: &mut Epoch, v: Option<&str>) -> bool {
+        fn parse_edition(slot: &mut Edition, v: Option<&str>) -> bool {
             match v {
                 Some(s) => {
-                    let epoch = s.parse();
-                    if let Ok(parsed) = epoch {
+                    let edition = s.parse();
+                    if let Ok(parsed) = edition {
                         *slot = parsed;
                         true
                     } else {
@@ -1280,10 +1280,10 @@ fn parse_epoch(slot: &mut Epoch, v: Option<&str>) -> bool {
         `everybody_loops` (all function bodies replaced with `loop {}`),
         `hir` (the HIR), `hir,identified`, or
         `hir,typed` (HIR with types for each node)."),
-    epoch: Epoch = (Epoch::Epoch2015, parse_epoch, [TRACKED],
-        "The epoch to build Rust with. Newer epochs may include features
-         that require breaking changes. The default epoch is 2015 (the first
-         epoch). Crates compiled with different epochs can be linked together."),
+    edition: Edition = (Edition::Edition2015, parse_edition, [TRACKED],
+        "The edition to build Rust with. Newer editions may include features
+         that require breaking changes. The default edition is 2015 (the first
+         edition). Crates compiled with different editions can be linked together."),
     run_dsymutil: Option<bool> = (None, parse_opt_bool, [TRACKED],
           "run `dsymutil` and delete intermediate object files"),
     ui_testing: bool = (false, parse_bool, [UNTRACKED],
@@ -2258,7 +2258,7 @@ mod dep_tracking {
     use std::hash::Hash;
     use std::path::PathBuf;
     use std::collections::hash_map::DefaultHasher;
-    use super::{CrateType, DebugInfoLevel, Epoch, ErrorOutputType, Lto, OptLevel, OutputTypes,
+    use super::{CrateType, DebugInfoLevel, Edition, ErrorOutputType, Lto, OptLevel, OutputTypes,
                 Passes, Sanitizer};
     use syntax::feature_gate::UnstableFeatures;
     use rustc_back::{PanicStrategy, RelroLevel};
@@ -2320,7 +2320,7 @@ fn hash(&self, hasher: &mut DefaultHasher, error_format: ErrorOutputType) {
     impl_dep_tracking_hash_via_hash!(cstore::NativeLibraryKind);
     impl_dep_tracking_hash_via_hash!(Sanitizer);
     impl_dep_tracking_hash_via_hash!(Option<Sanitizer>);
-    impl_dep_tracking_hash_via_hash!(Epoch);
+    impl_dep_tracking_hash_via_hash!(Edition);
 
     impl_dep_tracking_hash_for_sortable_vec_of!(String);
     impl_dep_tracking_hash_for_sortable_vec_of!(PathBuf);
index 3f52ecfc0999b5980e8c28498d5faf93f4f0413e..556255e06ed008a9b4564ab09701d5d153fc863f 100644 (file)
@@ -31,7 +31,7 @@
 use syntax::ast::NodeId;
 use errors::{self, DiagnosticBuilder, DiagnosticId};
 use errors::emitter::{Emitter, EmitterWriter};
-use syntax::epoch::Epoch;
+use syntax::edition::Edition;
 use syntax::json::JsonEmitter;
 use syntax::feature_gate;
 use syntax::symbol::Symbol;
@@ -976,13 +976,13 @@ pub fn teach(&self, code: &DiagnosticId) -> bool {
         self.opts.debugging_opts.teach && !self.parse_sess.span_diagnostic.code_emitted(code)
     }
 
-    /// Are we allowed to use features from the Rust 2018 epoch?
+    /// Are we allowed to use features from the Rust 2018 edition?
     pub fn rust_2018(&self) -> bool {
-        self.opts.debugging_opts.epoch >= Epoch::Epoch2018
+        self.opts.debugging_opts.edition >= Edition::Edition2018
     }
 
-    pub fn epoch(&self) -> Epoch {
-        self.opts.debugging_opts.epoch
+    pub fn edition(&self) -> Edition {
+        self.opts.debugging_opts.edition
     }
 }
 
index f2fe6542db171d02b6cf4c8926f02dfda2b00560..a3115544f30b954e1f4b6477b5928907401865e9 100644 (file)
@@ -648,7 +648,7 @@ pub fn phase_2_configure_and_expand_inner<'a, F>(sess: &'a Session,
 {
     let (mut krate, features) = syntax::config::features(krate, &sess.parse_sess,
                                                          sess.opts.test,
-                                                         sess.opts.debugging_opts.epoch);
+                                                         sess.opts.debugging_opts.edition);
     // these need to be set "early" so that expansion sees `quote` if enabled.
     sess.init_features(features);
 
index ce896bfb701baf5385b7aaafda9532b4869c15b1..59d2d3e8fdc07c3243694f8f5595892eaac697e6 100644 (file)
@@ -48,7 +48,7 @@
 use rustc::util;
 
 use session::Session;
-use syntax::epoch::Epoch;
+use syntax::edition::Edition;
 use lint::LintId;
 use lint::FutureIncompatibleInfo;
 
@@ -197,82 +197,82 @@ macro_rules! add_lint_group {
         FutureIncompatibleInfo {
             id: LintId::of(PRIVATE_IN_PUBLIC),
             reference: "issue #34537 <https://github.com/rust-lang/rust/issues/34537>",
-            epoch: None,
+            edition: None,
         },
         FutureIncompatibleInfo {
             id: LintId::of(PUB_USE_OF_PRIVATE_EXTERN_CRATE),
             reference: "issue #34537 <https://github.com/rust-lang/rust/issues/34537>",
-            epoch: None,
+            edition: None,
         },
         FutureIncompatibleInfo {
             id: LintId::of(PATTERNS_IN_FNS_WITHOUT_BODY),
             reference: "issue #35203 <https://github.com/rust-lang/rust/issues/35203>",
-            epoch: None,
+            edition: None,
         },
         FutureIncompatibleInfo {
             id: LintId::of(SAFE_EXTERN_STATICS),
             reference: "issue #36247 <https://github.com/rust-lang/rust/issues/36247>",
-            epoch: None,
+            edition: None,
         },
         FutureIncompatibleInfo {
             id: LintId::of(INVALID_TYPE_PARAM_DEFAULT),
             reference: "issue #36887 <https://github.com/rust-lang/rust/issues/36887>",
-            epoch: None,
+            edition: None,
         },
         FutureIncompatibleInfo {
             id: LintId::of(LEGACY_DIRECTORY_OWNERSHIP),
             reference: "issue #37872 <https://github.com/rust-lang/rust/issues/37872>",
-            epoch: None,
+            edition: None,
         },
         FutureIncompatibleInfo {
             id: LintId::of(LEGACY_IMPORTS),
             reference: "issue #38260 <https://github.com/rust-lang/rust/issues/38260>",
-            epoch: None,
+            edition: None,
         },
         FutureIncompatibleInfo {
             id: LintId::of(LEGACY_CONSTRUCTOR_VISIBILITY),
             reference: "issue #39207 <https://github.com/rust-lang/rust/issues/39207>",
-            epoch: None,
+            edition: None,
         },
         FutureIncompatibleInfo {
             id: LintId::of(MISSING_FRAGMENT_SPECIFIER),
             reference: "issue #40107 <https://github.com/rust-lang/rust/issues/40107>",
-            epoch: None,
+            edition: None,
         },
         FutureIncompatibleInfo {
             id: LintId::of(ILLEGAL_FLOATING_POINT_LITERAL_PATTERN),
             reference: "issue #41620 <https://github.com/rust-lang/rust/issues/41620>",
-            epoch: None,
+            edition: None,
         },
         FutureIncompatibleInfo {
             id: LintId::of(ANONYMOUS_PARAMETERS),
             reference: "issue #41686 <https://github.com/rust-lang/rust/issues/41686>",
-            epoch: None,
+            edition: None,
         },
         FutureIncompatibleInfo {
             id: LintId::of(PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES),
             reference: "issue #42238 <https://github.com/rust-lang/rust/issues/42238>",
-            epoch: None,
+            edition: None,
         },
         FutureIncompatibleInfo {
             id: LintId::of(LATE_BOUND_LIFETIME_ARGUMENTS),
             reference: "issue #42868 <https://github.com/rust-lang/rust/issues/42868>",
-            epoch: None,
+            edition: None,
         },
         FutureIncompatibleInfo {
             id: LintId::of(SAFE_PACKED_BORROWS),
             reference: "issue #46043 <https://github.com/rust-lang/rust/issues/46043>",
-            epoch: None,
+            edition: None,
         },
         FutureIncompatibleInfo {
             id: LintId::of(INCOHERENT_FUNDAMENTAL_IMPLS),
             reference: "issue #46205 <https://github.com/rust-lang/rust/issues/46205>",
-            epoch: None,
+            edition: None,
         },
         FutureIncompatibleInfo {
             id: LintId::of(TYVAR_BEHIND_RAW_POINTER),
             reference: "issue #46906 <https://github.com/rust-lang/rust/issues/46906>",
-            epoch: Some(Epoch::Epoch2018),
+            edition: Some(Edition::Edition2018),
         }
         ]);
 
index 4d344eb2799032f3d293ca72d169a5a3adf450cb..c7921d2bd45889645d5aa559158430d3fc7b868b 100644 (file)
@@ -326,7 +326,7 @@ fn create_steps(&self,
                     if reached_raw_pointer
                     && !self.tcx.features().arbitrary_self_types {
                         // this case used to be allowed by the compiler,
-                        // so we do a future-compat lint here for the 2015 epoch
+                        // so we do a future-compat lint here for the 2015 edition
                         // (see https://github.com/rust-lang/rust/issues/46906)
                         if self.tcx.sess.rust_2018() {
                           span_err!(self.tcx.sess, span, E0908,
index 6013c20daf23551c9492613f63320ad19d5baf97..56b1306e5b33f2336980a805fa02db46cf6c6f73 100644 (file)
@@ -13,7 +13,7 @@
 use {fold, attr};
 use ast;
 use codemap::Spanned;
-use epoch::Epoch;
+use edition::Edition;
 use parse::{token, ParseSess};
 
 use ptr::P;
@@ -27,7 +27,7 @@ pub struct StripUnconfigured<'a> {
 }
 
 // `cfg_attr`-process the crate's attributes and compute the crate's features.
-pub fn features(mut krate: ast::Crate, sess: &ParseSess, should_test: bool, epoch: Epoch)
+pub fn features(mut krate: ast::Crate, sess: &ParseSess, should_test: bool, edition: Edition)
                 -> (ast::Crate, Features) {
     let features;
     {
@@ -47,7 +47,7 @@ pub fn features(mut krate: ast::Crate, sess: &ParseSess, should_test: bool, epoc
             return (krate, Features::new());
         }
 
-        features = get_features(&sess.span_diagnostic, &krate.attrs, epoch);
+        features = get_features(&sess.span_diagnostic, &krate.attrs, edition);
 
         // Avoid reconfiguring malformed `cfg_attr`s
         if err_count == sess.span_diagnostic.err_count() {
diff --git a/src/libsyntax/edition.rs b/src/libsyntax/edition.rs
new file mode 100644 (file)
index 0000000..12ac641
--- /dev/null
@@ -0,0 +1,69 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::fmt;
+use std::str::FromStr;
+
+/// The edition of the compiler (RFC 2052)
+#[derive(Clone, Copy, Hash, PartialOrd, Ord, Eq, PartialEq, Debug)]
+#[non_exhaustive]
+pub enum Edition {
+    // editions must be kept in order, newest to oldest
+
+    /// The 2015 edition
+    Edition2015,
+    /// The 2018 edition
+    Edition2018,
+
+    // when adding new editions, be sure to update:
+    //
+    // - the list in the `parse_edition` static in librustc::session::config
+    // - add a `rust_####()` function to the session
+    // - update the enum in Cargo's sources as well
+    //
+    // When -Zedition becomes --edition, there will
+    // also be a check for the edition being nightly-only
+    // somewhere. That will need to be updated
+    // whenever we're stabilizing/introducing a new edition
+    // as well as changing the default Cargo template.
+}
+
+// must be in order from oldest to newest
+pub const ALL_EPOCHS: &[Edition] = &[Edition::Edition2015, Edition::Edition2018];
+
+impl fmt::Display for Edition {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        let s = match *self {
+            Edition::Edition2015 => "2015",
+            Edition::Edition2018 => "2018",
+        };
+        write!(f, "{}", s)
+    }
+}
+
+impl Edition {
+    pub fn lint_name(&self) -> &'static str {
+        match *self {
+            Edition::Edition2015 => "edition_2015",
+            Edition::Edition2018 => "edition_2018",
+        }
+    }
+}
+
+impl FromStr for Edition {
+    type Err = ();
+    fn from_str(s: &str) -> Result<Self, ()> {
+        match s {
+            "2015" => Ok(Edition::Edition2015),
+            "2018" => Ok(Edition::Edition2018),
+            _ => Err(())
+        }
+    }
+}
diff --git a/src/libsyntax/epoch.rs b/src/libsyntax/epoch.rs
deleted file mode 100644 (file)
index 32cbc79..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::fmt;
-use std::str::FromStr;
-
-/// The epoch of the compiler (RFC 2052)
-#[derive(Clone, Copy, Hash, PartialOrd, Ord, Eq, PartialEq, Debug)]
-#[non_exhaustive]
-pub enum Epoch {
-    // epochs must be kept in order, newest to oldest
-
-    /// The 2015 epoch
-    Epoch2015,
-    /// The 2018 epoch
-    Epoch2018,
-
-    // when adding new epochs, be sure to update:
-    //
-    // - the list in the `parse_epoch` static in librustc::session::config
-    // - add a `rust_####()` function to the session
-    // - update the enum in Cargo's sources as well
-    //
-    // When -Zepoch becomes --epoch, there will
-    // also be a check for the epoch being nightly-only
-    // somewhere. That will need to be updated
-    // whenever we're stabilizing/introducing a new epoch
-    // as well as changing the default Cargo template.
-}
-
-// must be in order from oldest to newest
-pub const ALL_EPOCHS: &[Epoch] = &[Epoch::Epoch2015, Epoch::Epoch2018];
-
-impl fmt::Display for Epoch {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        let s = match *self {
-            Epoch::Epoch2015 => "2015",
-            Epoch::Epoch2018 => "2018",
-        };
-        write!(f, "{}", s)
-    }
-}
-
-impl Epoch {
-    pub fn lint_name(&self) -> &'static str {
-        match *self {
-            Epoch::Epoch2015 => "epoch_2015",
-            Epoch::Epoch2018 => "epoch_2018",
-        }
-    }
-}
-
-impl FromStr for Epoch {
-    type Err = ();
-    fn from_str(s: &str) -> Result<Self, ()> {
-        match s {
-            "2015" => Ok(Epoch::Epoch2015),
-            "2018" => Ok(Epoch::Epoch2018),
-            _ => Err(())
-        }
-    }
-}
index 915396d29fe26c6ebaa96953b12c1aacd199ac55..8feb8d6a4020dd9161c6b2fdfde369777b3e3b21 100644 (file)
@@ -28,7 +28,7 @@
 use abi::Abi;
 use ast::{self, NodeId, PatKind, RangeEnd};
 use attr;
-use epoch::Epoch;
+use edition::Edition;
 use codemap::Spanned;
 use syntax_pos::{Span, DUMMY_SP};
 use errors::{DiagnosticBuilder, Handler, FatalError};
@@ -55,13 +55,13 @@ fn f(features: &mut Features, _: Span) {
 }
 
 macro_rules! declare_features {
-    ($((active, $feature: ident, $ver: expr, $issue: expr, $epoch: expr),)+) => {
+    ($((active, $feature: ident, $ver: expr, $issue: expr, $edition: expr),)+) => {
         /// Represents active features that are currently being implemented or
         /// currently being considered for addition/removal.
         const ACTIVE_FEATURES:
                 &'static [(&'static str, &'static str, Option<u32>,
-                           Option<Epoch>, fn(&mut Features, Span))] =
-            &[$((stringify!($feature), $ver, $issue, $epoch, set!($feature))),+];
+                           Option<Edition>, fn(&mut Features, Span))] =
+            &[$((stringify!($feature), $ver, $issue, $edition, set!($feature))),+];
 
         /// A set of features to be used by later passes.
         #[derive(Clone)]
@@ -402,7 +402,7 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
     (active, match_default_bindings, "1.22.0", Some(42640), None),
 
     // Trait object syntax with `dyn` prefix
-    (active, dyn_trait, "1.22.0", Some(44662), Some(Epoch::Epoch2018)),
+    (active, dyn_trait, "1.22.0", Some(44662), Some(Edition::Edition2018)),
 
     // `crate` as visibility modifier, synonymous to `pub(crate)`
     (active, crate_visibility_modifier, "1.23.0", Some(45388), None),
@@ -1800,16 +1800,16 @@ fn visit_lifetime(&mut self, lt: &'a ast::Lifetime) {
 }
 
 pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute],
-                    epoch: Epoch) -> Features {
+                    edition: Edition) -> Features {
     let mut features = Features::new();
 
     let mut feature_checker = FeatureChecker::default();
 
-    for &(.., f_epoch, set) in ACTIVE_FEATURES.iter() {
-        if let Some(f_epoch) = f_epoch {
-            if epoch >= f_epoch {
+    for &(.., f_edition, set) in ACTIVE_FEATURES.iter() {
+        if let Some(f_edition) = f_edition {
+            if edition >= f_edition {
                 // FIXME(Manishearth) there is currently no way to set
-                // lang features by epoch
+                // lang features by edition
                 set(&mut features, DUMMY_SP);
             }
         }
index 5f58b3bc3a0503b4c2db1c03d693866d32e4b9b6..74f1ee373ec635afca4369065565c2b115eb58e8 100644 (file)
@@ -145,7 +145,7 @@ pub mod syntax {
 #[macro_use]
 pub mod config;
 pub mod entry;
-pub mod epoch;
+pub mod edition;
 pub mod feature_gate;
 pub mod fold;
 pub mod parse;
diff --git a/src/test/compile-fail/edition-raw-pointer-method-2015.rs b/src/test/compile-fail/edition-raw-pointer-method-2015.rs
new file mode 100644 (file)
index 0000000..fdc9b4f
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-tidy-linelength
+// compile-flags: -Zedition=2015 -Zunstable-options
+
+// tests that editions work with the tyvar warning-turned-error
+
+#[deny(warnings)]
+fn main() {
+    let x = 0;
+    let y = &x as *const _;
+    let _ = y.is_null();
+    //~^ error: type annotations needed [tyvar_behind_raw_pointer]
+    //~^^ warning: this was previously accepted
+}
diff --git a/src/test/compile-fail/edition-raw-pointer-method-2018.rs b/src/test/compile-fail/edition-raw-pointer-method-2018.rs
new file mode 100644 (file)
index 0000000..58b3459
--- /dev/null
@@ -0,0 +1,22 @@
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-tidy-linelength
+// compile-flags: -Zedition=2018 -Zunstable-options
+
+// tests that editions work with the tyvar warning-turned-error
+
+#[deny(warnings)]
+fn main() {
+    let x = 0;
+    let y = &x as *const _;
+    let _ = y.is_null();
+    //~^ error: the type of this value must be known to call a method on a raw pointer on it [E0908]
+}
diff --git a/src/test/compile-fail/epoch-raw-pointer-method-2015.rs b/src/test/compile-fail/epoch-raw-pointer-method-2015.rs
deleted file mode 100644 (file)
index 6aa83a3..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-tidy-linelength
-// compile-flags: -Zepoch=2015 -Zunstable-options
-
-// tests that epochs work with the tyvar warning-turned-error
-
-#[deny(warnings)]
-fn main() {
-    let x = 0;
-    let y = &x as *const _;
-    let _ = y.is_null();
-    //~^ error: type annotations needed [tyvar_behind_raw_pointer]
-    //~^^ warning: this was previously accepted
-}
diff --git a/src/test/compile-fail/epoch-raw-pointer-method-2018.rs b/src/test/compile-fail/epoch-raw-pointer-method-2018.rs
deleted file mode 100644 (file)
index c4815de..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-tidy-linelength
-// compile-flags: -Zepoch=2018 -Zunstable-options
-
-// tests that epochs work with the tyvar warning-turned-error
-
-#[deny(warnings)]
-fn main() {
-    let x = 0;
-    let y = &x as *const _;
-    let _ = y.is_null();
-    //~^ error: the type of this value must be known to call a method on a raw pointer on it [E0908]
-}
index fdec6a26ac945bace66b4fefb6303c506d9a6529..399823ec92d0c419eb91f48bac48a0d9dd347a02 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// ignore-pretty `dyn ::foo` parses differently in the current epoch
+// ignore-pretty `dyn ::foo` parses differently in the current edition
 
 #![feature(dyn_trait)]
 
index 37d092c06e02b76acc1c14236b51a8ed3d1db321..f3d8f216e1132e7edc3cbe9ffef27a15daef610d 100644 (file)
@@ -11,7 +11,7 @@
 // Checks if the correct registers are being used to pass arguments
 // when the sysv64 ABI is specified.
 
-// compile-flags: -Zepoch=2018
+// compile-flags: -Zedition=2018
 
 pub trait Foo {}
 
index eb40151615dad8b80950c6baee3459dd9b7b0725..fe6dc0b07482f60ac1a21da4eb6dd25626110693 100644 (file)
@@ -5,6 +5,6 @@ LL |     if data.is_null() {}
    |             ^^^^^^^
    |
    = note: #[warn(tyvar_behind_raw_pointer)] on by default
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 epoch!
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
    = note: for more information, see issue #46906 <https://github.com/rust-lang/rust/issues/46906>