Improve consolidation of rust-analyzer crate specs with generated sources #3040
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.
I have pretty much the exact setup that is tested in
test/rust_analyzer/generated_srcs_test
, which currently seems to fail on the main branch (at least on my machine).Explicitly, the issue is that when consolidating the specs for a
rust_library
with a mix of generated and non-generated sources and a correspondingrust_test
withcrate
set to the library, the following is wrong in the generatedrust-project.json
if the file for the test crate is evaluted first:"source"
-field is unpopulated"root_module"
-field points to a symlink(?) in the execroot instead of thelib.rs
file that is in the workspace.This confuses rust-analyzer.
I don't know the
rules_rust
codebase well enough to say whether this is the correct place to address these issues, and I see @sam-mccall is curently working on related stuff, so I just made the smallest possible change that fixed my issue.Feel free to just take this as a bug-report if that's more convenient!