@@ -243,7 +243,6 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
243
243
module. directory . pop ( ) ;
244
244
self . cx . root_path = module. directory . clone ( ) ;
245
245
self . cx . current_expansion . module = Rc :: new ( module) ;
246
- self . cx . current_expansion . crate_span = Some ( krate. span ) ;
247
246
248
247
let orig_mod_span = krate. module . inner ;
249
248
@@ -668,39 +667,17 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
668
667
} ;
669
668
let path = & mac. node . path ;
670
669
671
- let validate = |this : & mut Self | {
672
- // feature-gate the macro invocation
673
- if let Some ( ( feature, issue) ) = ext. unstable_feature {
674
- let crate_span = this. cx . current_expansion . crate_span . unwrap ( ) ;
675
- // don't stability-check macros in the same crate
676
- if !crate_span. contains ( ext. span )
677
- && !span. allows_unstable ( feature)
678
- && this. cx . ecfg . features . map_or ( true , |feats| {
679
- // macro features will count as lib features
680
- !feats. declared_lib_features . iter ( ) . any ( |& ( feat, _) | feat == feature)
681
- } ) {
682
- let explain = format ! ( "macro {}! is unstable" , path) ;
683
- emit_feature_err ( this. cx . parse_sess , feature, span,
684
- GateIssue :: Library ( Some ( issue) ) , & explain) ;
685
- this. cx . trace_macros_diag ( ) ;
686
- }
687
- }
688
-
689
- Ok ( ( ) )
690
- } ;
691
-
692
670
let opt_expanded = match & ext. kind {
671
+ SyntaxExtensionKind :: Bang ( expander) => {
672
+ self . gate_proc_macro_expansion_kind ( span, kind) ;
673
+ let tok_result = expander. expand ( self . cx , span, mac. node . stream ( ) ) ;
674
+ let result = self . parse_ast_fragment ( tok_result, kind, path, span) ;
675
+ self . gate_proc_macro_expansion ( span, & result) ;
676
+ result
677
+ }
693
678
SyntaxExtensionKind :: LegacyBang ( expander) => {
694
- if let Err ( dummy_span) = validate ( self ) {
695
- dummy_span
696
- } else {
697
- kind. make_from ( expander. expand (
698
- self . cx ,
699
- span,
700
- mac. node . stream ( ) ,
701
- Some ( ext. span ) ,
702
- ) )
703
- }
679
+ let tok_result = expander. expand ( self . cx , span, mac. node . stream ( ) , Some ( ext. span ) ) ;
680
+ kind. make_from ( tok_result)
704
681
}
705
682
706
683
SyntaxExtensionKind :: Attr ( ..) |
@@ -717,14 +694,6 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
717
694
self . cx . trace_macros_diag ( ) ;
718
695
kind. dummy ( span)
719
696
}
720
-
721
- SyntaxExtensionKind :: Bang ( expander) => {
722
- self . gate_proc_macro_expansion_kind ( span, kind) ;
723
- let tok_result = expander. expand ( self . cx , span, mac. node . stream ( ) ) ;
724
- let result = self . parse_ast_fragment ( tok_result, kind, path, span) ;
725
- self . gate_proc_macro_expansion ( span, & result) ;
726
- result
727
- }
728
697
} ;
729
698
730
699
if opt_expanded. is_some ( ) {
0 commit comments