How to debug --features flags?


I’m having trouble debugging my command line options to cargo, specifically --features is not doing what I want. Any idea how to determine what features cargo is actually enabling? I find it frustrating that cargo seems to silently ignore misspellings and non-existent features.



With cargo build -v, you should see those features as rustc --cfg options. If you only care about the final crate, you could also try: cargo rustc --features "..." -- --print cfg

Hmm, I tried a bad name just now and got “Package […] does not have these features”.



Thanks for the quick response! It turns out that the issue was that I was building in a workspace, which wasn’t sending the features to the crate that I was actually wanting to build. Changing directory fixed the issue. So there is a bug here, but it is already known. I’m surprised, because in most ways cargo seems pretty solid. I’m pretty new to workspaces, but expected them to work.