@@ -25,13 +25,13 @@ extern crate ra_ap_rustc_abi as rustc_abi;
25
25
pub mod db;
26
26
27
27
pub mod attr;
28
- pub mod path;
29
28
pub mod builtin_type;
30
- pub mod per_ns;
31
29
pub mod item_scope;
30
+ pub mod path;
31
+ pub mod per_ns;
32
32
33
- pub mod lower;
34
33
pub mod expander;
34
+ pub mod lower;
35
35
36
36
pub mod dyn_map;
37
37
@@ -46,24 +46,24 @@ pub use self::hir::type_ref;
46
46
pub mod body;
47
47
pub mod resolver;
48
48
49
- mod trace;
50
49
pub mod nameres;
50
+ mod trace;
51
51
52
- pub mod src;
53
52
pub mod child_by_source;
53
+ pub mod src;
54
54
55
- pub mod visibility;
56
55
pub mod find_path;
57
56
pub mod import_map;
57
+ pub mod visibility;
58
58
59
59
pub use rustc_abi as layout;
60
60
use triomphe:: Arc ;
61
61
62
- #[ cfg( test) ]
63
- mod test_db;
64
62
#[ cfg( test) ]
65
63
mod macro_expansion_tests;
66
64
mod pretty;
65
+ #[ cfg( test) ]
66
+ mod test_db;
67
67
68
68
use std:: {
69
69
hash:: { Hash , Hasher } ,
@@ -73,7 +73,6 @@ use std::{
73
73
use base_db:: { impl_intern_key, salsa, CrateId , Edition } ;
74
74
use hir_expand:: {
75
75
ast_id_map:: { AstIdNode , FileAstId } ,
76
- attrs:: { Attr , AttrId , AttrInput } ,
77
76
builtin_attr_macro:: BuiltinAttrExpander ,
78
77
builtin_derive_macro:: BuiltinDeriveExpander ,
79
78
builtin_fn_macro:: { BuiltinFnLikeExpander , EagerExpander } ,
@@ -1274,60 +1273,6 @@ fn macro_call_as_call_id_with_eager(
1274
1273
Ok ( res)
1275
1274
}
1276
1275
1277
- fn derive_macro_as_call_id (
1278
- db : & dyn DefDatabase ,
1279
- item_attr : & AstIdWithPath < ast:: Adt > ,
1280
- derive_attr_index : AttrId ,
1281
- derive_pos : u32 ,
1282
- call_site : Span ,
1283
- krate : CrateId ,
1284
- resolver : impl Fn ( path:: ModPath ) -> Option < ( MacroId , MacroDefId ) > ,
1285
- ) -> Result < ( MacroId , MacroDefId , MacroCallId ) , UnresolvedMacro > {
1286
- let ( macro_id, def_id) = resolver ( item_attr. path . clone ( ) )
1287
- . filter ( |( _, def_id) | def_id. is_derive ( ) )
1288
- . ok_or_else ( || UnresolvedMacro { path : item_attr. path . clone ( ) } ) ?;
1289
- let call_id = def_id. as_lazy_macro (
1290
- db. upcast ( ) ,
1291
- krate,
1292
- MacroCallKind :: Derive {
1293
- ast_id : item_attr. ast_id ,
1294
- derive_index : derive_pos,
1295
- derive_attr_index,
1296
- } ,
1297
- call_site,
1298
- ) ;
1299
- Ok ( ( macro_id, def_id, call_id) )
1300
- }
1301
-
1302
- fn attr_macro_as_call_id (
1303
- db : & dyn DefDatabase ,
1304
- item_attr : & AstIdWithPath < ast:: Item > ,
1305
- macro_attr : & Attr ,
1306
- krate : CrateId ,
1307
- def : MacroDefId ,
1308
- ) -> MacroCallId {
1309
- let arg = match macro_attr. input . as_deref ( ) {
1310
- Some ( AttrInput :: TokenTree ( tt) ) => {
1311
- let mut tt = tt. as_ref ( ) . clone ( ) ;
1312
- tt. delimiter = tt:: Delimiter :: invisible_spanned ( macro_attr. span ) ;
1313
- Some ( tt)
1314
- }
1315
-
1316
- _ => None ,
1317
- } ;
1318
-
1319
- def. as_lazy_macro (
1320
- db. upcast ( ) ,
1321
- krate,
1322
- MacroCallKind :: Attr {
1323
- ast_id : item_attr. ast_id ,
1324
- attr_args : arg. map ( Arc :: new) ,
1325
- invoc_attr_index : macro_attr. id ,
1326
- } ,
1327
- macro_attr. span ,
1328
- )
1329
- }
1330
-
1331
1276
#[ derive( Debug ) ]
1332
1277
pub struct UnresolvedMacro {
1333
1278
pub path : hir_expand:: mod_path:: ModPath ,
0 commit comments