diff options
| -rw-r--r-- | src/test/ui/parser/expr-as-stmt.fixed | 6 | ||||
| -rw-r--r-- | src/test/ui/parser/expr-as-stmt.rs | 6 | ||||
| -rw-r--r-- | src/test/ui/parser/expr-as-stmt.stderr | 14 |
3 files changed, 25 insertions, 1 deletions
diff --git a/src/test/ui/parser/expr-as-stmt.fixed b/src/test/ui/parser/expr-as-stmt.fixed index a0abd00a15c..123f06e7707 100644 --- a/src/test/ui/parser/expr-as-stmt.fixed +++ b/src/test/ui/parser/expr-as-stmt.fixed @@ -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() {} diff --git a/src/test/ui/parser/expr-as-stmt.rs b/src/test/ui/parser/expr-as-stmt.rs index cf2e7266a4a..6f713c08940 100644 --- a/src/test/ui/parser/expr-as-stmt.rs +++ b/src/test/ui/parser/expr-as-stmt.rs @@ -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() {} diff --git a/src/test/ui/parser/expr-as-stmt.stderr b/src/test/ui/parser/expr-as-stmt.stderr index 03119605432..be577b8f36f 100644 --- a/src/test/ui/parser/expr-as-stmt.stderr +++ b/src/test/ui/parser/expr-as-stmt.stderr @@ -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 | @@ -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`. |
