diff --git a/src/librustc_data_structures/indexed_vec.rs b/src/librustc_data_structures/indexed_vec.rs index ce2468fb9f1..4b7f55eba06 100644 --- a/src/librustc_data_structures/indexed_vec.rs +++ b/src/librustc_data_structures/indexed_vec.rs @@ -51,7 +51,8 @@ macro_rules! newtype_index { impl $name { // HACK use for constants - pub const fn const_new(x: u32) -> Self { + #[allow(unused)] + const fn const_new(x: u32) -> Self { $name(x) } } diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index 68ef646184c..46a5e5abbdd 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -311,19 +311,7 @@ struct CFG<'tcx> { basic_blocks: IndexVec>, } -#[derive(Copy, Clone, Debug, PartialEq, Eq)] -pub struct ScopeId(u32); - -impl Idx for ScopeId { - fn new(index: usize) -> ScopeId { - assert!(index < (u32::MAX as usize)); - ScopeId(index as u32) - } - - fn index(self) -> usize { - self.0 as usize - } -} +newtype_index!(ScopeId); /////////////////////////////////////////////////////////////////////////// /// The `BlockAnd` "monad" packages up the new basic block along with a