@@ -21,8 +21,8 @@ use crate::{
2121 span_map:: { RealSpanMap , SpanMap , SpanMapRef } ,
2222 tt, AstId , BuiltinAttrExpander , BuiltinDeriveExpander , BuiltinFnLikeExpander ,
2323 CustomProcMacroExpander , EagerCallInfo , ExpandError , ExpandResult , ExpandTo , ExpansionSpanMap ,
24- HirFileId , HirFileIdRepr , MacroCallId , MacroCallKind , MacroCallLoc , MacroDefId , MacroDefKind ,
25- MacroFileId ,
24+ HirFileId , HirFileIdRepr , Lookup , MacroCallId , MacroCallKind , MacroCallLoc , MacroDefId ,
25+ MacroDefKind , MacroFileId ,
2626} ;
2727/// This is just to ensure the types of smart_macro_arg and macro_arg are the same
2828type MacroArgResult = ( Arc < tt:: Subtree > , SyntaxFixupUndoInfo , Span ) ;
@@ -99,6 +99,7 @@ pub trait ExpandDatabase: SourceDatabase {
9999 /// Lowers syntactic macro call to a token tree representation. That's a firewall
100100 /// query, only typing in the macro call itself changes the returned
101101 /// subtree.
102+ #[ deprecated = "calling this is incorrect, call `macro_arg_considering_derives` instead" ]
102103 fn macro_arg ( & self , id : MacroCallId ) -> MacroArgResult ;
103104 #[ salsa:: transparent]
104105 fn macro_arg_considering_derives (
@@ -140,7 +141,11 @@ pub trait ExpandDatabase: SourceDatabase {
140141fn syntax_context ( db : & dyn ExpandDatabase , file : HirFileId ) -> SyntaxContextId {
141142 match file. repr ( ) {
142143 HirFileIdRepr :: FileId ( _) => SyntaxContextId :: ROOT ,
143- HirFileIdRepr :: MacroFile ( m) => db. macro_arg ( m. macro_call_id ) . 2 . ctx ,
144+ HirFileIdRepr :: MacroFile ( m) => {
145+ db. macro_arg_considering_derives ( m. macro_call_id , & m. macro_call_id . lookup ( db) . kind )
146+ . 2
147+ . ctx
148+ }
144149 }
145150}
146151
@@ -393,6 +398,7 @@ pub(crate) fn parse_with_map(
393398/// Other wise return the [macro_arg] for the macro_call_id.
394399///
395400/// This is not connected to the database so it does not cached the result. However, the inner [macro_arg] query is
401+ #[ allow( deprecated) ] // we are macro_arg_considering_derives
396402fn macro_arg_considering_derives (
397403 db : & dyn ExpandDatabase ,
398404 id : MacroCallId ,
0 commit comments