[COMMITTED,17/19] gccrs: nr2.0: Only insert derive macros if they exist

Message ID 20250414163138.506753-18-arthur.cohen@embecosm.com
State Committed
Commit 9ed95c06977068cce86b5d35aee905533c757d57
Headers
Series [COMMITTED,01/19] rust: Use FLOAT_TYPE_P instead of manual checking |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_simplebootstrap_build--master-arm-bootstrap fail Patch failed to apply

Commit Message

Arthur Cohen April 14, 2025, 4:31 p.m. UTC
  From: Arthur Cohen <arthur.cohen@embecosm.com>

This causes an assertion failure when compiling core with nr2.0, but should
probably be improved. I'm not sure how this code enables built-in derive
macros to be resolved so this is a temporary fix.

gcc/rust/ChangeLog:

	* resolve/rust-early-name-resolver-2.0.cc (Early::visit_attributes): Remove assertion.
---
 gcc/rust/resolve/rust-early-name-resolver-2.0.cc | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
  

Patch

diff --git a/gcc/rust/resolve/rust-early-name-resolver-2.0.cc b/gcc/rust/resolve/rust-early-name-resolver-2.0.cc
index afaca1f71f0..36456e10ff2 100644
--- a/gcc/rust/resolve/rust-early-name-resolver-2.0.cc
+++ b/gcc/rust/resolve/rust-early-name-resolver-2.0.cc
@@ -325,10 +325,9 @@  Early::visit_attributes (std::vector<AST::Attribute> &attrs)
 	      auto pm_def = mappings.lookup_derive_proc_macro_def (
 		definition->get_node_id ());
 
-	      rust_assert (pm_def.has_value ());
-
-	      mappings.insert_derive_proc_macro_invocation (trait,
-							    pm_def.value ());
+	      if (pm_def.has_value ())
+		mappings.insert_derive_proc_macro_invocation (trait,
+							      pm_def.value ());
 	    }
 	}
       else if (Analysis::BuiltinAttributeMappings::get ()