diff options
author | Tom Schollenberger <tss2344@g.rit.edu> | 2025-05-11 22:57:28 -0400 |
---|---|---|
committer | P-E-P <32375388+P-E-P@users.noreply.github.com> | 2025-05-19 09:42:09 +0000 |
commit | f870c29e2c450253b48a2c6246de48d4f5e275ea (patch) | |
tree | 14e8c4d51abb0853eb19de8616512ab04879fefa /gcc/rust/resolve | |
parent | 2dc57afa16fe10616acb7660fa7d68d2a9666860 (diff) | |
download | gcc-f870c29e2c450253b48a2c6246de48d4f5e275ea.zip gcc-f870c29e2c450253b48a2c6246de48d4f5e275ea.tar.gz gcc-f870c29e2c450253b48a2c6246de48d4f5e275ea.tar.bz2 |
gccrs: Fix NR2 ICE in visit_attributes
Undefined attribute macros have no proc macro definition, which results
in a failing `rust_assert`. This changes that assert to an if statement,
that returns early if there is no proc macro definition. Fixes #3661.
gcc/rust/ChangeLog:
* resolve/rust-early-name-resolver-2.0.cc (Early::visit_attributes): rust_assert to if
gcc/testsuite/ChangeLog:
* rust/compile/issue-3661.rs: Test NR2 has expected behavior
Signed-off-by: Tom Schollenberger <tss2344@g.rit.edu>
Diffstat (limited to 'gcc/rust/resolve')
-rw-r--r-- | gcc/rust/resolve/rust-early-name-resolver-2.0.cc | 3 |
1 files changed, 2 insertions, 1 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 73d71ca..1dc63f4 100644 --- a/gcc/rust/resolve/rust-early-name-resolver-2.0.cc +++ b/gcc/rust/resolve/rust-early-name-resolver-2.0.cc @@ -350,7 +350,8 @@ Early::visit_attributes (std::vector<AST::Attribute> &attrs) auto pm_def = mappings.lookup_attribute_proc_macro_def ( definition->get_node_id ()); - rust_assert (pm_def.has_value ()); + if (!pm_def.has_value ()) + return; mappings.insert_attribute_proc_macro_invocation (attr.get_path (), pm_def.value ()); |