Skip to content

Do not add CcInfo from dependencies that don't have them #369

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

Merged
merged 1 commit into from
Jul 3, 2020
Merged
Show file tree
Hide file tree
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
20 changes: 20 additions & 0 deletions examples/hello_lib/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,26 @@ rust_library(
crate_type = "staticlib",
)

# Regression test for #368: static lib with dependencies fail.
rust_library(
name = "hello_test_staticlib",
srcs = [
"tests/greeting.rs",
],
deps = [":hello_lib"],
crate_type = "staticlib",
)

# Regression test for #368: cdylib lib with dependencies fail.
rust_library(
name = "hello_test_cdylib",
srcs = [
"tests/greeting.rs",
],
deps = [":hello_lib"],
crate_type = "cdylib",
)

rust_test(
name = "hello_lib_test",
crate = ":hello_lib",
Expand Down
2 changes: 1 addition & 1 deletion rust/private/rustc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ def establish_cc_info(ctx, crate_info, toolchain, cc_toolchain, feature_configur
linker_inputs = depset([link_input]),
)

cc_infos = [dep[CcInfo] for dep in ctx.attr.deps]
cc_infos = [dep[CcInfo] for dep in ctx.attr.deps if CcInfo in dep]
cc_infos.append(CcInfo(linking_context = linking_context))

return [cc_common.merge_cc_infos(cc_infos = cc_infos)]
Expand Down