Skip to content

Commit 0be280e

Browse files
committed
Simplify thir_with_elements macro.
The `field_name`/`field_ty` don't need to be parameters, they can be hardcoded.
1 parent 6d03fa7 commit 0be280e

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

compiler/rustc_middle/src/thir.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ pub mod visit;
3737

3838
macro_rules! thir_with_elements {
3939
(
40-
$($field_name:ident: $field_ty:ty,)*
41-
42-
@elements:
4340
$($name:ident: $id:ty => $value:ty => $format:literal,)*
4441
) => {
4542
$(
@@ -55,20 +52,16 @@ macro_rules! thir_with_elements {
5552
/// This can be indexed directly by any THIR index (e.g. [`ExprId`]).
5653
#[derive(Debug, HashStable, Clone)]
5754
pub struct Thir<'tcx> {
58-
$(
59-
pub $field_name: $field_ty,
60-
)*
55+
pub body_type: BodyTy<'tcx>,
6156
$(
6257
pub $name: IndexVec<$id, $value>,
6358
)*
6459
}
6560

6661
impl<'tcx> Thir<'tcx> {
67-
pub fn new($($field_name: $field_ty,)*) -> Thir<'tcx> {
62+
pub fn new(body_type: BodyTy<'tcx>) -> Thir<'tcx> {
6863
Thir {
69-
$(
70-
$field_name,
71-
)*
64+
body_type,
7265
$(
7366
$name: IndexVec::new(),
7467
)*
@@ -88,9 +81,6 @@ macro_rules! thir_with_elements {
8881
}
8982

9083
thir_with_elements! {
91-
body_type: BodyTy<'tcx>,
92-
93-
@elements:
9484
arms: ArmId => Arm<'tcx> => "a{}",
9585
blocks: BlockId => Block => "b{}",
9686
exprs: ExprId => Expr<'tcx> => "e{}",

0 commit comments

Comments
 (0)