]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_ast/src/lib.rs
Rollup merge of #84083 - ltratt:threadid_doc_tweak, r=dtolnay
[rust.git] / compiler / rustc_ast / src / lib.rs
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(label_break_value)]
15 #![feature(nll)]
16 #![feature(min_specialization)]
17 #![recursion_limit = "256"]
18 #![feature(slice_internals)]
19
20 #[macro_use]
21 extern crate rustc_macros;
22
23 pub mod util {
24     pub mod classify;
25     pub mod comments;
26     pub mod literal;
27     pub mod parser;
28     pub mod unicode;
29 }
30
31 pub mod ast;
32 pub mod ast_like;
33 pub mod attr;
34 pub mod entry;
35 pub mod expand;
36 pub mod mut_visit;
37 pub mod node_id;
38 pub mod ptr;
39 pub mod token;
40 pub mod tokenstream;
41 pub mod visit;
42
43 pub use self::ast::*;
44 pub use self::ast_like::AstLike;
45
46 use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
47
48 /// Requirements for a `StableHashingContext` to be used in this crate.
49 /// This is a hack to allow using the `HashStable_Generic` derive macro
50 /// instead of implementing everything in `rustc_middle`.
51 pub trait HashStableContext: rustc_span::HashStableContext {
52     fn hash_attr(&mut self, _: &ast::Attribute, hasher: &mut StableHasher);
53 }
54
55 impl<AstCtx: crate::HashStableContext> HashStable<AstCtx> for ast::Attribute {
56     fn hash_stable(&self, hcx: &mut AstCtx, hasher: &mut StableHasher) {
57         hcx.hash_attr(self, hasher)
58     }
59 }