diff options
Diffstat (limited to 'tests/ui/issues/issue-39984.rs')
-rw-r--r-- | tests/ui/issues/issue-39984.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/ui/issues/issue-39984.rs b/tests/ui/issues/issue-39984.rs new file mode 100644 index 000000000..1c9ae26ca --- /dev/null +++ b/tests/ui/issues/issue-39984.rs @@ -0,0 +1,14 @@ +// check-pass +#![allow(dead_code)] +#![allow(unreachable_code)] +// 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(()) +} |