From a74a48852a50628b8de61ad5534f4eb3d31ecc6e Mon Sep 17 00:00:00 2001 From: Obei Sideg Date: Fri, 30 Dec 2022 17:51:42 +0300 Subject: [PATCH] Add ui test for #106182 --- .../ui/mismatched_types/issue-106182.fixed | 14 ++++++++++++++ src/test/ui/mismatched_types/issue-106182.rs | 14 ++++++++++++++ .../ui/mismatched_types/issue-106182.stderr | 18 ++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 src/test/ui/mismatched_types/issue-106182.fixed create mode 100644 src/test/ui/mismatched_types/issue-106182.rs create mode 100644 src/test/ui/mismatched_types/issue-106182.stderr diff --git a/src/test/ui/mismatched_types/issue-106182.fixed b/src/test/ui/mismatched_types/issue-106182.fixed new file mode 100644 index 0000000000000..b8ddebf6fb639 --- /dev/null +++ b/src/test/ui/mismatched_types/issue-106182.fixed @@ -0,0 +1,14 @@ +// run-rustfix + +struct _S(u32, Vec); + +fn _foo(x: &_S) { + match x { + _S(mut _y, _v) => { + //~^ ERROR mismatched types [E0308] + } + } +} + +fn main() { +} diff --git a/src/test/ui/mismatched_types/issue-106182.rs b/src/test/ui/mismatched_types/issue-106182.rs new file mode 100644 index 0000000000000..6eb6df13a028c --- /dev/null +++ b/src/test/ui/mismatched_types/issue-106182.rs @@ -0,0 +1,14 @@ +// run-rustfix + +struct _S(u32, Vec); + +fn _foo(x: &_S) { + match x { + _S(& (mut _y), _v) => { + //~^ ERROR mismatched types [E0308] + } + } +} + +fn main() { +} diff --git a/src/test/ui/mismatched_types/issue-106182.stderr b/src/test/ui/mismatched_types/issue-106182.stderr new file mode 100644 index 0000000000000..ac3ab8e9895c4 --- /dev/null +++ b/src/test/ui/mismatched_types/issue-106182.stderr @@ -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`.