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 type error in rust-analyzer rule #2479

Merged
merged 1 commit into from
Feb 16, 2024

Conversation

UebelAndre
Copy link
Collaborator

@UebelAndre UebelAndre commented Feb 16, 2024

Before this change, users would fail with the following error:

~/Code/rules_rust/examples (main ✔) bazel run @rules_rust//tools/rust_analyzer:gen_rust_project
INFO: Analyzed target @@rules_rust//tools/rust_analyzer:gen_rust_project (51 packages loaded, 2095 targets configured).
INFO: Found 1 target...
Target @@rules_rust//tools/rust_analyzer:gen_rust_project up-to-date:
  bazel-bin/external/rules_rust/tools/rust_analyzer/gen_rust_project
INFO: Elapsed time: 0.530s, Critical Path: 0.01s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/external/rules_rust/tools/rust_analyzer/gen_rust_project
Error: bazel build failed:(exit status: 1)
Computing main repo mapping:
Loading:
Loading: 0 packages loaded
Analyzing: 99 targets (38 packages loaded, 0 targets configured)
Analyzing: 99 targets (38 packages loaded, 0 targets configured)
[0 / 1] [Prepa] BazelWorkspaceStatusAction stable-status.txt
DEBUG: /private/var/tmp/_bazel_user/1426ad6c00f8f7b996ddc75bef70871c/external/rules_rust/bindgen/private/bindgen.bzl:280:14: WARN: rust_bindgen.leak_symbols is set to True for @//bindgen:simple_leaked_bindgen__bindgen - please file an issue at https://github.com/bazelbuild/rules_rust/issues explaining why this was necessary, as this support will be removed soon.
ERROR: /Users/user/Code/rules_rust/examples/bindgen/BUILD.bazel:4:21: in @@rules_rust//rust/private:rust_analyzer.bzl%rust_analyzer_aspect aspect on rust_library rule //bindgen:simple_bindgen:
Traceback (most recent call last):
	File "/private/var/tmp/_bazel_user/1426ad6c00f8f7b996ddc75bef70871c/external/rules_rust/rust/private/rust_analyzer.bzl", line 149, column 51, in _rust_analyzer_aspect_impl
		content = json.encode(_create_single_crate(ctx, rust_analyzer_info)),
	File "/private/var/tmp/_bazel_user/1426ad6c00f8f7b996ddc75bef70871c/external/rules_rust/rust/private/rust_analyzer.bzl", line 233, column 47, in _create_single_crate
		out_dir_path = info.build_info.out_dir.path
Error: 'NoneType' value has no field or method 'path'
ERROR: Analysis of aspects '[@@rules_rust//rust:defs.bzl%rust_analyzer_aspect] with parameters {} on //bindgen:simple_bindgen' failed; build aborted: Analysis of target '//bindgen:simple_bindgen' failed
INFO: Elapsed time: 0.552s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully

This change fixes this issue.

@daivinhtran
Copy link
Contributor

Should you change the PR title to "Add CI Jobs for rust-analyzer rule" instead? I don't see any fix in the PR.

@UebelAndre UebelAndre merged commit 16f45cc into bazelbuild:main Feb 16, 2024
3 checks passed
@UebelAndre UebelAndre deleted the rust-analyzer branch February 16, 2024 03:23
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