https://gcc.gnu.org/g:5bd41f967706556524cd1de172d03e7351402405

commit 5bd41f967706556524cd1de172d03e7351402405
Author: Arthur Cohen <arthur.co...@embecosm.com>
Date:   Wed Apr 9 14:48:55 2025 +0200

    nr2.0: Only insert derive macros if they exist
    
    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.

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

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 d5f85b7d16ce..ef13aeacdd63 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 ()

Reply via email to