]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
nr2.0: Only insert derive macros if they exist
authorArthur Cohen <arthur.cohen@embecosm.com>
Wed, 9 Apr 2025 12:48:55 +0000 (14:48 +0200)
committerCohenArthur <arthur.cohen@embecosm.com>
Mon, 14 Apr 2025 12:35:00 +0000 (12:35 +0000)
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

index d5f85b7d16ce3e2ff9cfdb06237a7ba3e5656c1a..ef13aeacdd637f3e9ae161bedafb667903b05fa2 100644 (file)
@@ -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 ()