mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-15 05:26:47 +00:00
parent
b6d91a2bda
commit
61ea8b33d0
src
libsyntax/parse
test
@ -3496,6 +3496,9 @@ impl<'a> Parser<'a> {
|
||||
};
|
||||
pat = PatIdent(BindByValue(MutImmutable), pth1, sub);
|
||||
}
|
||||
} else if self.look_ahead(1, |t| *t == token::Lt) {
|
||||
self.bump();
|
||||
self.unexpected()
|
||||
} else {
|
||||
// parse an enum pat
|
||||
let enum_path = self.parse_path(LifetimeAndTypesWithColons);
|
||||
|
16
src/test/compile-fail/issue-22426-1.rs
Normal file
16
src/test/compile-fail/issue-22426-1.rs
Normal file
@ -0,0 +1,16 @@
|
||||
// Copyright 2015 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.
|
||||
|
||||
fn main() {
|
||||
match 42 {
|
||||
x < 7 => (), //~ ERROR unexpected token `<`
|
||||
_ => ()
|
||||
}
|
||||
}
|
11
src/test/compile-fail/issue-22426-2.rs
Normal file
11
src/test/compile-fail/issue-22426-2.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright 2015 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.
|
||||
|
||||
fn a(B<) {} //~ ERROR unexpected token `<`
|
21
src/test/compile-fail/issue-22426.rs
Normal file
21
src/test/compile-fail/issue-22426.rs
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright 2015 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.
|
||||
|
||||
struct Foo<T>(T, T);
|
||||
|
||||
impl<T> Foo<T> {
|
||||
fn foo(&self) {
|
||||
match *self {
|
||||
Foo<T>(x, y) => { //~ ERROR unexpected token `<`
|
||||
println!("Goodbye, World!")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
21
src/test/run-pass/issue-22426.rs
Normal file
21
src/test/run-pass/issue-22426.rs
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright 2015 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.
|
||||
|
||||
struct Foo<T>(T, T);
|
||||
|
||||
impl<T> Foo<T> {
|
||||
fn foo(&self) {
|
||||
match *self {
|
||||
Foo::<T>(ref x, ref y) => { //~ ERROR unexpected token `<`
|
||||
println!("Goodbye, World!")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user