-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected compilation error via a combination of binary dependencies, proc macros, crate features, and the target
key
#10525
Comments
target
key
The compile error appears to be caused by multiple versions of
One |
Anyone interested in this should note that I've just discovered another bug that's similar, yet different in a few key ways: #10837 |
Signed-off-by: Roman Volosatovs <[email protected]>
Signed-off-by: Roman Volosatovs <[email protected]>
Signed-off-by: Roman Volosatovs <[email protected]>
Signed-off-by: Roman Volosatovs <[email protected]>
Signed-off-by: Roman Volosatovs <[email protected]>
Here's a tricky failure distilled from a real-world codebase. I've aggressively minimized the reproduction (including each of the individual dependencies; no remote dependencies remain); everything remaining is seemingly necessary to reproduce the failure (crate, item, and feature names have been preserved for easy comparison with the original).
Overview of the minimized dependency graph:
I've published the minimized repo here: https://github.com/bstrie/bindeperror1 .
For completeness, here's a branch with the maximized reproduction in the original codebase: https://github.com/bstrie/enarx/tree/bindeperror1 (revert the last commit to observe the code compiles properly; if testing fixes against this branch be sure to remove the rust-toolchain file).
For posterity I've inlined the minimized repo at the bottom of this issue.
The code in question should compile. Instead,
cargo build
produces the following error:Interestingly, all of the following will cause the code to compile successfully:
target
key in mycrate's Cargo.toml, i.e.:x86_64-unknown-linux-gnu
, so conceptually this should be a no-op. Furthermore, since these crates are proc macros, they should already be targeting the host regardless of the value of thetarget
field. Any other value in thetarget
field (e.g.x86_64-unknown-linux-musl
) produces the same error, so it is the presence of this key that is essential.features
key in structopt-derive's Cargo.toml, i.e.:Output of
cargo version --verbose
:cc @Byron
Code for reference:
// clap_derive/src/lib.rs
The text was updated successfully, but these errors were encountered: