]> git.proxmox.com Git - rustc.git/blame - compiler/rustc_ast/src/lib.rs
New upstream version 1.58.1+dfsg1
[rustc.git] / compiler / rustc_ast / src / lib.rs
CommitLineData
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)]
5869c6ff 11#![feature(box_patterns)]
8faf50e0 12#![feature(crate_visibility_modifier)]
94222f64 13#![feature(if_let_guard)]
cdc7bbd5 14#![feature(iter_zip)]
9fa01778 15#![feature(label_break_value)]
0bf4aa26 16#![feature(nll)]
17df50a5 17#![feature(min_specialization)]
dfeec247 18#![recursion_limit = "256"]
3c0e092e 19#![feature(slice_internals)]
1a4d82fc 20
3dfed10e 21#[macro_use]
f9f354fc
XL
22extern crate rustc_macros;
23
970d7e83 24pub mod util {
60c5eb7d
XL
25 pub mod classify;
26 pub mod comments;
60c5eb7d 27 pub mod literal;
92a42be0 28 pub mod parser;
3c0e092e 29 pub mod unicode;
970d7e83 30}
223e47cc 31
223e47cc 32pub mod ast;
6a06907d 33pub mod ast_like;
1a4d82fc 34pub mod attr;
e9174d1e 35pub mod entry;
dfeec247 36pub mod expand;
9fa01778 37pub mod mut_visit;
74b04a01 38pub mod node_id;
1a4d82fc 39pub mod ptr;
60c5eb7d 40pub mod token;
3157f602 41pub mod tokenstream;
1a4d82fc 42pub mod visit;
223e47cc 43
3dfed10e 44pub use self::ast::*;
6a06907d 45pub use self::ast_like::AstLike;
3dfed10e 46
dfeec247 47use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
60c5eb7d
XL
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
cdc7bbd5 51/// instead of implementing everything in `rustc_middle`.
dfeec247
XL
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}