From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7905) id 96B30385841C; Tue, 16 Jan 2024 18:00:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 96B30385841C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705428019; bh=2w1R4oVs+y9TZ6gqPKu1bWFlHNhiWMAqhauXig9n4AM=; h=From:To:Subject:Date:From; b=Pz8l8g9Lnfma7ZzwMgdCZZ33AfMFyYhsjdczUwP8+cIgrMNkdv5w7LvMpzJ7pmPru ziFfSVLhlQHj8v5+5N1QhmLauZAIQCnnYcXXs5lP92PylA8xamMe+Aqd65oJvb9W95 ET8Rix+vN9q21VBDPg9oQcVnCTuBMqdFwTfr9H20= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Arthur Cohen To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-7808] gccrs: proc macro: Add crate type regression tests X-Act-Checkin: gcc X-Git-Author: Pierre-Emmanuel Patry X-Git-Refname: refs/heads/trunk X-Git-Oldrev: 9a99feab7cbc2dcb01c3af99dca4c2a4403d83b1 X-Git-Newrev: ad4c18174bb3dab443435fe19ca593206f98cddf Message-Id: <20240116180019.96B30385841C@sourceware.org> Date: Tue, 16 Jan 2024 18:00:19 +0000 (GMT) List-Id: https://gcc.gnu.org/g:ad4c18174bb3dab443435fe19ca593206f98cddf commit r14-7808-gad4c18174bb3dab443435fe19ca593206f98cddf Author: Pierre-Emmanuel Patry 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 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() {}