I'm not sure if this is a bug or intended behaviour.
in A/src/main.rs
#[cfg(test)]
mod test {
use B::Foo;
#[test]
fn check() {
let a = Foo::A;
let b = Foo::B("haha".to_string());
println!("{a:?}, {b:?}")
}
}
in B/src/lib.rs
#[derive(Debug)]
pub enum Foo {
A,
#[cfg(test)]
B(String),
}
cargo test
exits with
error[E0599]: no variant or associated item named `B` found for enum `Foo` in the current scope
--> src/main.rs:9:22
|
9 | let b = Foo::B("haha".to_string());
| ^
| |
| variant or associated item not found in `Foo`
| help: there is a variant with a similar name: `A`