Skip to content

Commit 98d991f

Browse files
committed
parser: change warning into an error on T<A=B, C>
Fixes: #32214
1 parent 855fb61 commit 98d991f

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

src/libsyntax/parse/parser.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -4420,11 +4420,7 @@ impl<'a> Parser<'a> {
44204420
p.forbid_lifetime()?;
44214421
let lo = p.span.lo;
44224422
let ident = p.parse_ident()?;
4423-
let found_eq = p.eat(&token::Eq);
4424-
if !found_eq {
4425-
let span = p.span;
4426-
p.span_warn(span, "whoops, no =?");
4427-
}
4423+
p.expect(&token::Eq)?;
44284424
let ty = p.parse_ty()?;
44294425
let hi = ty.span.hi;
44304426
let span = mk_sp(lo, hi);

src/test/parse-fail/issue-32214.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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 parse-only -Z continue-parse-after-error
12+
13+
pub fn test<W, I: Iterator<Item=(), W> >() {
14+
//~^ ERROR expected `=`, found `>`
15+
}
16+
17+
fn main() { }

0 commit comments

Comments
 (0)