Closed
Description
(the title of this issue is terrible, sorry!)
As demonstrated in this repository
lib.rs
pub struct Foo (pub int);
pub enum MyEnum {
Foo(Foo),
}
test.rs
extern crate meow;
use meow::{Foo, MyEnum};
#[test]
fn test() {
MyEnum::Foo(Foo(5));
}
Shouldn't this test work? Right now, it thinks the inner Foo
is the MyEnum::Foo
variant, which is not the case.
/t/m/meow (master|✔) $ cargo build; and cargo test --verbose
Compiling meow v0.0.1 (file:///private/tmp/meow/meow)
Running `rustc /private/tmp/meow/meow/src/lib.rs --crate-name meow --crate-type lib -g --test -C metadata=425f6212fa03ed6b -C extra-filename=-425f6212fa03ed6b --out-dir /private/tmp/meow/meow/target --dep-info /private/tmp/meow/meow/target/.fingerprint/meow-df845645e3f32c19/dep-test-lib-meow -L /private/tmp/meow/meow/target -L /private/tmp/meow/meow/target/deps`
Running `rustc /private/tmp/meow/meow/tests/test.rs --crate-name test --crate-type bin -g --test -C metadata=35d1dbe396721794 -C extra-filename=-35d1dbe396721794 --out-dir /private/tmp/meow/meow/target --dep-info /private/tmp/meow/meow/target/.fingerprint/meow-df845645e3f32c19/dep-test-bin-test -L /private/tmp/meow/meow/target -L /private/tmp/meow/meow/target/deps --extern meow=/private/tmp/meow/meow/target/libmeow-df845645e3f32c19.rlib`
/private/tmp/meow/meow/tests/test.rs:8:21: 8:22 error: mismatched types: expected `meow::Foo`, found `_` (expected struct meow::Foo, found integral variable)
/private/tmp/meow/meow/tests/test.rs:8 MyEnum::Foo(Foo(5));
^
/private/tmp/meow/meow/tests/test.rs:8:17: 8:23 error: mismatched types: expected `meow::Foo`, found `meow::MyEnum` (expected struct meow::Foo, found enum meow::MyEnum)
/private/tmp/meow/meow/tests/test.rs:8 MyEnum::Foo(Foo(5));
^~~~~~
error: aborting due to 2 previous errors
Build failed, waiting for other jobs to finish...
Could not compile `meow`.
Caused by:
Process didn't exit successfully: `rustc /private/tmp/meow/meow/tests/test.rs --crate-name test --crate-type bin -g --test -C metadata=35d1dbe396721794 -C extra-filename=-35d1dbe396721794 --out-dir /private/tmp/meow/meow/target --dep-info /private/tmp/meow/meow/target/.fingerprint/meow-df845645e3f32c19/dep-test-bin-test -L /private/tmp/meow/meow/target -L /private/tmp/meow/meow/target/deps --extern meow=/private/tmp/meow/meow/target/libmeow-df845645e3f32c19.rlib` (status=101)
I feel like this is one of those moment where I'm doing something very obviously wrong.
Metadata
Metadata
Assignees
Labels
No labels