Fix invalid Rust identifiers generated from symbol names - #21
Draft
KakarottoCake wants to merge 1 commit into
Draft
Fix invalid Rust identifiers generated from symbol names#21KakarottoCake wants to merge 1 commit into
KakarottoCake wants to merge 1 commit into
Conversation
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.
Description
Generated function names can fail to compile when a source symbol becomes empty after sanitization or begins with a digit. This change gives empty results a neutral fallback and prefixes digit-leading results so the generated Rust identifier has a valid start.
Existing valid identifiers and the current punctuation normalization remain unchanged.
Type of Change
Related Issues
No linked issue.
Changes Made
functionwhen sanitization would otherwise produce an empty string.function_.Testing
cargo fmt --all -- --check— passed locally and on Ubuntu stable.cargo test -p gcrecomp-core— passed on Ubuntu stable: 23 tests across four test binaries, 0 failed.cargo clippy -p gcrecomp-core --all-targets --all-features -- -D warnings— passed on Ubuntu stable.git diff --check upstream/main...HEAD— passed locally.upstream/main; only the sanitizer and focused codegen tests are changed.Remote validation: focused CI run. Upstream's own CI is waiting for the repository's first-time-contributor workflow approval; GitHub reports
action_required, not a test failure. Local Rust test/clippy execution was blocked because this Windows shell resolves DevkitPro's Unixlink.exeinstead of the Microsoft linker, so the package checks were run in the clean Ubuntu stable workflow above.Checklist
Additional Notes
The fixtures are entirely synthetic and the branch is based directly on the current
upstream/main(d380537).