From ab121e3afef7b54b5621547b0b5c01d9554fe026 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Sat, 5 Dec 2020 08:02:56 +0900 Subject: [PATCH] Add a regression test for issue-66286 --- src/test/ui/proc-macro/auxiliary/issue-66286.rs | 14 ++++++++++++++ src/test/ui/proc-macro/issue-66286.rs | 13 +++++++++++++ src/test/ui/proc-macro/issue-66286.stderr | 12 ++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 src/test/ui/proc-macro/auxiliary/issue-66286.rs create mode 100644 src/test/ui/proc-macro/issue-66286.rs create mode 100644 src/test/ui/proc-macro/issue-66286.stderr diff --git a/src/test/ui/proc-macro/auxiliary/issue-66286.rs b/src/test/ui/proc-macro/auxiliary/issue-66286.rs new file mode 100644 index 00000000000..6217f1c7e61 --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/issue-66286.rs @@ -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() +} diff --git a/src/test/ui/proc-macro/issue-66286.rs b/src/test/ui/proc-macro/issue-66286.rs new file mode 100644 index 00000000000..2a67aeab44e --- /dev/null +++ b/src/test/ui/proc-macro/issue-66286.rs @@ -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() {} diff --git a/src/test/ui/proc-macro/issue-66286.stderr b/src/test/ui/proc-macro/issue-66286.stderr new file mode 100644 index 00000000000..2854dd7d59c --- /dev/null +++ b/src/test/ui/proc-macro/issue-66286.stderr @@ -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` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0214`.