]>
Commit | Line | Data |
---|---|---|
1 | //! The Rust Abstract Syntax Tree (AST). | |
2 | //! | |
3 | //! # Note | |
4 | //! | |
5 | //! This API is completely unstable and subject to change. | |
6 | ||
7 | #![doc( | |
8 | html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/", | |
9 | test(attr(deny(warnings))) | |
10 | )] | |
11 | #![feature(box_patterns)] | |
12 | #![feature(crate_visibility_modifier)] | |
13 | #![feature(if_let_guard)] | |
14 | #![feature(iter_zip)] | |
15 | #![feature(label_break_value)] | |
16 | #![feature(nll)] | |
17 | #![feature(min_specialization)] | |
18 | #![recursion_limit = "256"] | |
19 | #![feature(slice_internals)] | |
20 | ||
21 | #[macro_use] | |
22 | extern crate rustc_macros; | |
23 | ||
24 | pub mod util { | |
25 | pub mod classify; | |
26 | pub mod comments; | |
27 | pub mod literal; | |
28 | pub mod parser; | |
29 | pub mod unicode; | |
30 | } | |
31 | ||
32 | pub mod ast; | |
33 | pub mod ast_like; | |
34 | pub mod attr; | |
35 | pub mod entry; | |
36 | pub mod expand; | |
37 | pub mod mut_visit; | |
38 | pub mod node_id; | |
39 | pub mod ptr; | |
40 | pub mod token; | |
41 | pub mod tokenstream; | |
42 | pub mod visit; | |
43 | ||
44 | pub use self::ast::*; | |
45 | pub use self::ast_like::AstLike; | |
46 | ||
47 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; | |
48 | ||
49 | /// Requirements for a `StableHashingContext` to be used in this crate. | |
50 | /// This is a hack to allow using the `HashStable_Generic` derive macro | |
51 | /// instead of implementing everything in `rustc_middle`. | |
52 | pub trait HashStableContext: rustc_span::HashStableContext { | |
53 | fn hash_attr(&mut self, _: &ast::Attribute, hasher: &mut StableHasher); | |
54 | } | |
55 | ||
56 | impl<AstCtx: crate::HashStableContext> HashStable<AstCtx> for ast::Attribute { | |
57 | fn hash_stable(&self, hcx: &mut AstCtx, hasher: &mut StableHasher) { | |
58 | hcx.hash_attr(self, hasher) | |
59 | } | |
60 | } |