]>
Commit | Line | Data |
---|---|---|
3c0e092e | 1 | //! The Rust Abstract Syntax Tree (AST). |
1a4d82fc JJ |
2 | //! |
3 | //! # Note | |
4 | //! | |
5 | //! This API is completely unstable and subject to change. | |
6 | ||
1b1a35ee XL |
7 | #![doc( |
8 | html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/", | |
9 | test(attr(deny(warnings))) | |
10 | )] | |
04454e1e | 11 | #![feature(associated_type_bounds)] |
5869c6ff | 12 | #![feature(box_patterns)] |
04454e1e FG |
13 | #![feature(const_default_impls)] |
14 | #![feature(const_trait_impl)] | |
94222f64 | 15 | #![feature(if_let_guard)] |
9fa01778 | 16 | #![feature(label_break_value)] |
5e7ed085 | 17 | #![feature(let_chains)] |
17df50a5 | 18 | #![feature(min_specialization)] |
04454e1e | 19 | #![feature(negative_impls)] |
3c0e092e | 20 | #![feature(slice_internals)] |
5e7ed085 FG |
21 | #![feature(stmt_expr_attributes)] |
22 | #![recursion_limit = "256"] | |
1a4d82fc | 23 | |
3dfed10e | 24 | #[macro_use] |
f9f354fc XL |
25 | extern crate rustc_macros; |
26 | ||
970d7e83 | 27 | pub mod util { |
60c5eb7d XL |
28 | pub mod classify; |
29 | pub mod comments; | |
60c5eb7d | 30 | pub mod literal; |
92a42be0 | 31 | pub mod parser; |
3c0e092e | 32 | pub mod unicode; |
970d7e83 | 33 | } |
223e47cc | 34 | |
223e47cc | 35 | pub mod ast; |
04454e1e | 36 | pub mod ast_traits; |
1a4d82fc | 37 | pub mod attr; |
e9174d1e | 38 | pub mod entry; |
dfeec247 | 39 | pub mod expand; |
9fa01778 | 40 | pub mod mut_visit; |
74b04a01 | 41 | pub mod node_id; |
1a4d82fc | 42 | pub mod ptr; |
60c5eb7d | 43 | pub mod token; |
3157f602 | 44 | pub mod tokenstream; |
1a4d82fc | 45 | pub mod visit; |
223e47cc | 46 | |
3dfed10e | 47 | pub use self::ast::*; |
04454e1e | 48 | pub use self::ast_traits::{AstDeref, AstNodeWrapper, HasAttrs, HasNodeId, HasSpan, HasTokens}; |
3dfed10e | 49 | |
dfeec247 | 50 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; |
60c5eb7d XL |
51 | |
52 | /// Requirements for a `StableHashingContext` to be used in this crate. | |
53 | /// This is a hack to allow using the `HashStable_Generic` derive macro | |
cdc7bbd5 | 54 | /// instead of implementing everything in `rustc_middle`. |
dfeec247 XL |
55 | pub trait HashStableContext: rustc_span::HashStableContext { |
56 | fn hash_attr(&mut self, _: &ast::Attribute, hasher: &mut StableHasher); | |
57 | } | |
58 | ||
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) | |
62 | } | |
63 | } |