DO_NOT_SUBMIT: Do not provide CrateInfo from staticlib/cdylib #1219
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This draft should be split into smaller PRs and needs tests.
This draft addresses #1063.
There are multiple small fixes:
staticlib. It's more accurate to not include the output hash for
staticlib as well.
provide CrateInfo, DepInfo, and DefaultInfo. They should announce
providing CcInfo (and maybe DefaultInfo - I thought that is implied by
default so there's no need to explicitly mention that)
provide CrateInfo and DepInfo. That is incorrect - outputs of these
rules are not meant for consumption by Rust rules. These rules are
meant to be used when leaving the world of Rust rules and entering the
world of other language that wants to depend on native library (and it
doesn't matter to this user if the library is written in Rust, C, C++,
or other)
Lastly, this PR makes https://github.com/boxdot/bazel-rust-linking-issue build. Surprising plot twist - it is actually not supported to link rust_static_library into a rust_binary. From rustc docs:
https://doc.rust-lang.org/reference/linkage.html#linkage.
The
bazel-rust-linking-issue
fails at linktime since there aremultiple definitions of allocator stubs. We may want to consider
detecting this situation and failing the build with a nice error message
saying this is not how these rules are intended to be used.