gccrs: avoid ICE when canonical path record is missing#4415
Open
shreyas-omkar wants to merge 1 commit intoRust-GCC:masterfrom
Open
gccrs: avoid ICE when canonical path record is missing#4415shreyas-omkar wants to merge 1 commit intoRust-GCC:masterfrom
shreyas-omkar wants to merge 1 commit intoRust-GCC:masterfrom
Conversation
ed34bbd to
d943657
Compare
Member
|
Hello! The changelog part should points to actual function/type: You probably need to use Also note that you're modifying the Thanks! |
Author
|
Thank You. :) Also please can you take a look at the PR? |
50107cb to
ee52e7b
Compare
This fixes an Internal Compiler Error (ICE) in canonical path resolution triggered by const-generic expressions containing inline item definitions (e.g. structs inside const blocks). Previously, CanonicalPathCtx::get_path unconditionally accessed a canonical path record via get_record, asserting that such a record always exists. However, some AST nodes (e.g. inline items inside const expressions) are not guaranteed to have canonical paths, leading to an ICE. Update canonical path lookup to be optional and handle the absence of a record explicitly, avoiding the assertion failure. gcc/rust/ChangeLog: * resolve/rust-name-resolution-context.h (CanonicalPathCtx::get_path): Move implementation to source file. (CanonicalPathCtx::get_path_opt): New helper returning an optional canonical path. * resolve/rust-name-resolution-context.cc (CanonicalPathCtx::get_path): Use optional canonical path lookup and return empty path instead of asserting on missing records. Signed-off-by: shreyas-omkar <shreyashegdeplus06@gmail.com>
ee52e7b to
244f78b
Compare
Author
|
Hi @dkm Please take a look at PR. |
powerboat9
reviewed
Feb 10, 2026
| if (auto rec = get_record_opt (id)) | ||
| return (*rec)->as_path (*nr_ctx); | ||
|
|
||
| return Resolver::CanonicalPath::create_empty (); |
Collaborator
There was a problem hiding this comment.
Missing canonical paths shouldn't be silently replaced with empty paths
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 #4143
This fixes an Internal Compiler Error (ICE) in canonical path resolution triggered by const-generic expressions containing inline item definitions (e.g. structs inside const blocks).
Previously, CanonicalPathCtx::get_record unconditionally asserted that a canonical path record exists for a NodeId. However, not all AST nodes (e.g. inline items in const expressions) are guaranteed to have canonical paths, leading to an ICE.
Introduce optional canonical path lookup and update callers to handle the absence of a canonical path explicitly, avoiding the assertion failure.
gcc/rust/ChangeLog: