Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve consolidation of rust-analyzer crate specs with generated sources #3040

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

martingms
Copy link

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 corresponding rust_test with crate set to the library, the following is wrong in the generated rust-project.json if the file for the test crate is evaluted first:

  • The "source"-field is unpopulated
  • The "root_module"-field points to a symlink(?) in the execroot instead of the lib.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!

This fixes //test/rust_analyzer:rust_analyzer_test which seems to
currently fail on main branch.
@martingms martingms force-pushed the consolidate-crate-spec-fixes branch from 780c0f3 to 284f5a2 Compare December 18, 2024 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant