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

rust_doc_test error when crate has transitive cc_library dependencies #1016

Closed
UebelAndre opened this issue Nov 14, 2021 · 0 comments · Fixed by #1015
Closed

rust_doc_test error when crate has transitive cc_library dependencies #1016

UebelAndre opened this issue Nov 14, 2021 · 0 comments · Fixed by #1015

Comments

@UebelAndre
Copy link
Collaborator

UebelAndre commented Nov 14, 2021

I'm getting this error trying to use rust_doc_test on 1fc2993

Traceback (most recent call last):
	File "/private/var/tmp/_bazel_user/c4900dc498759a5aae30fdfe5c69c114/external/rules_rust/rust/private/rustdoc_test.bzl", line 44, column 33, in _rust_doc_test_impl
		flags = _build_rustdoc_flags(dep_info, crate_info)
	File "/private/var/tmp/_bazel_user/c4900dc498759a5aae30fdfe5c69c114/external/rules_rust/rust/private/rustdoc_test.bzl", line 108, column 37, in _build_rustdoc_flags
		is_static = bool(lib_to_link.static_library or lib_to_link.pic_static_library)
Error: 'LinkerInput' value has no field or method 'static_library'

The target I'm using rust_doc_test on transitive cc_library dependencies which I suspect is the cause of the issue here.

The issue can be reproduced with the following diff to rules_rust:

diff --git a/examples/bindgen/BUILD.bazel b/examples/bindgen/BUILD.bazel
index 8e36e20..e4aede4 100644
--- a/examples/bindgen/BUILD.bazel
+++ b/examples/bindgen/BUILD.bazel
@@ -1,6 +1,6 @@
 load("@rules_cc//cc:defs.bzl", "cc_library")
 load("@rules_rust//bindgen:bindgen.bzl", "rust_bindgen_library")
-load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_test")
+load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_test", "rust_doc_test")

 cc_library(
     name = "simple",
@@ -26,3 +26,8 @@ rust_test(
     name = "simple_test",
     crate = ":simple_example",
 )
+
+rust_doc_test(
+    name = "doc_test",
+    crate = ":simple_example",
+)
@UebelAndre UebelAndre added the bug label Nov 14, 2021
@UebelAndre UebelAndre changed the title rust_doc_test test errors rust_doc_test error when crate has transitive cc_library dependencies Nov 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant