about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMaxim Zholobak <ghostcheka@gmail.com>2017-11-15 09:20:09 +0200
committerMaxim Zholobak <ghostcheka@gmail.com>2017-11-15 09:20:09 +0200
commit08c81c1a797322c68479263f5600eed8c6c2aabe (patch)
tree3a1293340de124e96a8723eb55ed8797e0f9d5ea
parent21c580e4c4c9e6f2772fddf8d5ad7824696f7fc8 (diff)
downloadrust-08c81c1a797322c68479263f5600eed8c6c2aabe.tar.gz
rust-08c81c1a797322c68479263f5600eed8c6c2aabe.zip
Add failing testcases
-rw-r--r--src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.rs19
-rw-r--r--src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr21
2 files changed, 40 insertions, 0 deletions
diff --git a/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.rs b/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.rs
new file mode 100644
index 00000000000..22c5e04419a
--- /dev/null
+++ b/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.rs
@@ -0,0 +1,19 @@
+// Copyright 2017 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 result_test() {
+    let x = Option(1);
+
+    if let Option(_) = x {
+        println!("It is OK.");
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr b/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr
new file mode 100644
index 00000000000..4882cb10df6
--- /dev/null
+++ b/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr
@@ -0,0 +1,21 @@
+error[E0423]: expected function, found enum `Option`
+  --> $DIR/issue-43871-enum-instead-of-variant.rs:12:13
+   |
+12 |     let x = Option(1);
+   |             ^^^^^^ not a function
+   = note: did you mean to use one of the following variants?
+           - `std::prelude::v1::Option::None`
+           - `std::prelude::v1::Option::Some`
+
+error[E0532]: expected tuple struct/variant, found enum `Option`
+  --> $DIR/issue-43871-enum-instead-of-variant.rs:14:12
+   |
+14 |     if let Option(_) = x {
+   |            ^^^^^^
+   |
+   = note: did you mean to use one of the following variants?
+           - `std::prelude::v1::Option::None`
+           - `std::prelude::v1::Option::Some`
+
+error: aborting due to previous error
+