1#![cfg_attr(all(feature = "nightly", test), feature(stmt_expr_attributes))]
3#![cfg_attr(all(feature = "nightly", test), feature(test))]
4#![cfg_attr(feature = "nightly", feature(extend_one, step_trait))]
5#![allow(stable_features)]
10#![cfg_attr(feature = "nightly", feature(new_range_api))]
11
12pub mod bit_set;
13#[cfg(feature = "nightly")]
14pub mod interval;
15
16mod idx;
17mod slice;
18mod vec;
19
20pub use idx::{Idx, IntoSliceIdx};
21pub use rustc_index_macros::newtype_index;
22pub use slice::IndexSlice;
23#[doc(no_inline)]
24pub use vec::IndexVec;
25
26#[macro_export]
40#[cfg(not(feature = "rustc_randomized_layouts"))]
41macro_rules! static_assert_size {
42 ($ty:ty, $size:expr) => {
43 const _: [(); $size] = [(); ::std::mem::size_of::<$ty>()];
44 };
45}
46
47#[macro_export]
48#[cfg(feature = "rustc_randomized_layouts")]
49macro_rules! static_assert_size {
50 ($ty:ty, $size:expr) => {
51 const _: (usize, usize) = ($size, ::std::mem::size_of::<$ty>());
54 };
55}
56
57#[macro_export]
58macro_rules! indexvec {
59 ($expr:expr; $n:expr) => {
60 IndexVec::from_raw(vec![$expr; $n])
61 };
62 ($($expr:expr),* $(,)?) => {
63 IndexVec::from_raw(vec![$($expr),*])
64 };
65}