rust/tests/ui/match/ref_pat_everywhere-fail.stderr
2024-05-10 13:47:34 -04:00

39 lines
1.2 KiB
Plaintext

error[E0308]: mismatched types
--> $DIR/ref_pat_everywhere-fail.rs:4:17
|
LL | if let Some(&x) = Some(0) {
| ^^ ------- this expression has type `Option<{integer}>`
| |
| expected integer, found `&_`
|
= note: expected type `{integer}`
found reference `&_`
help: consider removing `&` from the pattern
|
LL | if let Some(x) = Some(0) {
| ~
error[E0308]: mismatched types
--> $DIR/ref_pat_everywhere-fail.rs:8:17
|
LL | if let Some(&mut x) = Some(&0) {
| ^^^^^^ -------- this expression has type `Option<&{integer}>`
| |
| types differ in mutability
|
= note: expected reference `&{integer}`
found mutable reference `&mut _`
note: to declare a mutable binding use: `mut x`
--> $DIR/ref_pat_everywhere-fail.rs:8:17
|
LL | if let Some(&mut x) = Some(&0) {
| ^^^^^^
help: consider removing `&mut` from the pattern
|
LL | if let Some(x) = Some(&0) {
| ~
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0308`.