You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running the unit test for a crate, the #[cfg(test)] attribute is not respected for dependencies, & the dependent crate cannot use code that is gated behind this condition.
I am not sure as to whether this is a bug or an intended feature and I cannot find documentation in regards to either.
For a minimum reproducible example see my repository.
For an in-line example:
// In crate `conditional`#[cfg(test)]pubstructContitional;
// Separate crate depending on `conditional`#[cfg(test)]mod tests {#[test]fnuse_contitional(){
conditional::Conditional;}}
Gives the following error when cargo test is run:
error[E0425]: cannot find value `Conditional` in crate `conditional`
Notes
I found this issue on the rust repository, which suggested to open an issue on the cargo repository, but i was not able to find such an issue, so i am opening one myself.
When running the unit test for a crate, the
#[cfg(test)]
attribute is not respected for dependencies, & the dependent crate cannot use code that is gated behind this condition.I am not sure as to whether this is a bug or an intended feature and I cannot find documentation in regards to either.
For a minimum reproducible example see my repository.
For an in-line example:
Gives the following error when
cargo test
is run:Notes
I found this issue on the rust repository, which suggested to open an issue on the cargo repository, but i was not able to find such an issue, so i am opening one myself.
Cargo version information
The text was updated successfully, but these errors were encountered: