diff options
| author | Edward Wang <edward.yu.wang@gmail.com> | 2015-02-24 14:59:24 +0800 |
|---|---|---|
| committer | Edward Wang <edward.yu.wang@gmail.com> | 2015-02-24 14:59:24 +0800 |
| commit | a1396d250ad5b1b7e9143a6a844ed7ba40bd0e55 (patch) | |
| tree | 44687c118c4b900c5ffdf65319f4e867a6400386 /src | |
| parent | 2890508d97af287a136ac50ffa13a1c0a3e32e4e (diff) | |
| download | rust-a1396d250ad5b1b7e9143a6a844ed7ba40bd0e55.tar.gz rust-a1396d250ad5b1b7e9143a6a844ed7ba40bd0e55.zip | |
Add tests for expect ident but find enum or struct panic
Closes #22589 Closes #22647 Closes #22665 Closes #22712
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/parse-fail/issue-22647.rs | 25 | ||||
| -rw-r--r-- | src/test/parse-fail/issue-22712.rs | 19 |
2 files changed, 44 insertions, 0 deletions
diff --git a/src/test/parse-fail/issue-22647.rs b/src/test/parse-fail/issue-22647.rs new file mode 100644 index 00000000000..5de86270010 --- /dev/null +++ b/src/test/parse-fail/issue-22647.rs @@ -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 +} diff --git a/src/test/parse-fail/issue-22712.rs b/src/test/parse-fail/issue-22712.rs new file mode 100644 index 00000000000..abc9e599467 --- /dev/null +++ b/src/test/parse-fail/issue-22712.rs @@ -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() {} |
