Skip to content

Commit

Permalink
Rollup merge of rust-lang#33343 - birkenfeld:issue-32214, r=Manishearth
Browse files Browse the repository at this point in the history
parser: change warning into an error on `T<A=B, C>`

part of rust-lang#32214

This seems to be the obvious fix, and the error message is consistent with all the other parser errors ("expected x, found y").
  • Loading branch information
Manishearth committed May 3, 2016
2 parents 52c97f2 + 98d991f commit 51a3a8f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
6 changes: 1 addition & 5 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4419,11 +4419,7 @@ impl<'a> Parser<'a> {
p.forbid_lifetime()?;
let lo = p.span.lo;
let ident = p.parse_ident()?;
let found_eq = p.eat(&token::Eq);
if !found_eq {
let span = p.span;
p.span_warn(span, "whoops, no =?");
}
p.expect(&token::Eq)?;
let ty = p.parse_ty()?;
let hi = ty.span.hi;
let span = mk_sp(lo, hi);
Expand Down
17 changes: 17 additions & 0 deletions src/test/parse-fail/issue-32214.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only -Z continue-parse-after-error

pub fn test<W, I: Iterator<Item=(), W> >() {
//~^ ERROR expected `=`, found `>`
}

fn main() { }

0 comments on commit 51a3a8f

Please sign in to comment.