From ae84a71e4a7a4a6f695d6a77c1ed76cd1368fac3 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Sun, 18 Apr 2021 18:43:45 +0200 Subject: Expand `global_asm!` to nothing --- crates/hir_expand/src/builtin_macro.rs | 10 ++++++++++ crates/hir_expand/src/name.rs | 1 + 2 files changed, 11 insertions(+) diff --git a/crates/hir_expand/src/builtin_macro.rs b/crates/hir_expand/src/builtin_macro.rs index 80365fc16..179de61f9 100644 --- a/crates/hir_expand/src/builtin_macro.rs +++ b/crates/hir_expand/src/builtin_macro.rs @@ -110,6 +110,7 @@ register_builtin! { (format_args_nl, FormatArgsNl) => format_args_expand, (llvm_asm, LlvmAsm) => asm_expand, (asm, Asm) => asm_expand, + (global_asm, GlobalAsm) => global_asm_expand, (cfg, Cfg) => cfg_expand, (core_panic, CorePanic) => panic_expand, (std_panic, StdPanic) => panic_expand, @@ -274,6 +275,15 @@ fn asm_expand( ExpandResult::ok(expanded) } +fn global_asm_expand( + _db: &dyn AstDatabase, + _id: LazyMacroId, + _tt: &tt::Subtree, +) -> ExpandResult { + // Expand to nothing (at item-level) + ExpandResult::ok(quote! {}) +} + fn cfg_expand( db: &dyn AstDatabase, id: LazyMacroId, diff --git a/crates/hir_expand/src/name.rs b/crates/hir_expand/src/name.rs index a0f8766b0..bcfd3e524 100644 --- a/crates/hir_expand/src/name.rs +++ b/crates/hir_expand/src/name.rs @@ -221,6 +221,7 @@ pub mod known { option_env, llvm_asm, asm, + global_asm, // Builtin derives Copy, Clone, -- cgit v1.2.3