Fix function debug info when file content is missing#9875
Open
s0mnathh wants to merge 1 commit intostarkware-libs:mainfrom
Open
Fix function debug info when file content is missing#9875s0mnathh wants to merge 1 commit intostarkware-libs:mainfrom
s0mnathh wants to merge 1 commit intostarkware-libs:mainfrom
Conversation
orizi
requested changes
Apr 23, 2026
Collaborator
orizi
left a comment
There was a problem hiding this comment.
@orizi made 1 comment.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on s0mnathh).
a discussion (no related file):
There's no actual way this may happen organically - so this just make the code more complicated for no good reason.
please close PR.
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.
Summary
Avoid panicking during function debug info extraction when the source file content is unavailable. Return
Nonefor the affected variable mapping and add a unit test that covers the missing-file path.Type of change
Please check one:
Why is this change needed?
Debug info extraction already models missing source locations as
Option, but variable name extraction still useddb.file_content(...).unwrap(). When file content is unavailable this can panic instead of degrading gracefully.What was the behavior or documentation before?
If the user-location file content could not be loaded, debug info extraction could panic while trying to build the variable name, even though the surrounding code path otherwise uses optional fallbacks.
What is the behavior or documentation after?
Variable name extraction now returns
Nonewhen file content is missing, so the mapper skips that entry instead of panicking. The new unit test exercises this behavior with an empty testing database and a missing on-disk file.Related issue or discussion (if any)
Additional context
This keeps the change aligned with the existing
maybe_code_locationsemantics and limits the fix to the local debug-info extraction path.