bazelbuild / bazelbuild/rules_rust

Crate universe: extra crate_features from unrelated crate with resolver = "2"

Open
#1,851 6 comments 3 reactions 0 assignees View on GitHub
bug crate-universe needs-triage
Dominant language
Starlark
Stars
843
Forks
651
Avg merge
2d 18h
Merged PRs (30d)
15

Description

I'm unsure if this is a bug, a missing feature or just a question, but I have a problem with crate universe I can't get around. The background is that tokio has features that can not be built with WASM, but I want to use these features in unrelated non-wasm crates in the same cargo workspace, where I have a WASM crate.

I added a reproduction of this here:

https://github.com/ttiurani/rules_rust/tree/main/examples/crate_universe_failure/extra_crate_features

I'm guessing this problem is not uncommon, and I believe slightly different problem than #1727 (feature unification is not the problem here as the crates are unrelated). Also I am inheriting these tokio features through other upstream crates so don't quite know how I would create separate rust_libraries in my Bazel workspace.

I stumbled across a similar issue with plain Cargo as well, but there using `edition = "2021"` and/or `resolver = "2"` fixed the problem:

https://github.com/rust-lang/cargo/issues/11653

Is supporting this behavior of `resolver = "2"` in the roadmap for crate universe?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.