@@ -58,41 +58,40 @@ impl<'a> ParserAttr for Parser<'a> {
5858 return attrs;
5959 }
6060
61- // matches attribute = # [ meta_item ]
61+ // matches attribute = # ! [ meta_item ]
6262 //
63- // if permit_inner is true, then a trailing `; ` indicates an inner
63+ // if permit_inner is true, then a leading `! ` indicates an inner
6464 // attribute
6565 fn parse_attribute ( & mut self , permit_inner : bool ) -> ast:: Attribute {
6666 debug ! ( "parse_attributes: permit_inner={:?} self.token={:?}" ,
6767 permit_inner, self . token) ;
68- let mut warned = false ;
69- let ( span, value) = match self . token {
68+ let ( span, value, mut style) = match self . token {
7069 INTERPOLATED ( token:: NtAttr ( attr) ) => {
7170 assert ! ( attr. node. style == ast:: AttrOuter ) ;
7271 self . bump ( ) ;
73- ( attr. span , attr. node . value )
72+ ( attr. span , attr. node . value , ast :: AttrOuter )
7473 }
7574 token:: POUND => {
7675 let lo = self . span . lo ;
7776 self . bump ( ) ;
7877
79- if self . eat ( & token:: NOT ) {
78+ let style = if self . eat ( & token:: NOT ) {
8079 if !permit_inner {
81- self . fatal ( "an inner attribute was not permitted in this context." ) ;
80+ self . span_err ( self . span ,
81+ "an inner attribute is not permitted in \
82+ this context") ;
8283 }
84+ ast:: AttrInner
8385 } else {
84- warned = true ;
85- // NOTE: uncomment this after a stage0 snap
86- //self.warn("The syntax for inner attributes have changed.
87- // Use `#![lang(foo)]` instead.");
88- }
86+ ast:: AttrOuter
87+ } ;
8988
9089 self . expect ( & token:: LBRACKET ) ;
9190 let meta_item = self . parse_meta_item ( ) ;
9291 self . expect ( & token:: RBRACKET ) ;
9392
9493 let hi = self . span . hi ;
95- ( mk_sp ( lo, hi) , meta_item)
94+ ( mk_sp ( lo, hi) , meta_item, style )
9695 }
9796 _ => {
9897 let token_str = self . this_token_to_str ( ) ;
@@ -101,21 +100,12 @@ impl<'a> ParserAttr for Parser<'a> {
101100 }
102101 } ;
103102
104- let style = if permit_inner {
105-
106- if self . eat ( & token:: SEMI ) {
107- // Only warn the user once if the syntax is the old one.
108- if !warned {
109- // NOTE: uncomment this after a stage0 snap
110- //self.warn("This uses the old attribute syntax. Semicolons
111- // are not longer required.");
112- }
113- }
114-
115- ast:: AttrInner
116- } else {
117- ast:: AttrOuter
118- } ;
103+ if permit_inner && self . eat ( & token:: SEMI ) {
104+ // NOTE: uncomment this after a stage0 snap
105+ //self.warn("This uses the old attribute syntax. Semicolons
106+ // are not longer required.");
107+ style = ast:: AttrInner ;
108+ }
119109
120110 return Spanned {
121111 span : span,
0 commit comments