@@ -17,8 +17,6 @@ use rustc::ty::{self, TyCtxt};
17
17
use rustc_ast:: ast;
18
18
use rustc_ast:: attr;
19
19
use rustc_ast:: expand:: allocator:: AllocatorKind ;
20
- use rustc_ast:: ptr:: P ;
21
- use rustc_ast:: tokenstream:: DelimSpan ;
22
20
use rustc_data_structures:: svh:: Svh ;
23
21
use rustc_hir as hir;
24
22
use rustc_hir:: def_id:: { CrateNum , DefId , DefIdMap , CRATE_DEF_INDEX , LOCAL_CRATE } ;
@@ -415,34 +413,28 @@ impl CStore {
415
413
}
416
414
417
415
let span = data. get_span ( id. index , sess) ;
418
- let dspan = DelimSpan :: from_single ( span) ;
419
- let rmeta:: MacroDef { body, legacy } = data. get_macro ( id. index , sess) ;
420
416
421
417
// Mark the attrs as used
422
418
let attrs = data. get_item_attrs ( id. index , sess) ;
423
419
for attr in attrs. iter ( ) {
424
420
attr:: mark_used ( attr) ;
425
421
}
426
422
427
- let name = data
423
+ let ident = data
428
424
. def_key ( id. index )
429
425
. disambiguated_data
430
426
. data
431
427
. get_opt_name ( )
428
+ . map ( ast:: Ident :: with_dummy_span) // FIXME: cross-crate hygiene
432
429
. expect ( "no name in load_macro" ) ;
433
- sess. imported_macro_spans . borrow_mut ( ) . insert ( span, ( name. to_string ( ) , span) ) ;
434
430
435
431
LoadedMacro :: MacroDef (
436
432
ast:: Item {
437
- // FIXME: cross-crate hygiene
438
- ident : ast:: Ident :: with_dummy_span ( name) ,
433
+ ident,
439
434
id : ast:: DUMMY_NODE_ID ,
440
435
span,
441
436
attrs : attrs. iter ( ) . cloned ( ) . collect ( ) ,
442
- kind : ast:: ItemKind :: MacroDef ( ast:: MacroDef {
443
- body : P ( ast:: MacArgs :: Delimited ( dspan, ast:: MacDelimiter :: Brace , body) ) ,
444
- legacy,
445
- } ) ,
437
+ kind : ast:: ItemKind :: MacroDef ( data. get_macro ( id. index , sess) ) ,
446
438
vis : source_map:: respan ( span. shrink_to_lo ( ) , ast:: VisibilityKind :: Inherited ) ,
447
439
tokens : None ,
448
440
} ,
0 commit comments