1 //! The Rust parser and macro expander.
5 //! This API is completely unstable and subject to change.
7 #![doc(html_root_url = "https://doc.rust-lang.org/nightly/", test(attr(deny(warnings))))]
8 #![feature(bool_to_option)]
9 #![feature(box_syntax)]
10 #![feature(const_fn)] // For the `transmute` in `P::new`
11 #![feature(const_transmute)]
12 #![feature(crate_visibility_modifier)]
13 #![feature(label_break_value)]
15 #![feature(try_trait)]
16 #![feature(unicode_internals)]
17 #![recursion_limit = "256"]
20 macro_rules! unwrap_or {
21 ($opt:expr, $default:expr) => {
40 pub use attr::{with_default_globals, with_globals, GLOBALS};
50 use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
52 /// Requirements for a `StableHashingContext` to be used in this crate.
53 /// This is a hack to allow using the `HashStable_Generic` derive macro
54 /// instead of implementing everything in librustc.
55 pub trait HashStableContext: rustc_span::HashStableContext {
56 fn hash_attr(&mut self, _: &ast::Attribute, hasher: &mut StableHasher);
59 impl<AstCtx: crate::HashStableContext> HashStable<AstCtx> for ast::Attribute {
60 fn hash_stable(&self, hcx: &mut AstCtx, hasher: &mut StableHasher) {
61 hcx.hash_attr(self, hasher)