admin管理员组

文章数量:1241128

I am stuck with the following problem. I have a workspace containing several crates anized like this:

Top level Cargo.toml:

[workspace]
members = [
"molar",
"molar_python", 
...
...
]

The crate molar has a feature gromacs, which turns on conditional compilation in several places and activates another dependency.

molar/Cargo.toml:

[features]
gromacs = ["dep:molar_gromacs"]

Now, when I'm compiling molar_python, which depends on molar, I want to propagate gromacs feature down to molar like this:

molar_python/Cargo.toml:

[dependencies]    
molar = {version = "0.8.0", path = "../molar", default-features = false}
...
[features]
gromacs = ["molar/gromacs"]

The idea is that when I do cargo build -p molar_python --features=gromacs the feature is propagated to molar crate and switches on the same feature there. At least it should work like this according to the manual. However, it doesn't work at all. Whatever I do I can't activate gromacs feature in molar crate indirectly from molar_python. The only way is to explicitly switch it on in the crate itself.

Am I missing something obvious? What is the correct way of doing this?

This happens in my molar crate.

本文标签: rustPropagating features in workspace doesn39t workStack Overflow