summaryrefslogtreecommitdiffstats
path: root/src/test/ui/match
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/match')
-rw-r--r--src/test/ui/match/issue-12552.rs11
-rw-r--r--src/test/ui/match/issue-12552.stderr34
2 files changed, 45 insertions, 0 deletions
diff --git a/src/test/ui/match/issue-12552.rs b/src/test/ui/match/issue-12552.rs
new file mode 100644
index 000000000..b7f71dd1c
--- /dev/null
+++ b/src/test/ui/match/issue-12552.rs
@@ -0,0 +1,11 @@
+// this code used to cause an ICE
+
+fn main() {
+ let t = Err(0);
+ match t {
+ Some(k) => match k { //~ ERROR mismatched types
+ a => println!("{}", a)
+ },
+ None => () //~ ERROR mismatched types
+ }
+}
diff --git a/src/test/ui/match/issue-12552.stderr b/src/test/ui/match/issue-12552.stderr
new file mode 100644
index 000000000..4b027eba2
--- /dev/null
+++ b/src/test/ui/match/issue-12552.stderr
@@ -0,0 +1,34 @@
+error[E0308]: mismatched types
+ --> $DIR/issue-12552.rs:6:5
+ |
+LL | match t {
+ | - this expression has type `Result<_, {integer}>`
+LL | Some(k) => match k {
+ | ^^^^^^^ expected enum `Result`, found enum `Option`
+ |
+ = note: expected enum `Result<_, {integer}>`
+ found enum `Option<_>`
+help: try wrapping the pattern in `Ok`
+ |
+LL | Ok(Some(k)) => match k {
+ | +++ +
+
+error[E0308]: mismatched types
+ --> $DIR/issue-12552.rs:9:5
+ |
+LL | match t {
+ | - this expression has type `Result<_, {integer}>`
+...
+LL | None => ()
+ | ^^^^ expected enum `Result`, found enum `Option`
+ |
+ = note: expected enum `Result<_, {integer}>`
+ found enum `Option<_>`
+help: try wrapping the pattern in `Ok`
+ |
+LL | Ok(None) => ()
+ | +++ +
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.