`Edition` is not a public API, we want users to break when a new edition is added
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 {
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,
},
}
}
macro_node_id,
),
Edition::Edition2018 => parse_sep_and_kleene_op_2018(input, span, sess, features, attrs),
- _ => unimplemented!(),
}
}
/// 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
use GLOBALS;
use Span;
-use edition::Edition;
+use edition::{Edition, DEFAULT_EDITION};
use symbol::Symbol;
use serialize::{Encodable, Decodable, Encoder, Decoder};
opaque_and_semitransparent: SyntaxContext(0),
}],
markings: FxHashMap::default(),
- default_edition: Edition::Edition2015,
+ default_edition: DEFAULT_EDITION,
}
}