@@ -328,6 +328,8 @@ impl<'db> SemanticsImpl<'db> {
328328 Some ( node)
329329 }
330330
331+ /// Expands the macro if it isn't one of the built-in ones that expand to custom syntax or dummy
332+ /// expansions.
331333 pub fn expand_allowed_builtins ( & self , macro_call : & ast:: MacroCall ) -> Option < SyntaxNode > {
332334 let sa = self . analyze_no_infer ( macro_call. syntax ( ) ) ?;
333335
@@ -341,33 +343,27 @@ impl<'db> SemanticsImpl<'db> {
341343 } ;
342344 let macro_call = self . db . lookup_intern_macro_call ( file_id. macro_call_id ) ;
343345
344- match macro_call. def . kind {
346+ let skip = matches ! (
347+ macro_call. def. kind,
345348 hir_expand:: MacroDefKind :: BuiltIn (
346349 _,
347- BuiltinFnLikeExpander :: Cfg
348- | BuiltinFnLikeExpander :: StdPanic
349- | BuiltinFnLikeExpander :: Stringify
350- | BuiltinFnLikeExpander :: CorePanic ,
351- )
352- | hir_expand:: MacroDefKind :: BuiltInEager (
353- _,
354- EagerExpander :: Env
355- | EagerExpander :: Concat
356- | EagerExpander :: Include
357- | EagerExpander :: OptionEnv
358- | EagerExpander :: IncludeStr
359- | EagerExpander :: ConcatBytes
360- | EagerExpander :: IncludeBytes ,
361- ) => {
362- // Do nothing and allow matching macros to be expanded
363- }
364-
365- hir_expand:: MacroDefKind :: BuiltIn ( _, _)
366- | hir_expand:: MacroDefKind :: BuiltInAttr ( _, _)
367- | hir_expand:: MacroDefKind :: BuiltInEager ( _, _)
368- | hir_expand:: MacroDefKind :: BuiltInDerive ( _, _) => return None ,
369-
370- _ => ( ) ,
350+ BuiltinFnLikeExpander :: Column
351+ | BuiltinFnLikeExpander :: File
352+ | BuiltinFnLikeExpander :: ModulePath
353+ | BuiltinFnLikeExpander :: Asm
354+ | BuiltinFnLikeExpander :: LlvmAsm
355+ | BuiltinFnLikeExpander :: GlobalAsm
356+ | BuiltinFnLikeExpander :: LogSyntax
357+ | BuiltinFnLikeExpander :: TraceMacros
358+ | BuiltinFnLikeExpander :: FormatArgs
359+ | BuiltinFnLikeExpander :: FormatArgsNl
360+ | BuiltinFnLikeExpander :: ConstFormatArgs ,
361+ ) | hir_expand:: MacroDefKind :: BuiltInEager ( _, EagerExpander :: CompileError )
362+ ) ;
363+ if skip {
364+ // these macros expand to custom builtin syntax and/or dummy things, no point in
365+ // showing these to the user
366+ return None ;
371367 }
372368
373369 let node = self . parse_or_expand ( file_id. into ( ) ) ;
0 commit comments