]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-39808.rs
Merge commit 'dbee13661efa269cb4cd57bb4c6b99a19732b484' into sync_cg_clif-2020-12-27
[rust.git] / src / test / ui / issues / issue-39808.rs
1 // run-pass
2 #![allow(unreachable_code)]
3
4 // Regression test for #39808. The type parameter of `Owned` was
5 // considered to be "unconstrained" because the type resulting from
6 // `format!` (`String`) was not being propagated upward, owing to the
7 // fact that the expression diverges.
8
9 use std::borrow::Cow;
10
11 fn main() {
12     let _ = if false {
13         Cow::Owned(format!("{:?}", panic!()))
14     } else {
15         Cow::Borrowed("")
16     };
17 }