fix(parser): accept FN records with a negative line number - #1516
Open
Eljees wants to merge 1 commit into
Open
Conversation
FN:-1,<name> is emitted for synthetic functions that have no source line (JaCoCo output for Scala's .curried/.tupled). The FN branch peeks at the first byte and rejects anything that is not a digit, so in the default strict mode manage_parsing_error! returns Err and the whole coverage file is dropped, not just the one record. Function.start is a u32, so a negative line cannot be represented. Accept an optional leading '-', treat such a function as synthetic and record it at line 0, which keeps the function name and its FNDA counter working. A missing line number (FN:,name) stays an error. Addresses the parsing half of mozilla#1514.
Author
|
Same note as on #1515 about the red The five clippy errors are in I listed the exact lints and offered a separate cleanup PR over on #1515, to keep the discussion in one place. |
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 the parsing half of #1514.
FN:-1,<name>is emitted for synthetic functions that have no source line — the reporter hit it with JaCoCo output for Scala's.curried/.tupled. TheFNbranch peeks at the first byte and rejects anything that is not a digit (src/parser.rs:289), so with the default (strict) modemanage_parsing_error!returnsErrand the whole coverage file is dropped, not just the one record.Function.startis au32, so a negative line cannot be represented. The patch accepts an optional leading-, treats such a function as synthetic and records it at line 0, which keeps the function name and itsFNDAcounter working. A missing line number (FN:,name) stays an error — there is a test for that.before / after
The deadlock half of #1514 is not addressed here. The reporter also describes the main thread hanging in
futex_waitwhen many worker threads panic. That is a change to the threading model insrc/main.rs, and the trigger is the panics themselves — several of which are removed by #1515. Worth tracking separately.Relationship to #1515. Both branches touch
src/parser.rs, but they are independent and each is based onmaster, so they can be reviewed in either order. If #1515 lands first this one needs a trivial rebase — say the word and I will push it.AI-assisted: I used Claude to help locate the strict-mode rejection and to draft the patch and the tests. I reviewed every line, ran the new test against unpatched
masterfirst to confirm it fails without the fix, and rancargo fmt --checkandcargo clippy -- -D warningsper the repo's pre-commit config; the analysis and the runs are mine.