about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2025-02-03 08:04:54 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2025-02-04 08:34:11 +1100
commit0be280e52f43b65e1f32b5f10687ce440f77070e (patch)
tree58a5333165beedcf9cbaead47a8f723b2cbead0f /compiler/rustc_middle/src
parent6d03fa75192d4915c3b79ea2e4909aacd4881ebf (diff)
downloadrust-0be280e52f43b65e1f32b5f10687ce440f77070e.tar.gz
rust-0be280e52f43b65e1f32b5f10687ce440f77070e.zip
Simplify `thir_with_elements` macro.
The `field_name`/`field_ty` don't need to be parameters, they can be
hardcoded.
Diffstat (limited to 'compiler/rustc_middle/src')
-rw-r--r--compiler/rustc_middle/src/thir.rs16
1 files changed, 3 insertions, 13 deletions
diff --git a/compiler/rustc_middle/src/thir.rs b/compiler/rustc_middle/src/thir.rs
index d56046136c7..0236136af3f 100644
--- a/compiler/rustc_middle/src/thir.rs
+++ b/compiler/rustc_middle/src/thir.rs
@@ -37,9 +37,6 @@ pub mod visit;
 
 macro_rules! thir_with_elements {
     (
-        $($field_name:ident: $field_ty:ty,)*
-
-    @elements:
         $($name:ident: $id:ty => $value:ty => $format:literal,)*
     ) => {
         $(
@@ -55,20 +52,16 @@ macro_rules! thir_with_elements {
         /// This can be indexed directly by any THIR index (e.g. [`ExprId`]).
         #[derive(Debug, HashStable, Clone)]
         pub struct Thir<'tcx> {
-            $(
-                pub $field_name: $field_ty,
-            )*
+            pub body_type: BodyTy<'tcx>,
             $(
                 pub $name: IndexVec<$id, $value>,
             )*
         }
 
         impl<'tcx> Thir<'tcx> {
-            pub fn new($($field_name: $field_ty,)*) -> Thir<'tcx> {
+            pub fn new(body_type: BodyTy<'tcx>) -> Thir<'tcx> {
                 Thir {
-                    $(
-                        $field_name,
-                    )*
+                    body_type,
                     $(
                         $name: IndexVec::new(),
                     )*
@@ -88,9 +81,6 @@ macro_rules! thir_with_elements {
 }
 
 thir_with_elements! {
-    body_type: BodyTy<'tcx>,
-
-@elements:
     arms: ArmId => Arm<'tcx> => "a{}",
     blocks: BlockId => Block => "b{}",
     exprs: ExprId => Expr<'tcx> => "e{}",