@@ -19,8 +19,12 @@ use hir_def::{
1919 AsMacroCall , DefWithBodyId , FunctionId , MacroId , TraitId , VariantId ,
2020} ;
2121use hir_expand:: {
22- attrs:: collect_attrs, db:: ExpandDatabase , files:: InRealFile , name:: AsName , InMacroFile ,
23- MacroCallId , MacroFileId , MacroFileIdExt ,
22+ attrs:: collect_attrs,
23+ builtin_fn_macro:: { BuiltinFnLikeExpander , EagerExpander } ,
24+ db:: ExpandDatabase ,
25+ files:: InRealFile ,
26+ name:: AsName ,
27+ InMacroFile , MacroCallId , MacroFileId , MacroFileIdExt ,
2428} ;
2529use itertools:: Itertools ;
2630use rustc_hash:: { FxHashMap , FxHashSet } ;
@@ -319,6 +323,30 @@ impl<'db> SemanticsImpl<'db> {
319323 } else {
320324 sa. expand ( self . db , macro_call) ?
321325 } ;
326+ let macro_call = self . db . lookup_intern_macro_call ( file_id. macro_call_id ) ;
327+
328+ match macro_call. def . kind {
329+ hir_expand:: MacroDefKind :: BuiltIn (
330+ _,
331+ BuiltinFnLikeExpander :: Cfg
332+ | BuiltinFnLikeExpander :: StdPanic
333+ | BuiltinFnLikeExpander :: Stringify
334+ | BuiltinFnLikeExpander :: CorePanic ,
335+ )
336+ | hir_expand:: MacroDefKind :: BuiltInEager (
337+ _,
338+ EagerExpander :: Env
339+ | EagerExpander :: Concat
340+ | EagerExpander :: Include
341+ | EagerExpander :: OptionEnv
342+ | EagerExpander :: IncludeStr
343+ | EagerExpander :: ConcatBytes
344+ | EagerExpander :: IncludeBytes ,
345+ ) => {
346+ // Do nothing and allow matching macros to be expanded
347+ }
348+ _ => return None ,
349+ }
322350
323351 let node = self . parse_or_expand ( file_id. into ( ) ) ;
324352 Some ( node)
0 commit comments