rust/tests/ui/match/ref_pat_everywhere-mutability-mismatch.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

45 lines
1.4 KiB
Plaintext
Raw Normal View History

error[E0308]: mismatched types
2024-04-02 10:54:29 -05:00
--> $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
2024-04-02 10:54:29 -05:00
--> $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 `&_`
2024-04-02 10:54:29 -05:00
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`.