@@ -131,9 +131,6 @@ pub struct Mir<'tcx> {
131
131
cache : cache:: Cache ,
132
132
}
133
133
134
- /// where execution begins
135
- pub const START_BLOCK : BasicBlock = BasicBlock ( 0 ) ;
136
-
137
134
impl < ' tcx > Mir < ' tcx > {
138
135
pub fn new (
139
136
basic_blocks : IndexVec < BasicBlock , BasicBlockData < ' tcx > > ,
@@ -239,7 +236,7 @@ impl<'tcx> Mir<'tcx> {
239
236
240
237
#[ inline]
241
238
pub fn local_kind ( & self , local : Local ) -> LocalKind {
242
- let index = local. 0 as usize ;
239
+ let index = local. as_usize ( ) ;
243
240
if index == 0 {
244
241
debug_assert ! (
245
242
self . local_decls[ local] . mutability == Mutability :: Mut ,
@@ -523,11 +520,12 @@ impl BorrowKind {
523
520
///////////////////////////////////////////////////////////////////////////
524
521
// Variables and temps
525
522
526
- newtype_index ! ( Local
527
- {
523
+ newtype_index ! {
524
+ pub struct Local {
528
525
DEBUG_FORMAT = "_{}" ,
529
526
const RETURN_PLACE = 0 ,
530
- } ) ;
527
+ }
528
+ }
531
529
532
530
/// Classifies locals into categories. See `Mir::local_kind`.
533
531
#[ derive( PartialEq , Eq , Debug ) ]
@@ -852,7 +850,12 @@ pub struct UpvarDecl {
852
850
///////////////////////////////////////////////////////////////////////////
853
851
// BasicBlock
854
852
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
+ }
856
859
857
860
impl BasicBlock {
858
861
pub fn start_location ( self ) -> Location {
@@ -1822,7 +1825,11 @@ pub type PlaceProjection<'tcx> = Projection<'tcx, Place<'tcx>, Local, Ty<'tcx>>;
1822
1825
/// and the index is a local.
1823
1826
pub type PlaceElem < ' tcx > = ProjectionElem < ' tcx , Local , Ty < ' tcx > > ;
1824
1827
1825
- newtype_index ! ( Field { DEBUG_FORMAT = "field[{}]" } ) ;
1828
+ newtype_index ! {
1829
+ pub struct Field {
1830
+ DEBUG_FORMAT = "field[{}]"
1831
+ }
1832
+ }
1826
1833
1827
1834
impl < ' tcx > Place < ' tcx > {
1828
1835
pub fn field ( self , f : Field , ty : Ty < ' tcx > ) -> Place < ' tcx > {
@@ -1895,11 +1902,12 @@ impl<'tcx> Debug for Place<'tcx> {
1895
1902
///////////////////////////////////////////////////////////////////////////
1896
1903
// Scopes
1897
1904
1898
- newtype_index ! ( SourceScope
1899
- {
1905
+ newtype_index ! {
1906
+ pub struct SourceScope {
1900
1907
DEBUG_FORMAT = "scope[{}]" ,
1901
1908
const OUTERMOST_SOURCE_SCOPE = 0 ,
1902
- } ) ;
1909
+ }
1910
+ }
1903
1911
1904
1912
#[ derive( Clone , Debug , RustcEncodable , RustcDecodable ) ]
1905
1913
pub struct SourceScopeData {
@@ -2271,7 +2279,11 @@ pub struct Constant<'tcx> {
2271
2279
pub literal : & ' tcx ty:: Const < ' tcx > ,
2272
2280
}
2273
2281
2274
- newtype_index ! ( Promoted { DEBUG_FORMAT = "promoted[{}]" } ) ;
2282
+ newtype_index ! {
2283
+ pub struct Promoted {
2284
+ DEBUG_FORMAT = "promoted[{}]"
2285
+ }
2286
+ }
2275
2287
2276
2288
impl < ' tcx > Debug for Constant < ' tcx > {
2277
2289
fn fmt ( & self , fmt : & mut Formatter ) -> fmt:: Result {
0 commit comments