From: Pierre-Emmanuel Patry <[email protected]>

Those test contain builtin macros that were not correctly defined. This
was mostly fine because the compiler emitted attribute errors before the
expansion step but now that the new builtin attribute checking is
executed after the expansion we cannot ignore those missing definitions.

gcc/testsuite/ChangeLog:

        * rust/compile/doc_macro.rs: Add concat builtin macro definition.
        * rust/compile/early_feature_gate_in_macro.rs: Add stringify builtin
        macro definition.
        * rust/compile/issue-3661.rs: Likewise.
        * rust/compile/parse_time_feature_gate.rs: Add concat and stringify
        builtin macro definition.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
---
This change was merged into the gccrs repository and is posted here for
upstream visibility and potential drive-by review, as requested by GCC
release managers.
Each commit email contains a link to its details on github from where you can
find the Pull-Request and associated discussions.


Commit on github: 
https://github.com/Rust-GCC/gccrs/commit/490bf51fe9f6dce8c9ab803c45917182c65d328d

The commit has been mentioned in the following pull-request(s):
 - https://github.com/Rust-GCC/gccrs/pull/4505

 gcc/testsuite/rust/compile/doc_macro.rs               |  6 ++++++
 .../rust/compile/early_feature_gate_in_macro.rs       |  5 +++++
 gcc/testsuite/rust/compile/issue-3661.rs              |  8 +++++++-
 gcc/testsuite/rust/compile/parse_time_feature_gate.rs | 11 +++++++++++
 4 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/rust/compile/doc_macro.rs 
b/gcc/testsuite/rust/compile/doc_macro.rs
index 179455ddf..dff69baad 100644
--- a/gcc/testsuite/rust/compile/doc_macro.rs
+++ b/gcc/testsuite/rust/compile/doc_macro.rs
@@ -1,4 +1,10 @@
+#![feature(rustc_attrs)]
 #![feature(no_core)]
 #![no_core]
 #![feature(extended_key_value_attributes)]
 #![doc = concat!("AB")]
+
+#[rustc_builtin_macro]
+macro_rules! concat {
+    () => {{}};
+}
diff --git a/gcc/testsuite/rust/compile/early_feature_gate_in_macro.rs 
b/gcc/testsuite/rust/compile/early_feature_gate_in_macro.rs
index f76577362..9e2a51027 100644
--- a/gcc/testsuite/rust/compile/early_feature_gate_in_macro.rs
+++ b/gcc/testsuite/rust/compile/early_feature_gate_in_macro.rs
@@ -8,6 +8,11 @@ macro_rules! concat {
     () => {{}};
 }
 
+#[rustc_builtin_macro]
+macro_rules! stringify {
+    () => {{}};
+}
+
 macro_rules! prefix_symbol(
     ($prefix : tt, { $($ident: ident, )* }) => {
         $(
diff --git a/gcc/testsuite/rust/compile/issue-3661.rs 
b/gcc/testsuite/rust/compile/issue-3661.rs
index 7cb7c6add..0c8eab3f2 100644
--- a/gcc/testsuite/rust/compile/issue-3661.rs
+++ b/gcc/testsuite/rust/compile/issue-3661.rs
@@ -1,9 +1,15 @@
 #![feature(no_core)]
 #![no_core]
 #![feature(extended_key_value_attributes)]
+#![feature(rustc_attrs)]
+
+#[rustc_builtin_macro]
+macro_rules! stringify {
+    () => {{}};
+}
 
 pub macro m($inner_str:expr) {
-    #[m = $inner_str] 
+    #[m = $inner_str]
     // { dg-error "macro not found" "" { target *-*-* } .-1 }
 
     struct S;
diff --git a/gcc/testsuite/rust/compile/parse_time_feature_gate.rs 
b/gcc/testsuite/rust/compile/parse_time_feature_gate.rs
index 238b2cfd5..907ac0c51 100644
--- a/gcc/testsuite/rust/compile/parse_time_feature_gate.rs
+++ b/gcc/testsuite/rust/compile/parse_time_feature_gate.rs
@@ -1,5 +1,16 @@
 #![feature(no_core)]
 #![no_core]
+#![feature(rustc_attrs)]
+
+#[rustc_builtin_macro]
+macro_rules! concat {
+    () => {{}};
+}
+
+#[rustc_builtin_macro]
+macro_rules! stringify {
+    () => {{}};
+}
 
 // { dg-error "arbitrary expressions in key-value attributes are unstable" "" 
{ target *-*-* } .+1 }
 #[export_name = concat!(stringify!(non), stringify!(literal))]
-- 
2.53.0

Reply via email to