From c37e13d3933d9bf278458b3bd8487785c72434e2 Mon Sep 17 00:00:00 2001 From: Richo Healey Date: Mon, 5 May 2014 20:42:50 -0700 Subject: [PATCH] Add failing testcase for confusing Option with Result --- src/test/compile-fail/incompatible-tuple.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/test/compile-fail/incompatible-tuple.rs diff --git a/src/test/compile-fail/incompatible-tuple.rs b/src/test/compile-fail/incompatible-tuple.rs new file mode 100644 index 0000000000000..66769ca0f38c2 --- /dev/null +++ b/src/test/compile-fail/incompatible-tuple.rs @@ -0,0 +1,17 @@ +// Copyright 2014 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + let e: Result = Ok(42); + match e { + Some(x) => x.unwrap(), //~ ERROR: mismatched types + Err(y) => {} + } +}