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 <pierre-emmanuel.patry@embecosm.com>
--- /dev/null
+// { 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() {}
--- /dev/null
+// { 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() {}
--- /dev/null
+// { 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() {}