Add tests for expect ident but find enum or struct panic
Closes #22589 Closes #22647 Closes #22665 Closes #22712
This commit is contained in:
parent
2890508d97
commit
a1396d250a
2 changed files with 44 additions and 0 deletions
25
src/test/parse-fail/issue-22647.rs
Normal file
25
src/test/parse-fail/issue-22647.rs
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
// 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() {
|
||||||
|
let caller<F> = |f: F| //~ ERROR unexpected token: `<`
|
||||||
|
where F: Fn() -> i32
|
||||||
|
{
|
||||||
|
let x = f();
|
||||||
|
println!("Y {}",x);
|
||||||
|
return x;
|
||||||
|
};
|
||||||
|
|
||||||
|
caller(bar_handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn bar_handler() -> i32 {
|
||||||
|
5
|
||||||
|
}
|
19
src/test/parse-fail/issue-22712.rs
Normal file
19
src/test/parse-fail/issue-22712.rs
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// 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<B> {
|
||||||
|
buffer: B
|
||||||
|
}
|
||||||
|
|
||||||
|
fn bar() {
|
||||||
|
let Foo<Vec<u8>> //~ ERROR unexpected token: `<`
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
Loading…
Add table
Reference in a new issue