Skip to content

Enable Cargo feature in BUILD.bazel rust_test #1869

Answered by illicitonion
antjori asked this question in Q&A
Discussion options

You must be logged in to vote

This is working as intended - crate_feature applies to the specific code it's compiling and nothing else.

If you want to achieve what you're trying to do, you'd need a second copy of the rust_library which enables the feature, and to have the rust_test depend on that.

(Alternatively, you could potentially use a transition to alter the rust_library, but the effect is the same - effectively splitting the rust_library into two targets)

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@antjori
Comment options

Comment options

You must be logged in to vote
3 replies
@antjori
Comment options

@illicitonion
Comment options

@antjori
Comment options

Answer selected by antjori
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants