File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed
src/test/compile-fail-fulldeps Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,9 @@ pub fn plugin_registrar(reg: &mut Registry) {
3737 reg. register_syntax_extension (
3838 Symbol :: intern ( "into_multi_foo" ) ,
3939 MultiModifier ( Box :: new ( expand_into_foo_multi) ) ) ;
40+ reg. register_syntax_extension (
41+ Symbol :: intern ( "noop_attribute" ) ,
42+ MultiModifier ( Box :: new ( expand_noop_attribute) ) ) ;
4043 reg. register_syntax_extension (
4144 Symbol :: intern ( "duplicate" ) ,
4245 MultiDecorator ( Box :: new ( expand_duplicate) ) ) ;
@@ -93,6 +96,13 @@ fn expand_into_foo_multi(cx: &mut ExtCtxt,
9396 }
9497}
9598
99+ fn expand_noop_attribute ( _cx : & mut ExtCtxt ,
100+ _sp : Span ,
101+ _attr : & MetaItem ,
102+ it : Annotatable ) -> Annotatable {
103+ it
104+ }
105+
96106// Create a duplicate of the annotatable, based on the MetaItem
97107fn expand_duplicate ( cx : & mut ExtCtxt ,
98108 _sp : Span ,
Original file line number Diff line number Diff line change 1+ // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
2+ // file at the top-level directory of this distribution and at
3+ // http://rust-lang.org/COPYRIGHT.
4+ //
5+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+ // option. This file may not be copied, modified, or distributed
9+ // except according to those terms.
10+
11+ // This is a regression test against an ICE that used to occur
12+ // on malformed attributes for a custom MultiModifier.
13+
14+ // aux-build:macro_crate_test.rs
15+ // ignore-stage1
16+
17+ #![ feature( plugin) ]
18+ #![ plugin( macro_crate_test) ]
19+
20+ #[ noop_attribute "x" ] //~ ERROR expected one of
21+ fn night ( ) { }
22+
23+ #[ noop_attribute( "hi" ) , rank = 2 ] //~ ERROR unexpected token
24+ fn knight ( ) { }
25+
26+ #[ noop_attribute( "/user" , data= = "<user" ) ] //~ ERROR literal or identifier
27+ fn nite ( ) { }
28+
29+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments