@@ -35,6 +35,7 @@ use std::{cmp, fs};
3535
3636use syntax:: ast;
3737use syntax:: attr;
38+ use syntax:: edition:: Edition ;
3839use syntax:: ext:: base:: SyntaxExtension ;
3940use syntax:: symbol:: Symbol ;
4041use syntax:: visit;
@@ -535,7 +536,10 @@ impl<'a> CrateLoader<'a> {
535536 mem:: transmute :: < * mut u8 , fn ( & mut Registry ) > ( sym)
536537 } ;
537538
538- struct MyRegistrar ( Vec < ( ast:: Name , Lrc < SyntaxExtension > ) > ) ;
539+ struct MyRegistrar {
540+ extensions : Vec < ( ast:: Name , Lrc < SyntaxExtension > ) > ,
541+ edition : Edition ,
542+ }
539543
540544 impl Registry for MyRegistrar {
541545 fn register_custom_derive ( & mut self ,
@@ -544,36 +548,38 @@ impl<'a> CrateLoader<'a> {
544548 attributes : & [ & ' static str ] ) {
545549 let attrs = attributes. iter ( ) . cloned ( ) . map ( Symbol :: intern) . collect :: < Vec < _ > > ( ) ;
546550 let derive = ProcMacroDerive :: new ( expand, attrs. clone ( ) ) ;
547- let derive = SyntaxExtension :: ProcMacroDerive ( Box :: new ( derive) , attrs) ;
548- self . 0 . push ( ( Symbol :: intern ( trait_name) , Lrc :: new ( derive) ) ) ;
551+ let derive = SyntaxExtension :: ProcMacroDerive (
552+ Box :: new ( derive) , attrs, self . edition
553+ ) ;
554+ self . extensions . push ( ( Symbol :: intern ( trait_name) , Lrc :: new ( derive) ) ) ;
549555 }
550556
551557 fn register_attr_proc_macro ( & mut self ,
552558 name : & str ,
553559 expand : fn ( TokenStream , TokenStream ) -> TokenStream ) {
554560 let expand = SyntaxExtension :: AttrProcMacro (
555- Box :: new ( AttrProcMacro { inner : expand } )
561+ Box :: new ( AttrProcMacro { inner : expand } ) , self . edition
556562 ) ;
557- self . 0 . push ( ( Symbol :: intern ( name) , Lrc :: new ( expand) ) ) ;
563+ self . extensions . push ( ( Symbol :: intern ( name) , Lrc :: new ( expand) ) ) ;
558564 }
559565
560566 fn register_bang_proc_macro ( & mut self ,
561567 name : & str ,
562568 expand : fn ( TokenStream ) -> TokenStream ) {
563569 let expand = SyntaxExtension :: ProcMacro (
564- Box :: new ( BangProcMacro { inner : expand } )
570+ Box :: new ( BangProcMacro { inner : expand } ) , self . edition
565571 ) ;
566- self . 0 . push ( ( Symbol :: intern ( name) , Lrc :: new ( expand) ) ) ;
572+ self . extensions . push ( ( Symbol :: intern ( name) , Lrc :: new ( expand) ) ) ;
567573 }
568574 }
569575
570- let mut my_registrar = MyRegistrar ( Vec :: new ( ) ) ;
576+ let mut my_registrar = MyRegistrar { extensions : Vec :: new ( ) , edition : root . edition } ;
571577 registrar ( & mut my_registrar) ;
572578
573579 // Intentionally leak the dynamic library. We can't ever unload it
574580 // since the library can make things that will live arbitrarily long.
575581 mem:: forget ( lib) ;
576- my_registrar. 0
582+ my_registrar. extensions
577583 }
578584
579585 /// Look for a plugin registrar. Returns library path, crate
0 commit comments