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 03:49:36 +00:00
|
|
|
// tidy-alphabetical-start
|
|
|
|
#![cfg_attr(all(feature = "nightly", test), feature(stmt_expr_attributes))]
|
2022-11-06 21:06:11 +00:00
|
|
|
#![cfg_attr(
|
|
|
|
feature = "nightly",
|
2024-01-14 20:08:47 +00:00
|
|
|
feature(extend_one, min_specialization, new_uninit, step_trait, test)
|
2022-11-06 21:06:11 +00:00
|
|
|
)]
|
2023-08-22 11:06:38 +00:00
|
|
|
#![cfg_attr(feature = "nightly", allow(internal_features))]
|
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 03:49:36 +00:00
|
|
|
// tidy-alphabetical-end
|
2019-09-25 19:09:51 +00:00
|
|
|
|
2019-09-26 03:26:16 +00:00
|
|
|
pub mod bit_set;
|
2022-10-28 15:15:55 +00:00
|
|
|
#[cfg(feature = "nightly")]
|
2021-11-05 18:50:29 +00:00
|
|
|
pub mod interval;
|
2023-04-19 10:57:17 +00:00
|
|
|
|
|
|
|
mod idx;
|
|
|
|
mod slice;
|
|
|
|
mod vec;
|
|
|
|
|
|
|
|
pub use {idx::Idx, slice::IndexSlice, vec::IndexVec};
|
2022-02-09 13:47:48 +00:00
|
|
|
|
2023-10-24 00:16:14 +00:00
|
|
|
pub use rustc_index_macros::newtype_index;
|
2022-02-09 22:24:51 +00:00
|
|
|
|
2022-02-09 13:47:48 +00:00
|
|
|
/// Type size assertion. The first argument is a type and the second argument is its expected size.
|
2023-08-22 08:19:57 +00:00
|
|
|
///
|
|
|
|
/// <div class="warning">
|
|
|
|
///
|
|
|
|
/// Emitting hard errors from size assertions like this is generally not
|
2023-08-22 06:57:36 +00:00
|
|
|
/// recommended, especially in libraries, because they can cause build failures if the layout
|
|
|
|
/// algorithm or dependencies change. Here in rustc we control the toolchain and layout algorithm,
|
|
|
|
/// so the former is not a problem. For the latter we have a lockfile as rustc is an application and
|
|
|
|
/// precompiled library.
|
|
|
|
///
|
|
|
|
/// Short version: Don't copy this macro into your own code. Use a `#[test]` instead.
|
2023-08-22 08:19:57 +00:00
|
|
|
///
|
|
|
|
/// </div>
|
2022-02-09 13:47:48 +00:00
|
|
|
#[macro_export]
|
|
|
|
macro_rules! static_assert_size {
|
|
|
|
($ty:ty, $size:expr) => {
|
|
|
|
const _: [(); $size] = [(); ::std::mem::size_of::<$ty>()];
|
|
|
|
};
|
|
|
|
}
|