Add ui test for #106182

This commit is contained in:
Obei Sideg 2022-12-30 17:51:42 +03:00
parent cc1dee148d
commit a74a48852a
3 changed files with 46 additions and 0 deletions

View file

@ -0,0 +1,14 @@
// run-rustfix
struct _S(u32, Vec<i32>);
fn _foo(x: &_S) {
match x {
_S(mut _y, _v) => {
//~^ ERROR mismatched types [E0308]
}
}
}
fn main() {
}

View file

@ -0,0 +1,14 @@
// run-rustfix
struct _S(u32, Vec<i32>);
fn _foo(x: &_S) {
match x {
_S(& (mut _y), _v) => {
//~^ ERROR mismatched types [E0308]
}
}
}
fn main() {
}

View file

@ -0,0 +1,18 @@
error[E0308]: mismatched types
--> $DIR/issue-106182.rs:7:12
|
LL | match x {
| - this expression has type `&_S`
LL | _S(& (mut _y), _v) => {
| ^^^^^^^^^^ expected `u32`, found reference
|
= note: expected type `u32`
found reference `&_`
help: consider removing `&` from the pattern
|
LL | _S(mut _y, _v) => {
| ~~~~~~
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.