File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -2702,7 +2702,10 @@ impl<'a> Parser<'a> {
27022702 return Ok ( TokenTree :: Token ( sp, SpecialVarNt ( SpecialMacroVar :: CrateMacroVar ) ) ) ;
27032703 } else {
27042704 sp = mk_sp ( sp. lo , self . span . hi ) ;
2705- self . parse_ident ( ) ?
2705+ self . parse_ident ( ) . unwrap_or_else ( |mut e| {
2706+ e. emit ( ) ;
2707+ keywords:: Invalid . ident ( )
2708+ } )
27062709 }
27072710 }
27082711 token:: SubstNt ( name) => {
@@ -2845,7 +2848,7 @@ impl<'a> Parser<'a> {
28452848 // and an error emitted then. Thus we don't pop from
28462849 // self.open_braces here.
28472850 } ,
2848- _ => unreachable ! ( ) ,
2851+ _ => { }
28492852 }
28502853
28512854 Ok ( TokenTree :: Delimited ( span, Rc :: new ( Delimited {
Original file line number Diff line number Diff line change 1+ // Copyright 2016 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+ // compile-flags: -Z no-analysis
12+
13+ macro_rules! foo {
14+ { $+ } => { //~ ERROR expected identifier, found `+`
15+ $( x) (y) //~ ERROR expected `* ` or `+`
16+ //~^ ERROR no rules expected the token `y`
17+ }
18+ }
You can’t perform that action at this time.
0 commit comments