diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2018-07-25 13:41:32 +0300 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2018-09-07 11:34:41 -0400 |
| commit | 1242639b88b0dee9ebb0f103efe017826c5b334e (patch) | |
| tree | 1bcce301506858bebdc7fd949ec2430db46586a0 /src/librustc/mir | |
| parent | 5a3292f163da3327523ddec5bc44d17c2378ec37 (diff) | |
| download | rust-1242639b88b0dee9ebb0f103efe017826c5b334e.tar.gz rust-1242639b88b0dee9ebb0f103efe017826c5b334e.zip | |
change syntax of `newtype_index` to look like a struct decl
Diffstat (limited to 'src/librustc/mir')
| -rw-r--r-- | src/librustc/mir/mod.rs | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index f66be6dc54d..3ab8de6de44 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -523,11 +523,12 @@ impl BorrowKind { /////////////////////////////////////////////////////////////////////////// // Variables and temps -newtype_index!(Local - { +newtype_index! { + pub struct Local { DEBUG_FORMAT = "_{}", const RETURN_PLACE = 0, - }); + } +} /// Classifies locals into categories. See `Mir::local_kind`. #[derive(PartialEq, Eq, Debug)] @@ -852,7 +853,11 @@ pub struct UpvarDecl { /////////////////////////////////////////////////////////////////////////// // BasicBlock -newtype_index!(BasicBlock { DEBUG_FORMAT = "bb{}" }); +newtype_index! { + pub struct BasicBlock { + DEBUG_FORMAT = "bb{}" + } +} impl BasicBlock { pub fn start_location(self) -> Location { @@ -1822,7 +1827,11 @@ pub type PlaceProjection<'tcx> = Projection<'tcx, Place<'tcx>, Local, Ty<'tcx>>; /// and the index is a local. pub type PlaceElem<'tcx> = ProjectionElem<'tcx, Local, Ty<'tcx>>; -newtype_index!(Field { DEBUG_FORMAT = "field[{}]" }); +newtype_index! { + pub struct Field { + DEBUG_FORMAT = "field[{}]" + } +} impl<'tcx> Place<'tcx> { pub fn field(self, f: Field, ty: Ty<'tcx>) -> Place<'tcx> { @@ -1895,11 +1904,12 @@ impl<'tcx> Debug for Place<'tcx> { /////////////////////////////////////////////////////////////////////////// // Scopes -newtype_index!(SourceScope - { +newtype_index! { + pub struct SourceScope { DEBUG_FORMAT = "scope[{}]", const OUTERMOST_SOURCE_SCOPE = 0, - }); + } +} #[derive(Clone, Debug, RustcEncodable, RustcDecodable)] pub struct SourceScopeData { @@ -2271,7 +2281,11 @@ pub struct Constant<'tcx> { pub literal: &'tcx ty::Const<'tcx>, } -newtype_index!(Promoted { DEBUG_FORMAT = "promoted[{}]" }); +newtype_index! { + pub struct Promoted { + DEBUG_FORMAT = "promoted[{}]" + } +} impl<'tcx> Debug for Constant<'tcx> { fn fmt(&self, fmt: &mut Formatter) -> fmt::Result { |
