]> git.lizzy.rs Git - rust.git/commitdiff
Add test case for #47287
authorEsteban Küber <esteban@kuber.com.ar>
Mon, 29 Apr 2019 21:35:09 +0000 (14:35 -0700)
committerEsteban Küber <esteban@kuber.com.ar>
Mon, 29 Apr 2019 21:35:09 +0000 (14:35 -0700)
src/test/ui/parser/expr-as-stmt.fixed
src/test/ui/parser/expr-as-stmt.rs
src/test/ui/parser/expr-as-stmt.stderr

index a0abd00a15c2afb2bd379f33612a7e397238f892..123f06e7707e0f14e91f840a147419791d00a747 100644 (file)
@@ -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() {}
index cf2e7266a4aaceca67c27808bceec0f430220ee9..6f713c08940018962f465ff9bbb1b61a6adec127 100644 (file)
@@ -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() {}
index 031196054327757554ae70429a06d5e3aa9eacc4..be577b8f36fe69de85e88d3a488e1d4f53955818 100644 (file)
@@ -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`.