Skip to content

Commit

Permalink
syntax: Remove #[non_exhaustive] from Edition
Browse files Browse the repository at this point in the history
`Edition` is not a public API, we want users to break when a new edition is added
  • Loading branch information
petrochenkov committed Dec 3, 2018
1 parent 08f8fae commit d415844
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 18 deletions.
12 changes: 4 additions & 8 deletions src/librustc/ich/impls_syntax.rs
Expand Up @@ -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 {
Expand Down
6 changes: 0 additions & 6 deletions src/librustc/ty/context.rs
Expand Up @@ -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,
},
}
}
Expand Down
1 change: 0 additions & 1 deletion src/libsyntax/ext/tt/quoted.rs
Expand Up @@ -444,7 +444,6 @@ where
macro_node_id,
),
Edition::Edition2018 => parse_sep_and_kleene_op_2018(input, span, sess, features, attrs),
_ => unimplemented!(),
}
}

Expand Down
1 change: 0 additions & 1 deletion src/libsyntax_pos/edition.rs
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/libsyntax_pos/hygiene.rs
Expand Up @@ -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};
Expand Down Expand Up @@ -217,7 +217,7 @@ impl HygieneData {
opaque_and_semitransparent: SyntaxContext(0),
}],
markings: FxHashMap::default(),
default_edition: Edition::Edition2015,
default_edition: DEFAULT_EDITION,
}
}

Expand Down

0 comments on commit d415844

Please sign in to comment.