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 #![cfg_attr(bootstrap, feature(slice_patterns))]
17 #![feature(unicode_internals)]
18 #![recursion_limit = "256"]
21 macro_rules! unwrap_or {
22 ($opt:expr, $default:expr) => {
41 pub use attr::{with_default_globals, with_globals, GLOBALS};
51 use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
53 /// Requirements for a `StableHashingContext` to be used in this crate.
54 /// This is a hack to allow using the `HashStable_Generic` derive macro
55 /// instead of implementing everything in librustc.
56 pub trait HashStableContext: rustc_span::HashStableContext {
57 fn hash_attr(&mut self, _: &ast::Attribute, hasher: &mut StableHasher);
60 impl<AstCtx: crate::HashStableContext> HashStable<AstCtx> for ast::Attribute {
61 fn hash_stable(&self, hcx: &mut AstCtx, hasher: &mut StableHasher) {
62 hcx.hash_attr(self, hasher)