From 0f1eb8a70f0f877eba4b55151949df8861377c65 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Sat, 18 Mar 2017 12:28:34 -0400 Subject: [PATCH] add regression test for #39984 Fixes #39984 --- src/test/run-pass/issue-39984.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/test/run-pass/issue-39984.rs diff --git a/src/test/run-pass/issue-39984.rs b/src/test/run-pass/issue-39984.rs new file mode 100644 index 0000000000000..a0019e7215c98 --- /dev/null +++ b/src/test/run-pass/issue-39984.rs @@ -0,0 +1,21 @@ +// Copyright 2016 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. + +// Regression test for issue #39984. +// +// The key here is that the error type of the `Ok` call ought to be +// constrained to `String`, even though it is dead-code. + +fn main() {} + +fn t() -> Result<(), String> { + return Err("".into()); + Ok(()) +}