type annotations needed
for if let Some(whatever) = todo!() {
not very helpful
#141742
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-inference
Area: Type inference
A-patterns
Relating to patterns and pattern matching
D-lack-of-suggestion
Diagnostics: Adding a (structured) suggestion would increase the quality of the diagnostic.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Uh oh!
There was an error while loading. Please reload this page.
Code
Current output
It's not really clear how rustc would like to see the type annotations, without adding an extra binding and without
type_ascription
What does not work:
if let Some(whatever): Option<i32> = todo!() {
or
if let Some(whatever: i32) = todo!() {
what did end up working:
if let Some(x) = Some(todo!()) {
or
if let Some(x @ ()) = todo!() {
zulip thread: https://rust-lang.zulipchat.com/#narrow/channel/147480-t-compiler.2Fdiagnostics/topic/type.20annotations.20needed.20.60if.20let.20Some.28x.29.20.3D.20todo!.28.29.60/with/521126024
Rust Version
The text was updated successfully, but these errors were encountered: