Closed
Description
I tried this code:
// in a/src/lib.rs which has a dependency on crate b
pub fn mk_struct() -> b::SomeStruct {
b::SomeStruct
}
#[test]
fn wer() {
// compiles
assert_eq!(self::mk_struct(), b::SomeStruct);
}
// in b/src/lib.rs which has dev-dependency on crate a
#[derive(PartialEq, Eq, Debug)]
pub struct SomeStruct;
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
// doesn't compile with following error
// expected struct `b::SomeStruct`, found struct `SomeStruct`
a::mk_struct() == super::SomeStruct;
}
}
I would expect this code to compile but instead it emits the error "expected struct b::NonGeneric
, found struct NonGeneric
" which is odd as I would think they are the same type.
Meta
Reproducible on 1.56.0-nightly.
Repository: https://github.com/andyyu2004/rust-bug-repro