@@ -508,9 +508,7 @@ impl<'db> SemanticsImpl<'db> {
508
508
} )
509
509
}
510
510
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 {
514
512
self . with_ctx ( |ctx| ctx. has_derives ( adt) )
515
513
}
516
514
@@ -551,10 +549,8 @@ impl<'db> SemanticsImpl<'db> {
551
549
res. is_empty ( ) . not ( ) . then_some ( res)
552
550
}
553
551
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 ( ) )
558
554
}
559
555
560
556
/// 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> {
1526
1522
self . analyze ( field. syntax ( ) ) ?. resolve_record_pat_field ( self . db , field)
1527
1523
}
1528
1524
1525
+ // FIXME: Replace this with `resolve_macro_call2`
1529
1526
pub fn resolve_macro_call ( & self , macro_call : & ast:: MacroCall ) -> Option < Macro > {
1530
1527
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 > {
1531
1532
self . with_ctx ( |ctx| {
1532
1533
ctx. macro_call_to_macro_call ( macro_call)
1533
1534
. and_then ( |call| macro_call_to_macro_id ( ctx, call) )
@@ -1538,8 +1539,8 @@ impl<'db> SemanticsImpl<'db> {
1538
1539
} )
1539
1540
}
1540
1541
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)
1543
1544
. is_some_and ( |m| matches ! ( m. id, MacroId :: ProcMacroId ( ..) ) )
1544
1545
}
1545
1546
0 commit comments