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`).
41 lines
1.3 KiB
Rust
41 lines
1.3 KiB
Rust
// tidy-alphabetical-start
|
|
#![cfg_attr(all(feature = "nightly", test), feature(stmt_expr_attributes))]
|
|
#![cfg_attr(
|
|
feature = "nightly",
|
|
feature(extend_one, min_specialization, new_uninit, step_trait, test)
|
|
)]
|
|
#![cfg_attr(feature = "nightly", allow(internal_features))]
|
|
// tidy-alphabetical-end
|
|
|
|
pub mod bit_set;
|
|
#[cfg(feature = "nightly")]
|
|
pub mod interval;
|
|
|
|
mod idx;
|
|
mod slice;
|
|
mod vec;
|
|
|
|
pub use {idx::Idx, slice::IndexSlice, vec::IndexVec};
|
|
|
|
pub use rustc_index_macros::newtype_index;
|
|
|
|
/// Type size assertion. The first argument is a type and the second argument is its expected size.
|
|
///
|
|
/// <div class="warning">
|
|
///
|
|
/// Emitting hard errors from size assertions like this is generally not
|
|
/// 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.
|
|
///
|
|
/// </div>
|
|
#[macro_export]
|
|
macro_rules! static_assert_size {
|
|
($ty:ty, $size:expr) => {
|
|
const _: [(); $size] = [(); ::std::mem::size_of::<$ty>()];
|
|
};
|
|
}
|