Rollup merge of #48338 - estebank:match-missing-comma, r=petrochenkov

Fixes #47311.
r? @nrc
This commit is contained in:
Manish Goregaokar 2018-03-02 22:01:23 -08:00
commit 8c7c8fb212
No known key found for this signature in database
GPG key ID: 3BBF4D3E2EF79F98
11 changed files with 189 additions and 37 deletions

View file

@ -2,7 +2,7 @@ error: expected expression, found `_`
--> $DIR/underscore.rs:18:9
|
LL | _
| ^
| ^ expected expression
|
::: $DIR/main.rs:15:5
|

View file

@ -19,7 +19,7 @@ error: expected `[`, found `#`
--> $DIR/issue-40006.rs:20:17
|
LL | fn xxx() { ### } //~ ERROR missing
| ^
| ^ expected `[`
error: missing `fn`, `type`, or `const` for trait-item declaration
--> $DIR/issue-40006.rs:20:21

View file

@ -0,0 +1,18 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn main() {
let n = 1;
if 5 == {
//~^ NOTE this `if` statement has a condition, but no block
println!("five");
}
}
//~^ ERROR expected `{`, found `}`

View file

@ -0,0 +1,11 @@
error: expected `{`, found `}`
--> $DIR/if-without-block.rs:17:1
|
LL | if 5 == {
| -- this `if` statement has a condition, but no block
...
LL | }
| ^
error: aborting due to previous error

View file

@ -38,7 +38,7 @@ error: expected expression, found reserved keyword `typeof`
--> $DIR/macro-context.rs:13:17
|
LL | () => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof`
| ^^^^^^
| ^^^^^^ expected expression
...
LL | m!();
| ----- in this macro invocation

View file

@ -2,11 +2,15 @@ error: expected `{`, found `=>`
--> $DIR/missing-block-hint.rs:13:18
|
LL | if (foo) => {} //~ ERROR expected `{`, found `=>`
| ^^
| -- ^^
| |
| this `if` statement has a condition, but no block
error: expected `{`, found `bar`
--> $DIR/missing-block-hint.rs:17:13
|
LL | if (foo)
| -- this `if` statement has a condition, but no block
LL | bar; //~ ERROR expected `{`, found `bar`
| ^^^-
| |

View file

@ -26,7 +26,7 @@ error: expected expression, found `;`
--> $DIR/token-error-correct.rs:14:13
|
LL | foo(bar(;
| ^
| ^ expected expression
error: aborting due to 3 previous errors

View file

@ -0,0 +1,19 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn main() {
match &Some(3) {
&None => 1
&Some(2) => { 3 }
//~^ ERROR expected one of `,`, `.`, `?`, `}`, or an operator, found `=>`
//~| NOTE expected one of `,`, `.`, `?`, `}`, or an operator here
_ => 2
};
}

View file

@ -0,0 +1,10 @@
error: expected one of `,`, `.`, `?`, `}`, or an operator, found `=>`
--> $DIR/missing-comma-in-match.rs:14:18
|
LL | &None => 1
| - help: missing a comma here to end this `match` arm
LL | &Some(2) => { 3 }
| ^^ expected one of `,`, `.`, `?`, `}`, or an operator here
error: aborting due to previous error

View file

@ -20,7 +20,7 @@ error: expected expression, found `)`
--> $DIR/issue-10636-2.rs:18:1
|
LL | } //~ ERROR: incorrect close delimiter
| ^
| ^ expected expression
error[E0601]: main function not found