about summary refs log tree commit diff
path: root/tests/ui/array-slice-vec
diff options
context:
space:
mode:
authorb-naber <b_naber@gmx.de>2023-06-21 18:01:31 +0000
committerb-naber <b_naber@gmx.de>2023-07-17 22:00:43 +0000
commite18e3761ced3695e9d7a920b223a49767dd4f1f6 (patch)
tree69c69c631a3f34b290a48c3122e98d7f30b5f8d4 /tests/ui/array-slice-vec
parent2827aa975257d03f21c75fa27a594079a9da31ba (diff)
downloadrust-e18e3761ced3695e9d7a920b223a49767dd4f1f6.tar.gz
rust-e18e3761ced3695e9d7a920b223a49767dd4f1f6.zip
add test, bless tests
Diffstat (limited to 'tests/ui/array-slice-vec')
-rw-r--r--tests/ui/array-slice-vec/infer_array_len.rs4
-rw-r--r--tests/ui/array-slice-vec/infer_array_len.stderr14
-rw-r--r--tests/ui/array-slice-vec/slice-pat-type-mismatches.rs14
-rw-r--r--tests/ui/array-slice-vec/slice-pat-type-mismatches.stderr18
4 files changed, 18 insertions, 32 deletions
diff --git a/tests/ui/array-slice-vec/infer_array_len.rs b/tests/ui/array-slice-vec/infer_array_len.rs
index 22fe7cb8838..547c1f5727f 100644
--- a/tests/ui/array-slice-vec/infer_array_len.rs
+++ b/tests/ui/array-slice-vec/infer_array_len.rs
@@ -1,4 +1,4 @@
-// see issue #70529
+// check-pass
 struct A;
 
 impl From<A> for [u8; 2] {
@@ -13,9 +13,7 @@ impl From<A> for [u8; 3] {
     }
 }
 
-
 fn main() {
     let a = A;
     let [_, _] = a.into();
-    //~^ ERROR type annotations needed
 }
diff --git a/tests/ui/array-slice-vec/infer_array_len.stderr b/tests/ui/array-slice-vec/infer_array_len.stderr
deleted file mode 100644
index c2a509a1963..00000000000
--- a/tests/ui/array-slice-vec/infer_array_len.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0282]: type annotations needed
-  --> $DIR/infer_array_len.rs:19:9
-   |
-LL |     let [_, _] = a.into();
-   |         ^^^^^^
-   |
-help: consider giving this pattern a type
-   |
-LL |     let [_, _]: /* Type */ = a.into();
-   |               ++++++++++++
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0282`.
diff --git a/tests/ui/array-slice-vec/slice-pat-type-mismatches.rs b/tests/ui/array-slice-vec/slice-pat-type-mismatches.rs
index 521b898e7fe..310c49701ed 100644
--- a/tests/ui/array-slice-vec/slice-pat-type-mismatches.rs
+++ b/tests/ui/array-slice-vec/slice-pat-type-mismatches.rs
@@ -2,7 +2,7 @@ fn main() {
     match "foo".to_string() {
         ['f', 'o', ..] => {}
         //~^ ERROR expected an array or slice, found `String`
-        _ => { }
+        _ => {}
     };
 
     // Note that this one works with default binding modes.
@@ -15,7 +15,7 @@ fn main() {
     };
 
     match [0, 1, 2] {
-        [0] => {}, //~ ERROR pattern requires
+        [0] => {} //~ ERROR pattern requires
 
         [0, 1, x @ ..] => {
             let a: [_; 1] = x;
@@ -23,14 +23,16 @@ fn main() {
         [0, 1, 2, 3, x @ ..] => {} //~ ERROR pattern requires
     };
 
-    match does_not_exist { //~ ERROR cannot find value `does_not_exist` in this scope
-        [] => {}
+    match does_not_exist {
+        //~^ ERROR cannot find value `does_not_exist` in this scope
+        [] => {} // ERROR cannot find value `does_not_exist` in this scope
     };
 }
 
 fn another_fn_to_avoid_suppression() {
-    match Default::default()
+    match Default
+    //~^ ERROR expected value, found trait
     {
-        [] => {}  //~ ERROR type annotations needed
+        [] => {}
     };
 }
diff --git a/tests/ui/array-slice-vec/slice-pat-type-mismatches.stderr b/tests/ui/array-slice-vec/slice-pat-type-mismatches.stderr
index 70a4cbebeee..6218bffd503 100644
--- a/tests/ui/array-slice-vec/slice-pat-type-mismatches.stderr
+++ b/tests/ui/array-slice-vec/slice-pat-type-mismatches.stderr
@@ -4,6 +4,12 @@ error[E0425]: cannot find value `does_not_exist` in this scope
 LL |     match does_not_exist {
    |           ^^^^^^^^^^^^^^ not found in this scope
 
+error[E0423]: expected value, found trait `Default`
+  --> $DIR/slice-pat-type-mismatches.rs:33:11
+   |
+LL |     match Default
+   |           ^^^^^^^ not a value
+
 error[E0529]: expected an array or slice, found `String`
   --> $DIR/slice-pat-type-mismatches.rs:3:9
    |
@@ -13,7 +19,7 @@ LL |         ['f', 'o', ..] => {}
 error[E0527]: pattern requires 1 element but array has 3
   --> $DIR/slice-pat-type-mismatches.rs:18:9
    |
-LL |         [0] => {},
+LL |         [0] => {}
    |         ^^^ expected 3 elements
 
 error[E0528]: pattern requires at least 4 elements but array has 3
@@ -22,13 +28,7 @@ error[E0528]: pattern requires at least 4 elements but array has 3
 LL |         [0, 1, 2, 3, x @ ..] => {}
    |         ^^^^^^^^^^^^^^^^^^^^ pattern cannot match array of 3 elements
 
-error[E0282]: type annotations needed
-  --> $DIR/slice-pat-type-mismatches.rs:34:9
-   |
-LL |         [] => {}
-   |         ^^ cannot infer type
-
 error: aborting due to 5 previous errors
 
-Some errors have detailed explanations: E0282, E0425, E0527, E0528, E0529.
-For more information about an error, try `rustc --explain E0282`.
+Some errors have detailed explanations: E0423, E0425, E0527, E0528, E0529.
+For more information about an error, try `rustc --explain E0423`.