Closed
Description
On nightly rustc (cargo) I get misleading expected type errors. If a crate has the same(?) type it is displayed instead of the std type.
I tried this code:
extern crate bitflags;
fn test(r: Result<Option<()>, &'static str>) { }
fn main() { test(Ok(())); }
I expected to see this happen: (stable rust)
$ rustup default stable
$ cargo build
Compiling rust-sample v0.1.0 (file:///[...]/rust-sample)
error[E0308]: mismatched types
--> src/main.rs:3:21
|
3 | fn main() { test(Ok(())); }
| ^^
| |
| expected enum `std::option::Option`, found ()
| help: try using a variant of the expected type: `Some(())`
|
= note: expected type `std::option::Option<()>`
found type `()`
Instead, this happened: (nightly)
$ rustup default nightly
$ cargo build
Compiling rust-sample v0.1.0 (file:///[...]/rust-sample)
error[E0308]: mismatched types
--> src/main.rs:3:21
|
3 | fn main() { test(Ok(())); }
| ^^
| |
| expected enum `bitflags::<unnamed>::option::Option`, found ()
| help: try using a variant of the expected type: `bitflags::<unnamed>::prelude::v1::Some(())`
|
= note: expected type `bitflags::<unnamed>::option::Option<()>`
found type `()`
Meta
rustc --version --verbose
:
rustc 1.23.0-nightly (5041b3bb3 2017-11-19)
binary: rustc
commit-hash: 5041b3bb3d953a14f32b15d1e41341c629acae12
commit-date: 2017-11-19
host: x86_64-unknown-linux-gnu
release: 1.23.0-nightly
LLVM version: 4.0