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
fnmain(){let x = vec![1i32];match&x[..]{[&v] => {},
_ => {},}}
This produces the following error:
error[E0308]: mismatched types
--> src/main.rs:4:10
|
4 | [&v] => {},
| ^^ expected i32, found reference
|
= note: expected type `i32`
found type `&_`
= help: did you mean `v: &i32`?
The error rightly points out that we are matching a reference when we actually have the full value itself.
The problem is the help message at the bottom:
help: did you mean `v: &i32`?
You can't annotate the type of a variable bound in a pattern, so trying this ends up with a syntax error:
error: expected one of `,`, `..`, or `@`, found `:`
--> src/main.rs:4:12
|
4 | [&v: &i32] => {},
| ^ expected one of `,`, `..`, or `@` here
error: aborting due to previous error
That help message should probably not show up in patterns at all.
The text was updated successfully, but these errors were encountered:
Here's the minimal reproduction:
This produces the following error:
The error rightly points out that we are matching a reference when we actually have the full value itself.
The problem is the help message at the bottom:
You can't annotate the type of a variable bound in a pattern, so trying this ends up with a syntax error:
That help message should probably not show up in patterns at all.
The text was updated successfully, but these errors were encountered: