forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Address comments re. off-topic errors.
- Loading branch information
Showing
6 changed files
with
48 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,28 @@ | ||
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; | ||
| ^^ | ||
| | ||
= 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`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |