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
error[E0308]: mismatched types
--> tvdh.rs:2:10
|
2 | Some(0_u32)
| ---- ^^^^^ expected `()`, found `u32`
| |
| arguments to this enum variant are incorrect
|
note: tuple variant defined here
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.
The note starting with "note: tuple variant defined here" is confusing. Where is "here"?
I suspect it's trying to to show part of the definition of the Option type, but failing because the definition is in a different crate (or because it's part of std).
Ideal output
Don't try to show the enum-variant definition when it can't be shown, I guess?
For cases like this one that involve generics, see #105240 for a proposed alternative.
Regression
The empty note first appears in nightly-2022-06-12
This seems to have been fixed, on stable (1.69.0) it produces
error[E0308]: mismatched types
--> test.rs:2:10
|
2 | Some(0_u32)
| ---- ^^^^^ expected `()`, found `u32`
| |
| arguments to this enum variant are incorrect
|
help: the type constructed contains `u32` due to the type of the argument passed
--> test.rs:2:5
|
2 | Some(0_u32)
| ^^^^^-----^
| |
| this argument influences the type of `Some`
note: tuple variant defined here
--> /home/jieyouxu/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:571:5
|
571 | Some(#[stable(feature = "rust1", since = "1.0.0")]T),
|
Activity
jieyouxu commentedon May 30, 2023
This seems to have been fixed, on stable (1.69.0) it produces
jruderman commentedon Nov 5, 2023
The filename option.rs is now shown (fixed in #104449)
The new hint "... due to the type of the argument passed" was added in #106752