Skip to content

Commit d415844

Browse files
committed
syntax: Remove #[non_exhaustive] from Edition
`Edition` is not a public API, we want users to break when a new edition is added
1 parent 08f8fae commit d415844

File tree

5 files changed

+6
-18
lines changed

5 files changed

+6
-18
lines changed

src/librustc/ich/impls_syntax.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,10 @@ impl_stable_hash_for!(struct ::syntax::attr::Stability {
134134
const_stability
135135
});
136136

137-
impl<'a> HashStable<StableHashingContext<'a>>
138-
for ::syntax::edition::Edition {
139-
fn hash_stable<W: StableHasherResult>(&self,
140-
hcx: &mut StableHashingContext<'a>,
141-
hasher: &mut StableHasher<W>) {
142-
mem::discriminant(self).hash_stable(hcx, hasher);
143-
}
144-
}
137+
impl_stable_hash_for!(enum ::syntax::edition::Edition {
138+
Edition2015,
139+
Edition2018,
140+
});
145141

146142
impl<'a> HashStable<StableHashingContext<'a>>
147143
for ::syntax::attr::StabilityLevel {

src/librustc/ty/context.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,12 +1493,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
14931493
BorrowckMode::Ast => match self.sess.edition() {
14941494
Edition::Edition2015 => BorrowckMode::Ast,
14951495
Edition::Edition2018 => BorrowckMode::Migrate,
1496-
1497-
// For now, future editions mean Migrate. (But it
1498-
// would make a lot of sense for it to be changed to
1499-
// `BorrowckMode::Mir`, depending on how we plan to
1500-
// time the forcing of full migration to NLL.)
1501-
_ => BorrowckMode::Migrate,
15021496
},
15031497
}
15041498
}

src/libsyntax/ext/tt/quoted.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,6 @@ where
444444
macro_node_id,
445445
),
446446
Edition::Edition2018 => parse_sep_and_kleene_op_2018(input, span, sess, features, attrs),
447-
_ => unimplemented!(),
448447
}
449448
}
450449

src/libsyntax_pos/edition.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use std::str::FromStr;
1313

1414
/// The edition of the compiler (RFC 2052)
1515
#[derive(Clone, Copy, Hash, PartialEq, PartialOrd, Debug, RustcEncodable, RustcDecodable, Eq)]
16-
#[non_exhaustive]
1716
pub enum Edition {
1817
// editions must be kept in order, oldest to newest
1918

src/libsyntax_pos/hygiene.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
1818
use GLOBALS;
1919
use Span;
20-
use edition::Edition;
20+
use edition::{Edition, DEFAULT_EDITION};
2121
use symbol::Symbol;
2222

2323
use serialize::{Encodable, Decodable, Encoder, Decoder};
@@ -217,7 +217,7 @@ impl HygieneData {
217217
opaque_and_semitransparent: SyntaxContext(0),
218218
}],
219219
markings: FxHashMap::default(),
220-
default_edition: Edition::Edition2015,
220+
default_edition: DEFAULT_EDITION,
221221
}
222222
}
223223

0 commit comments

Comments
 (0)