@@ -25,13 +25,13 @@ extern crate ra_ap_rustc_abi as rustc_abi;
2525pub mod db;
2626
2727pub mod attr;
28- pub mod path;
2928pub mod builtin_type;
30- pub mod per_ns;
3129pub mod item_scope;
30+ pub mod path;
31+ pub mod per_ns;
3232
33- pub mod lower;
3433pub mod expander;
34+ pub mod lower;
3535
3636pub mod dyn_map;
3737
@@ -46,24 +46,24 @@ pub use self::hir::type_ref;
4646pub mod body;
4747pub mod resolver;
4848
49- mod trace;
5049pub mod nameres;
50+ mod trace;
5151
52- pub mod src;
5352pub mod child_by_source;
53+ pub mod src;
5454
55- pub mod visibility;
5655pub mod find_path;
5756pub mod import_map;
57+ pub mod visibility;
5858
5959pub use rustc_abi as layout;
6060use triomphe:: Arc ;
6161
62- #[ cfg( test) ]
63- mod test_db;
6462#[ cfg( test) ]
6563mod macro_expansion_tests;
6664mod pretty;
65+ #[ cfg( test) ]
66+ mod test_db;
6767
6868use std:: {
6969 hash:: { Hash , Hasher } ,
@@ -73,7 +73,6 @@ use std::{
7373use base_db:: { impl_intern_key, salsa, CrateId , Edition } ;
7474use hir_expand:: {
7575 ast_id_map:: { AstIdNode , FileAstId } ,
76- attrs:: { Attr , AttrId , AttrInput } ,
7776 builtin_attr_macro:: BuiltinAttrExpander ,
7877 builtin_derive_macro:: BuiltinDeriveExpander ,
7978 builtin_fn_macro:: { BuiltinFnLikeExpander , EagerExpander } ,
@@ -1274,60 +1273,6 @@ fn macro_call_as_call_id_with_eager(
12741273 Ok ( res)
12751274}
12761275
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-
13311276#[ derive( Debug ) ]
13321277pub struct UnresolvedMacro {
13331278 pub path : hir_expand:: mod_path:: ModPath ,
0 commit comments