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;
33
33
34
34
pub mod visit;
35
35
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
-
60
36
macro_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
+
62
47
/// A container for a THIR body.
63
48
///
64
49
/// This can be indexed directly by any THIR index (e.g. [`ExprId`]).
@@ -91,9 +76,9 @@ macro_rules! thir_with_elements {
91
76
}
92
77
93
78
thir_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{}" ,
97
82
}
98
83
99
84
#[ derive( Copy , Clone , Debug , HashStable ) ]
You can’t perform that action at this time.
0 commit comments