@@ -508,9 +508,7 @@ impl<'db> SemanticsImpl<'db> {
508508 } )
509509 }
510510
511- pub fn is_derive_annotated ( & self , adt : & ast:: Adt ) -> bool {
512- let file_id = self . find_file ( adt. syntax ( ) ) . file_id ;
513- let adt = InFile :: new ( file_id, adt) ;
511+ pub fn is_derive_annotated ( & self , adt : InFile < & ast:: Adt > ) -> bool {
514512 self . with_ctx ( |ctx| ctx. has_derives ( adt) )
515513 }
516514
@@ -551,10 +549,8 @@ impl<'db> SemanticsImpl<'db> {
551549 res. is_empty ( ) . not ( ) . then_some ( res)
552550 }
553551
554- pub fn is_attr_macro_call ( & self , item : & ast:: Item ) -> bool {
555- let file_id = self . find_file ( item. syntax ( ) ) . file_id ;
556- let src = InFile :: new ( file_id, item) ;
557- self . with_ctx ( |ctx| ctx. item_to_macro_call ( src) . is_some ( ) )
552+ pub fn is_attr_macro_call ( & self , item : InFile < & ast:: Item > ) -> bool {
553+ self . with_ctx ( |ctx| ctx. item_to_macro_call ( item) . is_some ( ) )
558554 }
559555
560556 /// Expand the macro call with a different token tree, mapping the `token_to_map` down into the
@@ -1526,8 +1522,13 @@ impl<'db> SemanticsImpl<'db> {
15261522 self . analyze ( field. syntax ( ) ) ?. resolve_record_pat_field ( self . db , field)
15271523 }
15281524
1525+ // FIXME: Replace this with `resolve_macro_call2`
15291526 pub fn resolve_macro_call ( & self , macro_call : & ast:: MacroCall ) -> Option < Macro > {
15301527 let macro_call = self . find_file ( macro_call. syntax ( ) ) . with_value ( macro_call) ;
1528+ self . resolve_macro_call2 ( macro_call)
1529+ }
1530+
1531+ pub fn resolve_macro_call2 ( & self , macro_call : InFile < & ast:: MacroCall > ) -> Option < Macro > {
15311532 self . with_ctx ( |ctx| {
15321533 ctx. macro_call_to_macro_call ( macro_call)
15331534 . and_then ( |call| macro_call_to_macro_id ( ctx, call) )
@@ -1538,8 +1539,8 @@ impl<'db> SemanticsImpl<'db> {
15381539 } )
15391540 }
15401541
1541- pub fn is_proc_macro_call ( & self , macro_call : & ast:: MacroCall ) -> bool {
1542- self . resolve_macro_call ( macro_call)
1542+ pub fn is_proc_macro_call ( & self , macro_call : InFile < & ast:: MacroCall > ) -> bool {
1543+ self . resolve_macro_call2 ( macro_call)
15431544 . is_some_and ( |m| matches ! ( m. id, MacroId :: ProcMacroId ( ..) ) )
15441545 }
15451546
0 commit comments