]> git.lizzy.rs Git - rust.git/commitdiff
Address comments re. off-topic errors.
authorMazdak Farrokhzad <twingoow@gmail.com>
Wed, 24 Jul 2019 00:30:37 +0000 (02:30 +0200)
committerMazdak Farrokhzad <twingoow@gmail.com>
Sun, 28 Jul 2019 04:53:39 +0000 (06:53 +0200)
src/test/ui/parser/match-vec-invalid.rs
src/test/ui/parser/match-vec-invalid.stderr
src/test/ui/parser/pat-lt-bracket-6.rs
src/test/ui/parser/pat-lt-bracket-6.stderr
src/test/ui/parser/pat-lt-bracket-7.rs
src/test/ui/parser/pat-lt-bracket-7.stderr

index d14fdc4e22e318930021eb25a052ec976a1a0148..00f4374b256d20a115f312bb480cdc6ea5a773d7 100644 (file)
@@ -1,12 +1,13 @@
 fn main() {
-    let a = Vec::new();
+    let a: &[u8] = &[];
     match a {
         [1, tail @ .., tail @ ..] => {},
         //~^ ERROR identifier `tail` is bound more than once in the same pattern
         //~| ERROR subslice patterns are unstable
         //~| ERROR subslice patterns are unstable
         //~| ERROR `..` can only be used once per slice pattern
-        //~| ERROR expected an array or slice, found `std::vec::Vec<_>`
         _ => ()
     }
 }
+
+const RECOVERY_WITNESS: () = 0; //~ ERROR mismatched types
index 49d5a83c5a9f96d02f25784304c69c3f0be8d615..0956ac21b7f1e4abecf968a5a21b62a681f5c7dd 100644 (file)
@@ -30,13 +30,16 @@ LL |         [1, tail @ .., tail @ ..] => {},
    |                    |
    |                    previously used here
 
-error[E0529]: expected an array or slice, found `std::vec::Vec<_>`
-  --> $DIR/match-vec-invalid.rs:4:9
+error[E0308]: mismatched types
+  --> $DIR/match-vec-invalid.rs:13:30
    |
-LL |         [1, tail @ .., tail @ ..] => {},
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^ pattern cannot match with input type `std::vec::Vec<_>`
+LL | const RECOVERY_WITNESS: () = 0;
+   |                              ^ expected (), found integer
+   |
+   = note: expected type `()`
+              found type `{integer}`
 
 error: aborting due to 5 previous errors
 
-Some errors have detailed explanations: E0416, E0529, E0658.
-For more information about an error, try `rustc --explain E0416`.
+Some errors have detailed explanations: E0308, E0416, E0658.
+For more information about an error, try `rustc --explain E0308`.
index 69c4bfb23c2f911570415eae05dc2852f20e81e8..7b9721830993efc2fc1a70f9b299ea86c39bc2cc 100644 (file)
@@ -1,6 +1,9 @@
 fn main() {
+    struct Test(&'static u8, [u8; 0]);
+    let x = Test(&0, []);
+
     let Test(&desc[..]) = x; //~ ERROR: expected one of `)`, `,`, or `@`, found `[`
-    //~^ ERROR cannot find value `x` in this scope
-    //~| ERROR cannot find tuple struct/variant `Test` in this scope
-    //~| ERROR subslice patterns are unstable
+    //~^ ERROR subslice patterns are unstable
 }
+
+const RECOVERY_WITNESS: () = 0; //~ ERROR mismatched types
index 45270b314a9b7dfa506011f31f6511e13f47d251..201465b2c850c87f13720db143d85e6419b78dc4 100644 (file)
@@ -1,23 +1,11 @@
 error: expected one of `)`, `,`, or `@`, found `[`
-  --> $DIR/pat-lt-bracket-6.rs:2:19
+  --> $DIR/pat-lt-bracket-6.rs:5:19
    |
 LL |     let Test(&desc[..]) = x;
    |                   ^ expected one of `)`, `,`, or `@` here
 
-error[E0425]: cannot find value `x` in this scope
-  --> $DIR/pat-lt-bracket-6.rs:2:27
-   |
-LL |     let Test(&desc[..]) = x;
-   |                           ^ not found in this scope
-
-error[E0531]: cannot find tuple struct/variant `Test` in this scope
-  --> $DIR/pat-lt-bracket-6.rs:2:9
-   |
-LL |     let Test(&desc[..]) = x;
-   |         ^^^^ not found in this scope
-
 error[E0658]: subslice patterns are unstable
-  --> $DIR/pat-lt-bracket-6.rs:2:20
+  --> $DIR/pat-lt-bracket-6.rs:5:20
    |
 LL |     let Test(&desc[..]) = x;
    |                    ^^
@@ -25,7 +13,16 @@ LL |     let Test(&desc[..]) = x;
    = note: for more information, see https://github.com/rust-lang/rust/issues/62254
    = help: add `#![feature(slice_patterns)]` to the crate attributes to enable
 
-error: aborting due to 4 previous errors
+error[E0308]: mismatched types
+  --> $DIR/pat-lt-bracket-6.rs:9:30
+   |
+LL | const RECOVERY_WITNESS: () = 0;
+   |                              ^ expected (), found integer
+   |
+   = note: expected type `()`
+              found type `{integer}`
+
+error: aborting due to 3 previous errors
 
-Some errors have detailed explanations: E0425, E0658.
-For more information about an error, try `rustc --explain E0425`.
+Some errors have detailed explanations: E0308, E0658.
+For more information about an error, try `rustc --explain E0308`.
index 1060d705e6e3126d72fb2f4c46974885c49dd5a3..020fdb845e8b5fd4ca73f041532fb0d6cb4dbe3d 100644 (file)
@@ -1,5 +1,8 @@
 fn main() {
-    for thing(x[]) in foo {} //~ ERROR: expected one of `)`, `,`, or `@`, found `[`
-    //~^ ERROR cannot find value `foo` in this scope
-    //~| ERROR cannot find tuple struct/variant `thing` in this scope
+    struct Thing(u8, [u8; 0]);
+    let foo = core::iter::empty();
+
+    for Thing(x[]) in foo {} //~ ERROR: expected one of `)`, `,`, or `@`, found `[`
 }
+
+const RECOVERY_WITNESS: () = 0; //~ ERROR mismatched types
index 3e4bff7cbd759cad0011773033f9eee4a0882734..17557efa49e803e70c1369448fc0a183d3c3aaf6 100644 (file)
@@ -1,21 +1,18 @@
 error: expected one of `)`, `,`, or `@`, found `[`
-  --> $DIR/pat-lt-bracket-7.rs:2:16
+  --> $DIR/pat-lt-bracket-7.rs:5:16
    |
-LL |     for thing(x[]) in foo {}
+LL |     for Thing(x[]) in foo {}
    |                ^ expected one of `)`, `,`, or `@` here
 
-error[E0425]: cannot find value `foo` in this scope
-  --> $DIR/pat-lt-bracket-7.rs:2:23
+error[E0308]: mismatched types
+  --> $DIR/pat-lt-bracket-7.rs:8:30
    |
-LL |     for thing(x[]) in foo {}
-   |                       ^^^ not found in this scope
-
-error[E0531]: cannot find tuple struct/variant `thing` in this scope
-  --> $DIR/pat-lt-bracket-7.rs:2:9
+LL | const RECOVERY_WITNESS: () = 0;
+   |                              ^ expected (), found integer
    |
-LL |     for thing(x[]) in foo {}
-   |         ^^^^^ not found in this scope
+   = note: expected type `()`
+              found type `{integer}`
 
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0425`.
+For more information about this error, try `rustc --explain E0308`.