2018-08-30 12:18:55 +00:00
|
|
|
//@ run-pass
|
2017-03-18 19:22:48 +00:00
|
|
|
#![allow(unreachable_code)]
|
|
|
|
|
|
|
|
// Regression test for #39808. The type parameter of `Owned` was
|
|
|
|
// considered to be "unconstrained" because the type resulting from
|
|
|
|
// `format!` (`String`) was not being propagated upward, owing to the
|
|
|
|
// fact that the expression diverges.
|
|
|
|
|
|
|
|
use std::borrow::Cow;
|
2017-03-03 02:15:26 +00:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let _ = if false {
|
2017-03-27 23:48:55 +00:00
|
|
|
Cow::Owned(format!("{:?}", panic!()))
|
2017-03-03 02:15:26 +00:00
|
|
|
} else {
|
2017-03-18 19:22:48 +00:00
|
|
|
Cow::Borrowed("")
|
2017-03-03 02:15:26 +00:00
|
|
|
};
|
|
|
|
}
|