File tree Expand file tree Collapse file tree 1 file changed +13
-28
lines changed
compiler/rustc_middle/src Expand file tree Collapse file tree 1 file changed +13
-28
lines changed Original file line number Diff line number Diff line change @@ -33,32 +33,17 @@ use std::ops::Index;
3333
3434pub mod visit;
3535
36- newtype_index ! {
37- /// An index to an [`Arm`] stored in [`Thir::arms`]
38- #[ derive( HashStable ) ]
39- pub struct ArmId {
40- DEBUG_FORMAT = "a{}"
41- }
42- }
43-
44- newtype_index ! {
45- /// An index to an [`Expr`] stored in [`Thir::exprs`]
46- #[ derive( HashStable ) ]
47- pub struct ExprId {
48- DEBUG_FORMAT = "e{}"
49- }
50- }
51-
52- newtype_index ! {
53- #[ derive( HashStable ) ]
54- /// An index to a [`Stmt`] stored in [`Thir::stmts`]
55- pub struct StmtId {
56- DEBUG_FORMAT = "s{}"
57- }
58- }
59-
6036macro_rules! thir_with_elements {
61- ( $( $name: ident: $id: ty => $value: ty, ) * ) => {
37+ ( $( $name: ident: $id: ty => $value: ty => $format: literal, ) * ) => {
38+ $(
39+ newtype_index! {
40+ #[ derive( HashStable ) ]
41+ pub struct $id {
42+ DEBUG_FORMAT = $format
43+ }
44+ }
45+ ) *
46+
6247 /// A container for a THIR body.
6348 ///
6449 /// This can be indexed directly by any THIR index (e.g. [`ExprId`]).
@@ -91,9 +76,9 @@ macro_rules! thir_with_elements {
9176}
9277
9378thir_with_elements ! {
94- arms: ArmId => Arm <' tcx>,
95- exprs: ExprId => Expr <' tcx>,
96- stmts: StmtId => Stmt <' tcx>,
79+ arms: ArmId => Arm <' tcx> => "a{}" ,
80+ exprs: ExprId => Expr <' tcx> => "e{}" ,
81+ stmts: StmtId => Stmt <' tcx> => "s{}" ,
9782}
9883
9984#[ derive( Copy , Clone , Debug , HashStable ) ]
You can’t perform that action at this time.
0 commit comments