Add a regression test for issue-66286

This commit is contained in:
Yuki Okushi 2020-12-05 08:02:56 +09:00
parent 3ff10e74a7
commit ab121e3afe
3 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,14 @@
// force-host
// no-prefer-dynamic
#![crate_type = "proc-macro"]
extern crate proc_macro;
use proc_macro::TokenStream;
#[proc_macro_attribute]
pub fn vec_ice(_attr: TokenStream, input: TokenStream) -> TokenStream {
// This redundant convert is necessary to reproduce ICE.
input.into_iter().collect()
}

View File

@ -0,0 +1,13 @@
// aux-build:issue-66286.rs
// Regression test for #66286.
extern crate issue_66286;
#[issue_66286::vec_ice]
pub extern fn foo(_: Vec(u32)) -> u32 {
//~^ ERROR: parenthesized type parameters may only be used with a `Fn` trait
0
}
fn main() {}

View File

@ -0,0 +1,12 @@
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
--> $DIR/issue-66286.rs:8:22
|
LL | pub extern fn foo(_: Vec(u32)) -> u32 {
| ^^^^^^^^
| |
| only `Fn` traits may use parentheses
| help: use angle brackets instead: `Vec<u32>`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0214`.