@@ -13,8 +13,7 @@ use crate::parse::{DirectoryOwnership, PResult, ParseSess};
1313use crate :: parse:: token;
1414use crate :: parse:: parser:: Parser ;
1515use crate :: ptr:: P ;
16- use crate :: symbol:: Symbol ;
17- use crate :: symbol:: { kw, sym} ;
16+ use crate :: symbol:: { sym, Symbol } ;
1817use crate :: tokenstream:: { TokenStream , TokenTree } ;
1918use crate :: visit:: { self , Visitor } ;
2019use crate :: util:: map_in_place:: MapInPlace ;
@@ -197,7 +196,6 @@ pub struct Invocation {
197196pub enum InvocationKind {
198197 Bang {
199198 mac : ast:: Mac ,
200- ident : Option < Ident > ,
201199 span : Span ,
202200 } ,
203201 Attr {
@@ -664,13 +662,12 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
664662 ext : & SyntaxExtension )
665663 -> Option < AstFragment > {
666664 let kind = invoc. fragment_kind ;
667- let ( mac, ident , span) = match invoc. kind {
668- InvocationKind :: Bang { mac, ident , span } => ( mac, ident , span) ,
665+ let ( mac, span) = match invoc. kind {
666+ InvocationKind :: Bang { mac, span } => ( mac, span) ,
669667 _ => unreachable ! ( ) ,
670668 } ;
671669 let path = & mac. node . path ;
672670
673- let ident = ident. unwrap_or_else ( || Ident :: invalid ( ) ) ;
674671 let validate = |this : & mut Self | {
675672 // feature-gate the macro invocation
676673 if let Some ( ( feature, issue) ) = ext. unstable_feature {
@@ -690,12 +687,6 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
690687 }
691688 }
692689
693- if ident. name != kw:: Invalid {
694- let msg = format ! ( "macro {}! expects no ident argument, given '{}'" , path, ident) ;
695- this. cx . span_err ( path. span , & msg) ;
696- this. cx . trace_macros_diag ( ) ;
697- return Err ( kind. dummy ( span) ) ;
698- }
699690 Ok ( ( ) )
700691 } ;
701692
@@ -729,19 +720,11 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
729720 }
730721
731722 SyntaxExtensionKind :: Bang ( expander) => {
732- if ident. name != kw:: Invalid {
733- let msg =
734- format ! ( "macro {}! expects no ident argument, given '{}'" , path, ident) ;
735- self . cx . span_err ( path. span , & msg) ;
736- self . cx . trace_macros_diag ( ) ;
737- kind. dummy ( span)
738- } else {
739- self . gate_proc_macro_expansion_kind ( span, kind) ;
740- let tok_result = expander. expand ( self . cx , span, mac. node . stream ( ) ) ;
741- let result = self . parse_ast_fragment ( tok_result, kind, path, span) ;
742- self . gate_proc_macro_expansion ( span, & result) ;
743- result
744- }
723+ self . gate_proc_macro_expansion_kind ( span, kind) ;
724+ let tok_result = expander. expand ( self . cx , span, mac. node . stream ( ) ) ;
725+ let result = self . parse_ast_fragment ( tok_result, kind, path, span) ;
726+ self . gate_proc_macro_expansion ( span, & result) ;
727+ result
745728 }
746729 } ;
747730
@@ -944,7 +927,7 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
944927 }
945928
946929 fn collect_bang ( & mut self , mac : ast:: Mac , span : Span , kind : AstFragmentKind ) -> AstFragment {
947- self . collect ( kind, InvocationKind :: Bang { mac, ident : None , span } )
930+ self . collect ( kind, InvocationKind :: Bang { mac, span } )
948931 }
949932
950933 fn collect_attr ( & mut self ,
@@ -1179,13 +1162,9 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
11791162 ast:: ItemKind :: Mac ( ..) => {
11801163 self . check_attributes ( & item. attrs ) ;
11811164 item. and_then ( |item| match item. node {
1182- ItemKind :: Mac ( mac) => {
1183- self . collect ( AstFragmentKind :: Items , InvocationKind :: Bang {
1184- mac,
1185- ident : Some ( item. ident ) ,
1186- span : item. span ,
1187- } ) . make_items ( )
1188- }
1165+ ItemKind :: Mac ( mac) => self . collect (
1166+ AstFragmentKind :: Items , InvocationKind :: Bang { mac, span : item. span }
1167+ ) . make_items ( ) ,
11891168 _ => unreachable ! ( ) ,
11901169 } )
11911170 }
0 commit comments