summaryrefslogtreecommitdiffstats
path: root/tests/ui/match
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:25:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:25:56 +0000
commit018c4950b9406055dec02ef0fb52f132e2bb1e2c (patch)
treea835ebdf2088ef88fa681f8fad45f09922c1ae9a /tests/ui/match
parentAdding debian version 1.75.0+dfsg1-5. (diff)
downloadrustc-018c4950b9406055dec02ef0fb52f132e2bb1e2c.tar.xz
rustc-018c4950b9406055dec02ef0fb52f132e2bb1e2c.zip
Merging upstream version 1.76.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/match')
-rw-r--r--tests/ui/match/issue-11319.stderr2
-rw-r--r--tests/ui/match/issue-70972-dyn-trait.stderr2
-rw-r--r--tests/ui/match/issue-74050-end-span.stderr2
-rw-r--r--tests/ui/match/issue-91058.stderr2
-rw-r--r--tests/ui/match/issue-92100.stderr7
-rw-r--r--tests/ui/match/match-arm-resolving-to-never.stderr2
-rw-r--r--tests/ui/match/match-ill-type2.stderr2
-rw-r--r--tests/ui/match/match-join.stderr2
-rw-r--r--tests/ui/match/match-no-arms-unreachable-after.stderr2
-rw-r--r--tests/ui/match/match-pattern-field-mismatch-2.stderr2
-rw-r--r--tests/ui/match/match-pattern-field-mismatch.stderr2
-rw-r--r--tests/ui/match/match-ref-mut-invariance.stderr2
-rw-r--r--tests/ui/match/match-ref-mut-let-invariance.stderr2
-rw-r--r--tests/ui/match/match-struct.stderr2
-rw-r--r--tests/ui/match/match-tag-nullary.stderr2
-rw-r--r--tests/ui/match/match-tag-unary.stderr2
-rw-r--r--tests/ui/match/match-tail-expr-never-type-error.rs16
-rw-r--r--tests/ui/match/match-tail-expr-never-type-error.stderr21
-rw-r--r--tests/ui/match/match-unresolved-one-arm.stderr2
-rw-r--r--tests/ui/match/match-vec-mismatch-2.stderr2
-rw-r--r--tests/ui/match/non-first-arm-doesnt-match-expected-return-type.stderr2
-rw-r--r--tests/ui/match/single-line.stderr2
22 files changed, 62 insertions, 20 deletions
diff --git a/tests/ui/match/issue-11319.stderr b/tests/ui/match/issue-11319.stderr
index fc44205e8..8280547af 100644
--- a/tests/ui/match/issue-11319.stderr
+++ b/tests/ui/match/issue-11319.stderr
@@ -16,6 +16,6 @@ LL | | _ => true
LL | | }
| |_____- `match` arms have incompatible types
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/match/issue-70972-dyn-trait.stderr b/tests/ui/match/issue-70972-dyn-trait.stderr
index f4dc910c3..b0af50f85 100644
--- a/tests/ui/match/issue-70972-dyn-trait.stderr
+++ b/tests/ui/match/issue-70972-dyn-trait.stderr
@@ -4,5 +4,5 @@ error: `dyn Send` cannot be used in patterns
LL | F => panic!(),
| ^
-error: aborting due to previous error
+error: aborting due to 1 previous error
diff --git a/tests/ui/match/issue-74050-end-span.stderr b/tests/ui/match/issue-74050-end-span.stderr
index 0dafeae87..3a311eb00 100644
--- a/tests/ui/match/issue-74050-end-span.stderr
+++ b/tests/ui/match/issue-74050-end-span.stderr
@@ -11,6 +11,6 @@ LL | match arg.to_str() {
LL | }
| - `arg` dropped here while still borrowed
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0597`.
diff --git a/tests/ui/match/issue-91058.stderr b/tests/ui/match/issue-91058.stderr
index 12f37274b..e91063de8 100644
--- a/tests/ui/match/issue-91058.stderr
+++ b/tests/ui/match/issue-91058.stderr
@@ -6,6 +6,6 @@ LL | match array {
LL | [()] => {}
| ^^ expected `S`, found `()`
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/match/issue-92100.stderr b/tests/ui/match/issue-92100.stderr
index 0f694c587..eb9f4ba1a 100644
--- a/tests/ui/match/issue-92100.stderr
+++ b/tests/ui/match/issue-92100.stderr
@@ -3,7 +3,12 @@ error[E0425]: cannot find value `a` in this scope
|
LL | [a.., a] => {}
| ^ not found in this scope
+ |
+help: if you meant to collect the rest of the slice in `a`, use the at operator
+ |
+LL | [a @ .., a] => {}
+ | +
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/match/match-arm-resolving-to-never.stderr b/tests/ui/match/match-arm-resolving-to-never.stderr
index 686fbd0ba..6cbdf03d4 100644
--- a/tests/ui/match/match-arm-resolving-to-never.stderr
+++ b/tests/ui/match/match-arm-resolving-to-never.stderr
@@ -13,6 +13,6 @@ LL | | E::F => "",
LL | | };
| |_____- `match` arms have incompatible types
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/match/match-ill-type2.stderr b/tests/ui/match/match-ill-type2.stderr
index 5078f03d6..9d6bb5d1d 100644
--- a/tests/ui/match/match-ill-type2.stderr
+++ b/tests/ui/match/match-ill-type2.stderr
@@ -7,6 +7,6 @@ LL | 1i32 => 1,
LL | 2u32 => 1,
| ^^^^ expected `i32`, found `u32`
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/match/match-join.stderr b/tests/ui/match/match-join.stderr
index 27a82c124..4feb1bef9 100644
--- a/tests/ui/match/match-join.stderr
+++ b/tests/ui/match/match-join.stderr
@@ -4,6 +4,6 @@ error[E0425]: cannot find value `x` in this scope
LL | println!("{}", x);
| ^ not found in this scope
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/match/match-no-arms-unreachable-after.stderr b/tests/ui/match/match-no-arms-unreachable-after.stderr
index a0a369726..65ac1bae3 100644
--- a/tests/ui/match/match-no-arms-unreachable-after.stderr
+++ b/tests/ui/match/match-no-arms-unreachable-after.stderr
@@ -12,5 +12,5 @@ note: the lint level is defined here
LL | #![deny(unreachable_code)]
| ^^^^^^^^^^^^^^^^
-error: aborting due to previous error
+error: aborting due to 1 previous error
diff --git a/tests/ui/match/match-pattern-field-mismatch-2.stderr b/tests/ui/match/match-pattern-field-mismatch-2.stderr
index ba32d0e99..12b143dd2 100644
--- a/tests/ui/match/match-pattern-field-mismatch-2.stderr
+++ b/tests/ui/match/match-pattern-field-mismatch-2.stderr
@@ -7,6 +7,6 @@ LL | NoColor,
LL | Color::NoColor(_) => { }
| ^^^^^^^^^^^^^^^^^ help: use this syntax instead: `Color::NoColor`
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0532`.
diff --git a/tests/ui/match/match-pattern-field-mismatch.stderr b/tests/ui/match/match-pattern-field-mismatch.stderr
index c994ee4f6..cde7ac972 100644
--- a/tests/ui/match/match-pattern-field-mismatch.stderr
+++ b/tests/ui/match/match-pattern-field-mismatch.stderr
@@ -16,6 +16,6 @@ help: use `..` to ignore all fields
LL | Color::Rgb(..) => { }
| ~~
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0023`.
diff --git a/tests/ui/match/match-ref-mut-invariance.stderr b/tests/ui/match/match-ref-mut-invariance.stderr
index b353d3514..b9878a195 100644
--- a/tests/ui/match/match-ref-mut-invariance.stderr
+++ b/tests/ui/match/match-ref-mut-invariance.stderr
@@ -13,5 +13,5 @@ LL | match self.0 { ref mut x => x }
= note: mutable references are invariant over their type parameter
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
-error: aborting due to previous error
+error: aborting due to 1 previous error
diff --git a/tests/ui/match/match-ref-mut-let-invariance.stderr b/tests/ui/match/match-ref-mut-let-invariance.stderr
index bb0fcdb99..27968239a 100644
--- a/tests/ui/match/match-ref-mut-let-invariance.stderr
+++ b/tests/ui/match/match-ref-mut-let-invariance.stderr
@@ -14,5 +14,5 @@ LL | x
= note: mutable references are invariant over their type parameter
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
-error: aborting due to previous error
+error: aborting due to 1 previous error
diff --git a/tests/ui/match/match-struct.stderr b/tests/ui/match/match-struct.stderr
index fdc6fd770..b8abeab15 100644
--- a/tests/ui/match/match-struct.stderr
+++ b/tests/ui/match/match-struct.stderr
@@ -6,6 +6,6 @@ LL | match (S { a: 1 }) {
LL | E::C(_) => (),
| ^^^^^^^ expected `S`, found `E`
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/match/match-tag-nullary.stderr b/tests/ui/match/match-tag-nullary.stderr
index aac873c76..c9446d164 100644
--- a/tests/ui/match/match-tag-nullary.stderr
+++ b/tests/ui/match/match-tag-nullary.stderr
@@ -9,6 +9,6 @@ LL | fn main() { let x: A = A::A; match x { B::B => { } } }
| |
| this expression has type `A`
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/match/match-tag-unary.stderr b/tests/ui/match/match-tag-unary.stderr
index 25e8152d8..fb4ec2664 100644
--- a/tests/ui/match/match-tag-unary.stderr
+++ b/tests/ui/match/match-tag-unary.stderr
@@ -6,6 +6,6 @@ LL | fn main() { let x: A = A::A(0); match x { B::B(y) => { } } }
| |
| this expression has type `A`
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/match/match-tail-expr-never-type-error.rs b/tests/ui/match/match-tail-expr-never-type-error.rs
new file mode 100644
index 000000000..786ed3fa9
--- /dev/null
+++ b/tests/ui/match/match-tail-expr-never-type-error.rs
@@ -0,0 +1,16 @@
+fn never() -> ! {
+ loop {}
+}
+
+fn bar(a: bool) {
+ match a {
+ true => 1,
+ false => {
+ never() //~ ERROR `match` arms have incompatible types
+ }
+ }
+}
+fn main() {
+ bar(true);
+ bar(false);
+}
diff --git a/tests/ui/match/match-tail-expr-never-type-error.stderr b/tests/ui/match/match-tail-expr-never-type-error.stderr
new file mode 100644
index 000000000..226d33dae
--- /dev/null
+++ b/tests/ui/match/match-tail-expr-never-type-error.stderr
@@ -0,0 +1,21 @@
+error[E0308]: `match` arms have incompatible types
+ --> $DIR/match-tail-expr-never-type-error.rs:9:13
+ |
+LL | fn bar(a: bool) {
+ | - help: try adding a return type: `-> i32`
+LL | / match a {
+LL | | true => 1,
+ | | - this is found to be of type `{integer}`
+LL | | false => {
+LL | | never()
+ | | ^^^^^^^
+ | | |
+ | | expected integer, found `()`
+ | | this expression is of type `!`, but it is coerced to `()` due to its surrounding expression
+LL | | }
+LL | | }
+ | |_____- `match` arms have incompatible types
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/match/match-unresolved-one-arm.stderr b/tests/ui/match/match-unresolved-one-arm.stderr
index e3b501b2f..44571ac53 100644
--- a/tests/ui/match/match-unresolved-one-arm.stderr
+++ b/tests/ui/match/match-unresolved-one-arm.stderr
@@ -9,6 +9,6 @@ help: consider giving `x` an explicit type
LL | let x: /* Type */ = match () {
| ++++++++++++
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0282`.
diff --git a/tests/ui/match/match-vec-mismatch-2.stderr b/tests/ui/match/match-vec-mismatch-2.stderr
index 5247bea62..bdfe063d5 100644
--- a/tests/ui/match/match-vec-mismatch-2.stderr
+++ b/tests/ui/match/match-vec-mismatch-2.stderr
@@ -4,6 +4,6 @@ error[E0529]: expected an array or slice, found `()`
LL | [()] => { }
| ^^^^ pattern cannot match with input type `()`
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0529`.
diff --git a/tests/ui/match/non-first-arm-doesnt-match-expected-return-type.stderr b/tests/ui/match/non-first-arm-doesnt-match-expected-return-type.stderr
index e6d93b8b5..5a6c9dff7 100644
--- a/tests/ui/match/non-first-arm-doesnt-match-expected-return-type.stderr
+++ b/tests/ui/match/non-first-arm-doesnt-match-expected-return-type.stderr
@@ -7,6 +7,6 @@ LL | fn test(shouldwe: Option<u32>, shouldwe2: Option<u32>) -> u32 {
LL | None => (),
| ^^ expected `u32`, found `()`
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/match/single-line.stderr b/tests/ui/match/single-line.stderr
index ec3b76e3f..15dc672c1 100644
--- a/tests/ui/match/single-line.stderr
+++ b/tests/ui/match/single-line.stderr
@@ -7,6 +7,6 @@ LL | let _ = match Some(42) { Some(x) => x, None => "" };
| | this is found to be of type `{integer}`
| `match` arms have incompatible types
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.