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 rust-analyzer's complaint about not finding proc macro library #918

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/generate_rust_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Copy link
Member

Choose a reason for hiding this comment

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

Is .resolve() necessary?

Copy link
Author

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.

Copy link
Member

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?

Copy link
Author

Choose a reason for hiding this comment

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

as shown here
image

Copy link
Author

@vtta vtta Oct 18, 2022

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.

Copy link
Member

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?

Copy link
Author

@vtta vtta Oct 18, 2022

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

Copy link
Member

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.

Copy link
Author

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.


append_crate(
"build_error",
Expand Down