-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
#[cfg(not(test))] doesn't work in dependencies #59168
Comments
AFAIK |
That's unfortunate. It seems that a workaround is to use |
This would be best filed on cargo, not rustc itself, but I don't think we want to rebuild the entire dependency tree for tests necessarily. |
Was there a follow-up issue somewhere else for this bug? |
IIRC, the way we fixed that in diem was to have a [dev-dependencies]
diem-genesis-tool = {path = "../../config/management/genesis", features = ["testing"] } but then in every other crate you had to do stuff like if cfg!(any(test, feature = "testing")) {
// ...
} and #[cfg(any(test, feature = "testing"))]
// ... instead of just having "test" it's a pain |
I have something that looks like
but despite using
cargo test
, I still get a link error saying thatext_fn
isn't found. Is#[cfg(not(test))]
a valid attribute?The text was updated successfully, but these errors were encountered: