-
Notifications
You must be signed in to change notification settings - Fork 435
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 rust-analyzer's complaint about not finding proc macro library #918
Conversation
Fix rust-analyzer's complaint about not finding proc macro library
@@ -65,7 +65,7 @@ def append_crate(display_name, root_module, deps, cfg=[], is_workspace_member=Tr | |||
[], | |||
is_proc_macro=True, | |||
) | |||
crates[-1]["proc_macro_dylib_path"] = "rust/libmacros.so" | |||
crates[-1]["proc_macro_dylib_path"] = str((objtree / "rust/libmacros.so").resolve(True)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is .resolve()
necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, during my testing, objtree
sometimes is empty, the reason is unknown.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In which case is it empty where you need absolute paths?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In which case is it empty where you need absolute paths?
After I copied the generated rust-project.json
from build tree to my out-of-tree module directory, the complaint will show up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You did have to run this script for your out of tree module rather than copying the in-tree rust-project.json file anyway to handle the out of tree module itself, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory yes, but currently the kernel Makefile does not support calling it in module directory with make -C <path-to-build-root> M=<path-to-module> rust-analyzer
Maybe I will add that support later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, #914 would add support for this AFAICT. Looks like it also fixes proc macros.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I didn't notice that one. Then I will close this.
The generated rust-project.json contains:
If we use this file in an out-of-tree module to let rust-analyzer index symbols it will complain about not finding proc macro library
Make
proc_macro_dylib_path
absolute fix this issue.