diff --git a/tasks/ast_tools/src/passes/calc_layout.rs b/tasks/ast_tools/src/passes/calc_layout.rs index f3c6545c2..8afe0d0ed 100644 --- a/tasks/ast_tools/src/passes/calc_layout.rs +++ b/tasks/ast_tools/src/passes/calc_layout.rs @@ -21,9 +21,9 @@ compile_error!("This module only supports 64bit architectures."); type WellKnown = FxHashMap<&'static str, PlatformLayout>; -define_pass! { - pub struct CalcLayout; -} +pub struct CalcLayout; + +define_pass!(CalcLayout); impl Pass for CalcLayout { fn each(&mut self, ty: &mut AstType, ctx: &EarlyCtx) -> crate::Result { diff --git a/tasks/ast_tools/src/passes/linker.rs b/tasks/ast_tools/src/passes/linker.rs index 2a2d97b96..0be7ad086 100644 --- a/tasks/ast_tools/src/passes/linker.rs +++ b/tasks/ast_tools/src/passes/linker.rs @@ -27,9 +27,9 @@ impl Unresolved for Vec { } } -define_pass! { - pub struct Linker; -} +pub struct Linker; + +define_pass!(Linker); impl Pass for Linker { /// # Panics diff --git a/tasks/ast_tools/src/passes/mod.rs b/tasks/ast_tools/src/passes/mod.rs index 4328e4189..957e41fff 100644 --- a/tasks/ast_tools/src/passes/mod.rs +++ b/tasks/ast_tools/src/passes/mod.rs @@ -43,19 +43,26 @@ pub trait Pass { } macro_rules! define_pass { - ($vis:vis struct $ident:ident $($lifetime:lifetime)? $($rest:tt)*) => { - $vis struct $ident $($lifetime)? $($rest)* - impl $($lifetime)? $crate::codegen::Runner for $ident $($lifetime)? { - type Context = $crate::codegen::EarlyCtx; - type Output = (); - fn name(&self) -> &'static str { - stringify!($ident) - } + ($ident:ident $($lifetime:lifetime)?) => { + const _: () = { + use $crate::{ + codegen::{EarlyCtx, Runner}, + Result, + }; - fn run(&mut self, ctx: &Self::Context) -> $crate::Result { - self.call(ctx).map(|_| ()) + impl $($lifetime)? Runner for $ident $($lifetime)? { + type Context = EarlyCtx; + type Output = (); + + fn name(&self) -> &'static str { + stringify!($ident) + } + + fn run(&mut self, ctx: &Self::Context) -> Result<()> { + self.call(ctx).map(|_| ()) + } } - } + }; }; }