@@ -1083,7 +1083,7 @@ pub trait AsMacroCall {
10831083 & self ,
10841084 db : & dyn ExpandDatabase ,
10851085 krate : CrateId ,
1086- resolver : impl Fn ( path:: ModPath ) -> Option < MacroDefId > ,
1086+ resolver : impl Fn ( path:: ModPath ) -> Option < MacroDefId > + Copy ,
10871087 ) -> Option < MacroCallId > {
10881088 self . as_call_id_with_errors ( db, krate, resolver) . ok ( ) ?. value
10891089 }
@@ -1092,7 +1092,7 @@ pub trait AsMacroCall {
10921092 & self ,
10931093 db : & dyn ExpandDatabase ,
10941094 krate : CrateId ,
1095- resolver : impl Fn ( path:: ModPath ) -> Option < MacroDefId > ,
1095+ resolver : impl Fn ( path:: ModPath ) -> Option < MacroDefId > + Copy ,
10961096 ) -> Result < ExpandResult < Option < MacroCallId > > , UnresolvedMacro > ;
10971097}
10981098
@@ -1101,7 +1101,7 @@ impl AsMacroCall for InFile<&ast::MacroCall> {
11011101 & self ,
11021102 db : & dyn ExpandDatabase ,
11031103 krate : CrateId ,
1104- resolver : impl Fn ( path:: ModPath ) -> Option < MacroDefId > ,
1104+ resolver : impl Fn ( path:: ModPath ) -> Option < MacroDefId > + Copy ,
11051105 ) -> Result < ExpandResult < Option < MacroCallId > > , UnresolvedMacro > {
11061106 let expands_to = hir_expand:: ExpandTo :: from_call_site ( self . value ) ;
11071107 let ast_id = AstId :: new ( self . file_id , db. ast_id_map ( self . file_id ) . ast_id ( self . value ) ) ;
@@ -1112,12 +1112,13 @@ impl AsMacroCall for InFile<&ast::MacroCall> {
11121112 return Ok ( ExpandResult :: only_err ( ExpandError :: other ( "malformed macro invocation" ) ) ) ;
11131113 } ;
11141114
1115- macro_call_as_call_id_ (
1115+ macro_call_as_call_id_with_eager (
11161116 db,
11171117 & AstIdWithPath :: new ( ast_id. file_id , ast_id. value , path) ,
11181118 expands_to,
11191119 krate,
11201120 resolver,
1121+ resolver,
11211122 )
11221123 }
11231124}
@@ -1140,17 +1141,19 @@ fn macro_call_as_call_id(
11401141 call : & AstIdWithPath < ast:: MacroCall > ,
11411142 expand_to : ExpandTo ,
11421143 krate : CrateId ,
1143- resolver : impl Fn ( path:: ModPath ) -> Option < MacroDefId > ,
1144+ resolver : impl Fn ( path:: ModPath ) -> Option < MacroDefId > + Copy ,
11441145) -> Result < Option < MacroCallId > , UnresolvedMacro > {
1145- macro_call_as_call_id_ ( db, call, expand_to, krate, resolver) . map ( |res| res. value )
1146+ macro_call_as_call_id_with_eager ( db, call, expand_to, krate, resolver, resolver)
1147+ . map ( |res| res. value )
11461148}
11471149
1148- fn macro_call_as_call_id_ (
1150+ fn macro_call_as_call_id_with_eager (
11491151 db : & dyn ExpandDatabase ,
11501152 call : & AstIdWithPath < ast:: MacroCall > ,
11511153 expand_to : ExpandTo ,
11521154 krate : CrateId ,
1153- resolver : impl Fn ( path:: ModPath ) -> Option < MacroDefId > ,
1155+ resolver : impl FnOnce ( path:: ModPath ) -> Option < MacroDefId > ,
1156+ eager_resolver : impl Fn ( path:: ModPath ) -> Option < MacroDefId > ,
11541157) -> Result < ExpandResult < Option < MacroCallId > > , UnresolvedMacro > {
11551158 let def =
11561159 resolver ( call. path . clone ( ) ) . ok_or_else ( || UnresolvedMacro { path : call. path . clone ( ) } ) ?;
@@ -1159,7 +1162,7 @@ fn macro_call_as_call_id_(
11591162 MacroDefKind :: BuiltInEager ( ..) => {
11601163 let macro_call = InFile :: new ( call. ast_id . file_id , call. ast_id . to_node ( db) ) ;
11611164 expand_eager_macro_input ( db, krate, macro_call, def, & |path| {
1162- resolver ( path) . filter ( MacroDefId :: is_fn_like)
1165+ eager_resolver ( path) . filter ( MacroDefId :: is_fn_like)
11631166 } )
11641167 }
11651168 _ if def. is_fn_like ( ) => ExpandResult {
0 commit comments