]> git.proxmox.com Git - rustc.git/blame_incremental - compiler/rustc_ast/src/lib.rs
New upstream version 1.58.1+dfsg1
[rustc.git] / compiler / rustc_ast / src / lib.rs
... / ...
CommitLineData
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]
22extern crate rustc_macros;
23
24pub mod util {
25 pub mod classify;
26 pub mod comments;
27 pub mod literal;
28 pub mod parser;
29 pub mod unicode;
30}
31
32pub mod ast;
33pub mod ast_like;
34pub mod attr;
35pub mod entry;
36pub mod expand;
37pub mod mut_visit;
38pub mod node_id;
39pub mod ptr;
40pub mod token;
41pub mod tokenstream;
42pub mod visit;
43
44pub use self::ast::*;
45pub use self::ast_like::AstLike;
46
47use 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`.
52pub trait HashStableContext: rustc_span::HashStableContext {
53 fn hash_attr(&mut self, _: &ast::Attribute, hasher: &mut StableHasher);
54}
55
56impl<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}