syntax: Remove #[non_exhaustive] from Edition

`Edition` is not a public API, we want users to break when a new edition is added
This commit is contained in:
Vadim Petrochenkov 2018-12-02 03:59:25 +03:00
parent 08f8faedd0
commit d415844f5e
5 changed files with 6 additions and 18 deletions

View File

@ -134,14 +134,10 @@ impl_stable_hash_for!(struct ::syntax::attr::Stability {
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 {

View File

@ -1493,12 +1493,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
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,
},
}
}

View File

@ -444,7 +444,6 @@ where
macro_node_id,
),
Edition::Edition2018 => parse_sep_and_kleene_op_2018(input, span, sess, features, attrs),
_ => unimplemented!(),
}
}

View File

@ -13,7 +13,6 @@ use std::str::FromStr;
/// 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

View 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,
}
}