1 //! The Rust Abstract Syntax Tree (AST).
5 //! This API is completely unstable and subject to change.
8 html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
9 test(attr(deny(warnings)))
11 #![feature(associated_type_bounds)]
12 #![feature(box_patterns)]
13 #![feature(const_default_impls)]
14 #![feature(const_trait_impl)]
15 #![feature(if_let_guard)]
16 #![cfg_attr(bootstrap, feature(label_break_value))]
17 #![feature(let_chains)]
18 #![feature(min_specialization)]
19 #![feature(negative_impls)]
20 #![feature(slice_internals)]
21 #![feature(stmt_expr_attributes)]
22 #![recursion_limit = "256"]
23 #![deny(rustc::untranslatable_diagnostic)]
24 #![deny(rustc::diagnostic_outside_of_impl)]
27 extern crate rustc_macros;
50 pub use self::ast_traits::{AstDeref, AstNodeWrapper, HasAttrs, HasNodeId, HasSpan, HasTokens};
52 use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
54 /// Requirements for a `StableHashingContext` to be used in this crate.
55 /// This is a hack to allow using the `HashStable_Generic` derive macro
56 /// instead of implementing everything in `rustc_middle`.
57 pub trait HashStableContext: rustc_span::HashStableContext {
58 fn hash_attr(&mut self, _: &ast::Attribute, hasher: &mut StableHasher);
61 impl<AstCtx: crate::HashStableContext> HashStable<AstCtx> for ast::Attribute {
62 fn hash_stable(&self, hcx: &mut AstCtx, hasher: &mut StableHasher) {
63 hcx.hash_attr(self, hasher)