Skip to content

Commit

Permalink
Add test case for #47287
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Apr 29, 2019
1 parent f007e6f commit bff0be3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/test/ui/parser/expr-as-stmt.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,10 @@ fn qux(a: Option<u32>, b: Option<u32>) -> bool {
if let Some(y) = a { true } else { false }
}

fn moo(x: u32) -> bool {
(match x {
_ => 1,
}) > 0 //~ ERROR ambiguous parse
}

fn main() {}
6 changes: 6 additions & 0 deletions src/test/ui/parser/expr-as-stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,10 @@ fn qux(a: Option<u32>, b: Option<u32>) -> bool {
if let Some(y) = a { true } else { false }
}

fn moo(x: u32) -> bool {
match x {
_ => 1,
} > 0 //~ ERROR ambiguous parse
}

fn main() {}
14 changes: 13 additions & 1 deletion src/test/ui/parser/expr-as-stmt.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ LL | if let Some(x) = a { true } else { false }
LL | &&
| ^^

error: ambiguous parse
--> $DIR/expr-as-stmt.rs:37:7
|
LL | } > 0
| ^
help: parenthesis are required to parse this as an expression
|
LL | (match x {
LL | _ => 1,
LL | }) > 0
|

error[E0308]: mismatched types
--> $DIR/expr-as-stmt.rs:7:6
|
Expand Down Expand Up @@ -74,7 +86,7 @@ LL | { 3 } * 3
| |
| help: parenthesis are required to parse this as an expression: `({ 3 })`

error: aborting due to 9 previous errors
error: aborting due to 10 previous errors

Some errors have detailed explanations: E0308, E0614.
For more information about an error, try `rustc --explain E0308`.

0 comments on commit bff0be3

Please sign in to comment.