1
1
// Decoding metadata from a single crate's metadata
2
2
3
- use crate :: cstore:: { self , CrateMetadata , MetadataBlob , NativeLibrary , ForeignModule , FullProcMacro } ;
3
+ use crate :: cstore:: { self , CrateMetadata , MetadataBlob , NativeLibrary , ForeignModule } ;
4
4
use crate :: schema:: * ;
5
5
6
6
use rustc_data_structures:: indexed_vec:: IndexVec ;
@@ -512,26 +512,8 @@ impl<'a, 'tcx> CrateMetadata {
512
512
self . entry ( index) . span . decode ( ( self , sess) )
513
513
}
514
514
515
-
516
- pub fn get_proc_macro ( & self , id : DefIndex , sess : & Session ) -> FullProcMacro {
517
- if sess. opts . debugging_opts . dual_proc_macros {
518
- let host_lib = self . host_lib . as_ref ( ) . unwrap ( ) ;
519
- self . load_proc_macro (
520
- & host_lib. metadata . get_root ( ) ,
521
- id,
522
- sess
523
- )
524
- } else {
525
- self . load_proc_macro ( & self . root , id, sess)
526
- }
527
- }
528
-
529
- fn load_proc_macro ( & self , root : & CrateRoot < ' _ > ,
530
- id : DefIndex ,
531
- sess : & Session )
532
- -> FullProcMacro {
533
- let raw_macro = self . raw_proc_macro ( id) ;
534
- let ( name, kind, helper_attrs) = match * raw_macro {
515
+ crate fn load_proc_macro ( & self , id : DefIndex , sess : & Session ) -> SyntaxExtension {
516
+ let ( name, kind, helper_attrs) = match * self . raw_proc_macro ( id) {
535
517
ProcMacro :: CustomDerive { trait_name, attributes, client } => {
536
518
let helper_attrs =
537
519
attributes. iter ( ) . cloned ( ) . map ( Symbol :: intern) . collect :: < Vec < _ > > ( ) ;
@@ -550,20 +532,21 @@ impl<'a, 'tcx> CrateMetadata {
550
532
name, SyntaxExtensionKind :: Bang ( Box :: new ( BangProcMacro { client } ) ) , Vec :: new ( )
551
533
)
552
534
} ;
553
- let name = Symbol :: intern ( name) ;
554
-
555
- FullProcMacro {
556
- name,
557
- ext : Lrc :: new ( SyntaxExtension :: new (
558
- & sess. parse_sess ,
559
- kind,
560
- self . get_span ( id, sess) ,
561
- helper_attrs,
562
- root. edition ,
563
- name,
564
- & self . get_attributes ( & self . entry ( id) , sess) ,
565
- ) ) ,
566
- }
535
+ let edition = if sess. opts . debugging_opts . dual_proc_macros {
536
+ self . host_lib . as_ref ( ) . unwrap ( ) . metadata . get_root ( ) . edition
537
+ } else {
538
+ self . root . edition
539
+ } ;
540
+
541
+ SyntaxExtension :: new (
542
+ & sess. parse_sess ,
543
+ kind,
544
+ self . get_span ( id, sess) ,
545
+ helper_attrs,
546
+ edition,
547
+ Symbol :: intern ( name) ,
548
+ & self . get_attributes ( & self . entry ( id) , sess) ,
549
+ )
567
550
}
568
551
569
552
pub fn get_trait_def ( & self , item_id : DefIndex , sess : & Session ) -> ty:: TraitDef {
0 commit comments