]> git.proxmox.com Git - rustc.git/blame - compiler/rustc_ast/src/lib.rs
New upstream version 1.57.0+dfsg1
[rustc.git] / compiler / rustc_ast / src / lib.rs
CommitLineData
1a4d82fc
JJ
1//! The Rust parser and macro expander.
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"]
1a4d82fc 19
3dfed10e 20#[macro_use]
f9f354fc
XL
21extern crate rustc_macros;
22
970d7e83 23pub mod util {
60c5eb7d
XL
24 pub mod classify;
25 pub mod comments;
60c5eb7d 26 pub mod literal;
92a42be0 27 pub mod parser;
970d7e83 28}
223e47cc 29
223e47cc 30pub mod ast;
6a06907d 31pub mod ast_like;
1a4d82fc 32pub mod attr;
e9174d1e 33pub mod entry;
dfeec247 34pub mod expand;
9fa01778 35pub mod mut_visit;
74b04a01 36pub mod node_id;
1a4d82fc 37pub mod ptr;
60c5eb7d 38pub mod token;
3157f602 39pub mod tokenstream;
1a4d82fc 40pub mod visit;
223e47cc 41
3dfed10e 42pub use self::ast::*;
6a06907d 43pub use self::ast_like::AstLike;
3dfed10e 44
dfeec247 45use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
60c5eb7d
XL
46
47/// Requirements for a `StableHashingContext` to be used in this crate.
48/// This is a hack to allow using the `HashStable_Generic` derive macro
cdc7bbd5 49/// instead of implementing everything in `rustc_middle`.
dfeec247
XL
50pub trait HashStableContext: rustc_span::HashStableContext {
51 fn hash_attr(&mut self, _: &ast::Attribute, hasher: &mut StableHasher);
52}
53
54impl<AstCtx: crate::HashStableContext> HashStable<AstCtx> for ast::Attribute {
55 fn hash_stable(&self, hcx: &mut AstCtx, hasher: &mut StableHasher) {
56 hcx.hash_attr(self, hasher)
57 }
58}