@@ -893,29 +893,29 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
893893 edition : ext. edition ( self . cx . parse_sess . edition ) ,
894894 } ;
895895
896- match * ext {
897- ProcMacroDerive ( ref ext, ..) => {
898- invoc. expansion_data . mark . set_expn_info ( expn_info) ;
899- let span = span. with_ctxt ( self . cx . backtrace ( ) ) ;
900- let dummy = ast:: MetaItem { // FIXME(jseyfried) avoid this
901- path : Path :: from_ident ( Ident :: invalid ( ) ) ,
902- span : DUMMY_SP ,
903- node : ast:: MetaItemKind :: Word ,
896+ match ext {
897+ ProcMacroDerive ( expander, ..) | BuiltinDerive ( expander) => {
898+ let meta = match ext {
899+ ProcMacroDerive ( ..) => ast:: MetaItem { // FIXME(jseyfried) avoid this
900+ path : Path :: from_ident ( Ident :: invalid ( ) ) ,
901+ span : DUMMY_SP ,
902+ node : ast:: MetaItemKind :: Word ,
903+ } ,
904+ _ => {
905+ expn_info. allow_internal_unstable = Some ( vec ! [
906+ sym:: rustc_attrs,
907+ Symbol :: intern( "derive_clone_copy" ) ,
908+ Symbol :: intern( "derive_eq" ) ,
909+ // RustcDeserialize and RustcSerialize
910+ Symbol :: intern( "libstd_sys_internals" ) ,
911+ ] . into ( ) ) ;
912+ attr. meta ( ) ?
913+ }
904914 } ;
905- let items = ext. expand ( self . cx , span, & dummy, item) ;
906- Some ( invoc. fragment_kind . expect_from_annotatables ( items) )
907- }
908- BuiltinDerive ( func) => {
909- expn_info. allow_internal_unstable = Some ( vec ! [
910- sym:: rustc_attrs,
911- Symbol :: intern( "derive_clone_copy" ) ,
912- Symbol :: intern( "derive_eq" ) ,
913- Symbol :: intern( "libstd_sys_internals" ) , // RustcDeserialize and RustcSerialize
914- ] . into ( ) ) ;
915+
915916 invoc. expansion_data . mark . set_expn_info ( expn_info) ;
916917 let span = span. with_ctxt ( self . cx . backtrace ( ) ) ;
917- let mut items = Vec :: new ( ) ;
918- func ( self . cx , span, & attr. meta ( ) ?, & item, & mut |a| items. push ( a) ) ;
918+ let items = expander. expand ( self . cx , span, & meta, item) ;
919919 Some ( invoc. fragment_kind . expect_from_annotatables ( items) )
920920 }
921921 _ => {
0 commit comments