@@ -131,9 +131,6 @@ pub struct Mir<'tcx> {
131131 cache : cache:: Cache ,
132132}
133133
134- /// where execution begins
135- pub const START_BLOCK : BasicBlock = BasicBlock ( 0 ) ;
136-
137134impl < ' tcx > Mir < ' tcx > {
138135 pub fn new (
139136 basic_blocks : IndexVec < BasicBlock , BasicBlockData < ' tcx > > ,
@@ -239,7 +236,7 @@ impl<'tcx> Mir<'tcx> {
239236
240237 #[ inline]
241238 pub fn local_kind ( & self , local : Local ) -> LocalKind {
242- let index = local. 0 as usize ;
239+ let index = local. as_usize ( ) ;
243240 if index == 0 {
244241 debug_assert ! (
245242 self . local_decls[ local] . mutability == Mutability :: Mut ,
@@ -523,11 +520,12 @@ impl BorrowKind {
523520///////////////////////////////////////////////////////////////////////////
524521// Variables and temps
525522
526- newtype_index ! ( Local
527- {
523+ newtype_index ! {
524+ pub struct Local {
528525 DEBUG_FORMAT = "_{}" ,
529526 const RETURN_PLACE = 0 ,
530- } ) ;
527+ }
528+ }
531529
532530/// Classifies locals into categories. See `Mir::local_kind`.
533531#[ derive( PartialEq , Eq , Debug ) ]
@@ -852,7 +850,12 @@ pub struct UpvarDecl {
852850///////////////////////////////////////////////////////////////////////////
853851// BasicBlock
854852
855- newtype_index ! ( BasicBlock { DEBUG_FORMAT = "bb{}" } ) ;
853+ newtype_index ! {
854+ pub struct BasicBlock {
855+ DEBUG_FORMAT = "bb{}" ,
856+ const START_BLOCK = 0 ,
857+ }
858+ }
856859
857860impl BasicBlock {
858861 pub fn start_location ( self ) -> Location {
@@ -1822,7 +1825,11 @@ pub type PlaceProjection<'tcx> = Projection<'tcx, Place<'tcx>, Local, Ty<'tcx>>;
18221825/// and the index is a local.
18231826pub type PlaceElem < ' tcx > = ProjectionElem < ' tcx , Local , Ty < ' tcx > > ;
18241827
1825- newtype_index ! ( Field { DEBUG_FORMAT = "field[{}]" } ) ;
1828+ newtype_index ! {
1829+ pub struct Field {
1830+ DEBUG_FORMAT = "field[{}]"
1831+ }
1832+ }
18261833
18271834impl < ' tcx > Place < ' tcx > {
18281835 pub fn field ( self , f : Field , ty : Ty < ' tcx > ) -> Place < ' tcx > {
@@ -1895,11 +1902,12 @@ impl<'tcx> Debug for Place<'tcx> {
18951902///////////////////////////////////////////////////////////////////////////
18961903// Scopes
18971904
1898- newtype_index ! ( SourceScope
1899- {
1905+ newtype_index ! {
1906+ pub struct SourceScope {
19001907 DEBUG_FORMAT = "scope[{}]" ,
19011908 const OUTERMOST_SOURCE_SCOPE = 0 ,
1902- } ) ;
1909+ }
1910+ }
19031911
19041912#[ derive( Clone , Debug , RustcEncodable , RustcDecodable ) ]
19051913pub struct SourceScopeData {
@@ -2271,7 +2279,11 @@ pub struct Constant<'tcx> {
22712279 pub literal : & ' tcx ty:: Const < ' tcx > ,
22722280}
22732281
2274- newtype_index ! ( Promoted { DEBUG_FORMAT = "promoted[{}]" } ) ;
2282+ newtype_index ! {
2283+ pub struct Promoted {
2284+ DEBUG_FORMAT = "promoted[{}]"
2285+ }
2286+ }
22752287
22762288impl < ' tcx > Debug for Constant < ' tcx > {
22772289 fn fmt ( & self , fmt : & mut Formatter ) -> fmt:: Result {
0 commit comments