rust/tests/ui/match/ref_pat_everywhere-mutability-mismatch.stderr
2024-04-02 10:57:54 -05:00

45 lines
1.4 KiB
Plaintext

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