2022-08-18 18:27:29 +00:00
|
|
|
#![deny(rustc::untranslatable_diagnostic)]
|
|
|
|
#![deny(rustc::diagnostic_outside_of_impl)]
|
2022-11-06 21:06:11 +00:00
|
|
|
#![cfg_attr(
|
|
|
|
feature = "nightly",
|
|
|
|
feature(
|
|
|
|
allow_internal_unstable,
|
|
|
|
extend_one,
|
|
|
|
min_specialization,
|
|
|
|
new_uninit,
|
|
|
|
step_trait,
|
|
|
|
stmt_expr_attributes,
|
|
|
|
test
|
|
|
|
)
|
|
|
|
)]
|
2023-03-09 20:54:53 +00:00
|
|
|
#![cfg_attr(all(not(bootstrap), feature = "nightly"), allow(internal_features))]
|
2019-09-25 19:09:51 +00:00
|
|
|
|
2022-10-28 15:15:55 +00:00
|
|
|
#[cfg(feature = "nightly")]
|
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
|
|
|
|
2022-10-28 15:15:55 +00:00
|
|
|
#[cfg(feature = "rustc_macros")]
|
2022-02-09 22:24:51 +00:00
|
|
|
pub use rustc_macros::newtype_index;
|
|
|
|
|
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 06:57:36 +00:00
|
|
|
/// Note to the reader: 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.
|
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>()];
|
|
|
|
};
|
|
|
|
}
|