2021-11-02 21:10:31 -05:00
|
|
|
//! The Rust Abstract Syntax Tree (AST).
|
2014-06-09 13:12:30 -07:00
|
|
|
//!
|
|
|
|
|
//! # Note
|
|
|
|
|
//!
|
|
|
|
|
//! This API is completely unstable and subject to change.
|
2013-03-29 12:51:10 -07:00
|
|
|
|
Use `tidy` to sort crate attributes for all compiler crates.
We already do this for a number of crates, e.g. `rustc_middle`,
`rustc_span`, `rustc_metadata`, `rustc_span`, `rustc_errors`.
For the ones we don't, in many cases the attributes are a mess.
- There is no consistency about order of attribute kinds (e.g.
`allow`/`deny`/`feature`).
- Within attribute kind groups (e.g. the `feature` attributes),
sometimes the order is alphabetical, and sometimes there is no
particular order.
- Sometimes the attributes of a particular kind aren't even grouped
all together, e.g. there might be a `feature`, then an `allow`, then
another `feature`.
This commit extends the existing sorting to all compiler crates,
increasing consistency. If any new attribute line is added there is now
only one place it can go -- no need for arbitrary decisions.
Exceptions:
- `rustc_log`, `rustc_next_trait_solver` and `rustc_type_ir_macros`,
because they have no crate attributes.
- `rustc_codegen_gcc`, because it's quasi-external to rustc (e.g. it's
ignored in `rustfmt.toml`).
2024-06-12 13:49:36 +10:00
|
|
|
// tidy-alphabetical-start
|
|
|
|
|
#![allow(internal_features)]
|
2020-09-23 22:08:30 +02:00
|
|
|
#![doc(
|
|
|
|
|
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
|
|
|
|
|
test(attr(deny(warnings)))
|
|
|
|
|
)]
|
2023-11-13 07:39:17 -05:00
|
|
|
#![doc(rust_logo)]
|
2025-04-29 11:18:08 +10:00
|
|
|
#![feature(array_windows)]
|
2024-02-18 03:12:44 -05:00
|
|
|
#![feature(associated_type_defaults)]
|
2021-01-29 08:31:08 +01:00
|
|
|
#![feature(box_patterns)]
|
2021-08-16 17:29:49 +02:00
|
|
|
#![feature(if_let_guard)]
|
2022-05-01 20:58:24 +03:00
|
|
|
#![feature(negative_impls)]
|
Use `tidy` to sort crate attributes for all compiler crates.
We already do this for a number of crates, e.g. `rustc_middle`,
`rustc_span`, `rustc_metadata`, `rustc_span`, `rustc_errors`.
For the ones we don't, in many cases the attributes are a mess.
- There is no consistency about order of attribute kinds (e.g.
`allow`/`deny`/`feature`).
- Within attribute kind groups (e.g. the `feature` attributes),
sometimes the order is alphabetical, and sometimes there is no
particular order.
- Sometimes the attributes of a particular kind aren't even grouped
all together, e.g. there might be a `feature`, then an `allow`, then
another `feature`.
This commit extends the existing sorting to all compiler crates,
increasing consistency. If any new attribute line is added there is now
only one place it can go -- no need for arbitrary decisions.
Exceptions:
- `rustc_log`, `rustc_next_trait_solver` and `rustc_type_ir_macros`,
because they have no crate attributes.
- `rustc_codegen_gcc`, because it's quasi-external to rustc (e.g. it's
ignored in `rustfmt.toml`).
2024-06-12 13:49:36 +10:00
|
|
|
#![feature(never_type)]
|
|
|
|
|
#![feature(rustdoc_internals)]
|
2022-02-24 16:49:37 +11:00
|
|
|
#![feature(stmt_expr_attributes)]
|
2025-04-29 11:57:27 +10:00
|
|
|
#![recursion_limit = "256"]
|
Use `tidy` to sort crate attributes for all compiler crates.
We already do this for a number of crates, e.g. `rustc_middle`,
`rustc_span`, `rustc_metadata`, `rustc_span`, `rustc_errors`.
For the ones we don't, in many cases the attributes are a mess.
- There is no consistency about order of attribute kinds (e.g.
`allow`/`deny`/`feature`).
- Within attribute kind groups (e.g. the `feature` attributes),
sometimes the order is alphabetical, and sometimes there is no
particular order.
- Sometimes the attributes of a particular kind aren't even grouped
all together, e.g. there might be a `feature`, then an `allow`, then
another `feature`.
This commit extends the existing sorting to all compiler crates,
increasing consistency. If any new attribute line is added there is now
only one place it can go -- no need for arbitrary decisions.
Exceptions:
- `rustc_log`, `rustc_next_trait_solver` and `rustc_type_ir_macros`,
because they have no crate attributes.
- `rustc_codegen_gcc`, because it's quasi-external to rustc (e.g. it's
ignored in `rustfmt.toml`).
2024-06-12 13:49:36 +10:00
|
|
|
// tidy-alphabetical-end
|
2014-01-09 15:05:33 +02:00
|
|
|
|
2013-04-03 09:41:40 -07:00
|
|
|
pub mod util {
|
2022-09-15 20:27:23 +04:00
|
|
|
pub mod case;
|
2019-10-15 22:48:13 +02:00
|
|
|
pub mod classify;
|
2019-10-11 14:39:52 +02:00
|
|
|
pub mod comments;
|
2019-10-15 22:48:13 +02:00
|
|
|
pub mod literal;
|
2015-11-11 18:26:14 +13:00
|
|
|
pub mod parser;
|
2021-11-04 23:31:42 +01:00
|
|
|
pub mod unicode;
|
2013-04-03 09:41:40 -07:00
|
|
|
}
|
|
|
|
|
|
2013-01-29 14:41:40 -08:00
|
|
|
pub mod ast;
|
2022-05-01 20:58:24 +03:00
|
|
|
pub mod ast_traits;
|
2014-07-01 18:39:41 +02:00
|
|
|
pub mod attr;
|
2015-08-23 14:12:39 -04:00
|
|
|
pub mod entry;
|
2020-01-01 19:25:28 +01:00
|
|
|
pub mod expand;
|
2023-01-11 21:41:13 +01:00
|
|
|
pub mod format;
|
2019-02-06 09:10:05 +11:00
|
|
|
pub mod mut_visit;
|
2020-01-11 15:03:15 +01:00
|
|
|
pub mod node_id;
|
2014-05-18 00:46:40 +03:00
|
|
|
pub mod ptr;
|
2019-10-11 12:46:32 +02:00
|
|
|
pub mod token;
|
2016-06-20 08:49:33 -07:00
|
|
|
pub mod tokenstream;
|
2014-07-01 18:39:41 +02:00
|
|
|
pub mod visit;
|
2013-01-29 14:41:40 -08:00
|
|
|
|
2020-04-27 23:26:11 +05:30
|
|
|
pub use self::ast::*;
|
2025-05-09 13:18:19 +10:00
|
|
|
pub use self::ast_traits::{AstNodeWrapper, HasAttrs, HasNodeId, HasTokens};
|
2020-04-27 23:26:11 +05:30
|
|
|
|
2019-11-10 17:19:08 +01:00
|
|
|
/// Requirements for a `StableHashingContext` to be used in this crate.
|
|
|
|
|
/// This is a hack to allow using the `HashStable_Generic` derive macro
|
2021-04-07 14:47:01 -05:00
|
|
|
/// instead of implementing everything in `rustc_middle`.
|
2024-10-17 01:14:01 +02:00
|
|
|
pub trait HashStableContext: rustc_span::HashStableContext {}
|