fix: analyze include roots as fragments - #166
Draft
evanbrobertson wants to merge 1 commit into
Draft
Conversation
8 tasks
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.
Closes #158.
What changed
.iroot as an include fragment across the shared pipeline, CLI, and LSPRUNworkspace missesanalyzeenvelopeWhy
An
.ifile is a textual fragment. When opened directly, declarations, imports, scopes, reads, and writes supplied by its includer are absent. Treating that fragment as a complete compilation unit produced large waves of false undefined-symbol, unused-variable, and dead-store findings in the editor.The root cause was not a different lint implementation in the LSP: every client shares the same pipeline, but the editor can feed that pipeline an
.ias a root while directory discovery deliberately feeds the CLI only complete root extensions.Impact
Directly opened include fragments now provide useful but explicitly reduced diagnostics. The same
.iexpanded through a.p,.w,.cls, or.vremains part of an ordinary complete-unit analysis with all rules enabled.On the reported include, the merge-base produced 57 false lint findings (44 undefined symbols, 5 unused variables, and 8 dead stores); this branch produces none. A deterministic sample of 50 include roots fell from 684 findings to one locally provable type mismatch. An A/B over 10,482 ordinary roots produced byte-identical JSON and stderr, confirming that complete-unit behavior did not move.
Verification
cargo fmt --all -- --checkcargo check --workspace --all-targetscargo clippy --workspace --all-targets -- -D warningscargo test --workspace