]> git.lizzy.rs Git - rust.git/commitdiff
syntax: Remove `#[non_exhaustive]` from `Edition`
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Sun, 2 Dec 2018 00:59:25 +0000 (03:59 +0300)
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Mon, 3 Dec 2018 21:30:27 +0000 (00:30 +0300)
`Edition` is not a public API, we want users to break when a new edition is added

src/librustc/ich/impls_syntax.rs
src/librustc/ty/context.rs
src/libsyntax/ext/tt/quoted.rs
src/libsyntax_pos/edition.rs
src/libsyntax_pos/hygiene.rs

index b629fb820b34dd85fc6e043b5d982c2974620c9a..b9ed0fcd4f38f5bad93a492734e238a2b2a25701 100644 (file)
@@ -134,14 +134,10 @@ fn to_stable_hash_key(&self,
     const_stability
 });
 
-impl<'a> HashStable<StableHashingContext<'a>>
-for ::syntax::edition::Edition {
-    fn hash_stable<W: StableHasherResult>(&self,
-                                          hcx: &mut StableHashingContext<'a>,
-                                          hasher: &mut StableHasher<W>) {
-        mem::discriminant(self).hash_stable(hcx, hasher);
-    }
-}
+impl_stable_hash_for!(enum ::syntax::edition::Edition {
+    Edition2015,
+    Edition2018,
+});
 
 impl<'a> HashStable<StableHashingContext<'a>>
 for ::syntax::attr::StabilityLevel {
index 7862a72433ae18f841dd1ed73ab5aef14bd38bd3..f041192413107b38845b019b857ee4390781529e 100644 (file)
@@ -1493,12 +1493,6 @@ pub fn borrowck_mode(&self) -> BorrowckMode {
             BorrowckMode::Ast => match self.sess.edition() {
                 Edition::Edition2015 => BorrowckMode::Ast,
                 Edition::Edition2018 => BorrowckMode::Migrate,
-
-                // For now, future editions mean Migrate. (But it
-                // would make a lot of sense for it to be changed to
-                // `BorrowckMode::Mir`, depending on how we plan to
-                // time the forcing of full migration to NLL.)
-                _ => BorrowckMode::Migrate,
             },
         }
     }
index edc431be3694ba020f9365b6aea8480dd3ba3e3b..a7415e845cae398b45aad0311139c9ab678b8b2b 100644 (file)
@@ -444,7 +444,6 @@ fn parse_sep_and_kleene_op<I>(
             macro_node_id,
         ),
         Edition::Edition2018 => parse_sep_and_kleene_op_2018(input, span, sess, features, attrs),
-        _ => unimplemented!(),
     }
 }
 
index 5819cd7f480a039ded2eef959be9cac7845bfada..d57078ce914078375dab2ae8bf575d7715aebe3a 100644 (file)
@@ -13,7 +13,6 @@
 
 /// The edition of the compiler (RFC 2052)
 #[derive(Clone, Copy, Hash, PartialEq, PartialOrd, Debug, RustcEncodable, RustcDecodable, Eq)]
-#[non_exhaustive]
 pub enum Edition {
     // editions must be kept in order, oldest to newest
 
index bc52a3e1c7c297ee35cd090f4e94e148b1b1b50f..074687fc726e8fd209d4e5c69df09d15a8d128e0 100644 (file)
@@ -17,7 +17,7 @@
 
 use GLOBALS;
 use Span;
-use edition::Edition;
+use edition::{Edition, DEFAULT_EDITION};
 use symbol::Symbol;
 
 use serialize::{Encodable, Decodable, Encoder, Decoder};
@@ -217,7 +217,7 @@ impl HygieneData {
                 opaque_and_semitransparent: SyntaxContext(0),
             }],
             markings: FxHashMap::default(),
-            default_edition: Edition::Edition2015,
+            default_edition: DEFAULT_EDITION,
         }
     }