From: Pierre-Emmanuel Patry Date: Tue, 18 Jul 2023 13:43:06 +0000 (+0200) Subject: gccrs: proc macro: Add crate type regression tests X-Git-Tag: basepoints/gcc-15~2331 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad4c18174bb3dab443435fe19ca593206f98cddf;p=thirdparty%2Fgcc.git gccrs: proc macro: Add crate type regression tests Add several tests to prevent regression with proc_macro, proc_macro_derive and proc_macro_attribute attributes error messages. gcc/testsuite/ChangeLog: * rust/compile/proc_macro_attribute_crate_type.rs: New test. * rust/compile/proc_macro_crate_type.rs: New test. * rust/compile/proc_macro_derive_crate_type.rs: New test. Signed-off-by: Pierre-Emmanuel Patry --- diff --git a/gcc/testsuite/rust/compile/proc_macro_attribute_crate_type.rs b/gcc/testsuite/rust/compile/proc_macro_attribute_crate_type.rs new file mode 100644 index 000000000000..9ffd2b079b49 --- /dev/null +++ b/gcc/testsuite/rust/compile/proc_macro_attribute_crate_type.rs @@ -0,0 +1,4 @@ +// { dg-additional-options "-frust-crate-type=lib" } + +#[proc_macro_attribute] // { dg-excess-errors "the '#\[proc_macro_attribute\]' attribute is only usable with crates of the 'proc-macro' crate type" } +pub fn my_invalid_macro() {} diff --git a/gcc/testsuite/rust/compile/proc_macro_crate_type.rs b/gcc/testsuite/rust/compile/proc_macro_crate_type.rs new file mode 100644 index 000000000000..f27a94a6d33c --- /dev/null +++ b/gcc/testsuite/rust/compile/proc_macro_crate_type.rs @@ -0,0 +1,4 @@ +// { dg-additional-options "-frust-crate-type=lib" } + +#[proc_macro] // { dg-excess-errors "the '#\[proc_macro\]' attribute is only usable with crates of the 'proc-macro' crate type" } +pub fn my_invalid_macro() {} diff --git a/gcc/testsuite/rust/compile/proc_macro_derive_crate_type.rs b/gcc/testsuite/rust/compile/proc_macro_derive_crate_type.rs new file mode 100644 index 000000000000..20f69970dc4a --- /dev/null +++ b/gcc/testsuite/rust/compile/proc_macro_derive_crate_type.rs @@ -0,0 +1,6 @@ +// { dg-additional-options "-frust-crate-type=lib" } + +trait Dungeness {} + +#[proc_macro_derive(Dungeness)] // { dg-excess-errors "the '#\[proc_macro_derive\]' attribute is only usable with crates of the 'proc-macro' crate type" } +pub fn my_invalid_macro() {}