gccrs: avoid MarkLive ICE on unresolved paths - #4776
Open
w3lld1 wants to merge 1 commit into
Open
Conversation
Member
|
The CI does not pass, you'll have to fix whatever is required to make it green. Even though the CI is green about the commit format I believe your lines are too long, you need to wrap your text at col 50 for the title and 72 for the text. I've seen that most of your recent contributions are AI generated, make sure you have taken a look at GCC's ai policy https://gcc.gnu.org/ai-policy.html |
Name resolution reports an error for unresolved paths, but MarkLive still visits their lowered HIR nodes. Treat a missing definition as an already-diagnosed path and stop processing it instead of asserting. Fixes Rust-GCC#4670 gcc/rust/ChangeLog: * checks/lints/rust-lint-marklive.cc (MarkLive::visit): Return on an unresolved path. (MarkLive::find_value_definition): Return whether lookup succeeded. * checks/lints/rust-lint-marklive.h (MarkLive::find_value_definition): Change return type. gcc/testsuite/ChangeLog: * rust/compile/issue-4670.rs: New test. Signed-off-by: w3lld1 <faststepbyme@gmail.com>
w3lld1
force-pushed
the
fix/4670-unresolved-marklive-path
branch
from
August 12, 2026 16:09
528613e to
bd2bcc4
Compare
Contributor
|
CohenArthur
reviewed
Aug 17, 2026
| void mark_hir_id (HirId); | ||
| bool visit_path_segment (HIR::PathExprSegment); | ||
| void find_value_definition (NodeId ast_node_id, NodeId &ref_node_id); | ||
| bool find_value_definition (NodeId ast_node_id, NodeId &ref_node_id); |
Member
There was a problem hiding this comment.
this can just return the optional<NodeId> instead of a boolean and updating the given reference
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4670
Name resolution already diagnoses the unknown enum variant in the match guard, but the lowered unresolved path still reached
MarkLive, where a successful definition lookup was asserted. This change treats a missing definition as an already-diagnosed path and stops processing that expression instead of triggering an ICE.I added a compile regression test for the reduced reproducer and its expected E0433 diagnostic.
Validation:
rust/rust-lint-marklive.oclang-format16 dry-run on both changed C++ filescontrib/gcc-changelog/git_check_commit.py origin/master..HEADgit diff --check origin/master...HEADThe complete
make check-rustsuite is deferred to CI; the local compiler build exceeded the bounded run time after the changed translation unit compiled successfully.Checklist:
make check-rustpasses locally (deferred to CI)clang-formatgcc/testsuite/rust/