public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-7808] gccrs: proc macro: Add crate type regression tests
@ 2024-01-16 18:00 Arthur Cohen
  0 siblings, 0 replies; only message in thread
From: Arthur Cohen @ 2024-01-16 18:00 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:ad4c18174bb3dab443435fe19ca593206f98cddf

commit r14-7808-gad4c18174bb3dab443435fe19ca593206f98cddf
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date:   Tue Jul 18 15:43:06 2023 +0200

    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 <pierre-emmanuel.patry@embecosm.com>

Diff:
---
 gcc/testsuite/rust/compile/proc_macro_attribute_crate_type.rs | 4 ++++
 gcc/testsuite/rust/compile/proc_macro_crate_type.rs           | 4 ++++
 gcc/testsuite/rust/compile/proc_macro_derive_crate_type.rs    | 6 ++++++
 3 files changed, 14 insertions(+)

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 00000000000..9ffd2b079b4
--- /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 00000000000..f27a94a6d33
--- /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 00000000000..20f69970dc4
--- /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() {}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-16 18:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-16 18:00 [gcc r14-7808] gccrs: proc macro: Add crate type regression tests Arthur Cohen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).