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

Fix proc_macro_dylib_path when they are built in both opt and debug #1089

Merged
merged 3 commits into from
Jan 11, 2022

Conversation

djmarcin
Copy link
Contributor

@djmarcin djmarcin commented Jan 11, 2022

For workspace members, a crate_spec is generated for both opt and debug configurations, but when a build is executed, proc-macros are built and used only in the opt configuration. This can result in rust-analyzer looking for the proc macro in the fastbuild location when it was only created in the opt location. Rust analyzer will then be unable to find and use the dylib and code generated by the proc-macro will not have annotations.

This PR fixes the issue by preferring the proc_macro_dylib_path with the -opt-exec- path component when merging CrateSpecs.

Copy link
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! One question just for my own education, if you don't mind 😅

tools/rust_analyzer/aquery.rs Show resolved Hide resolved
@UebelAndre UebelAndre merged commit b16c26b into bazelbuild:main Jan 11, 2022
cfredric pushed a commit to cfredric/rules_rust that referenced this pull request Feb 16, 2022
…azelbuild#1089)

* Fix proc_macro_dylib_path in cases where they are built in both opt and debug

* Resolve rustfmt issues

* Update test comment
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.

None yet

2 participants