2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2017-03-18 14:22:48 -05: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-02 20:15:26 -06:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let _ = if false {
|
2017-03-27 18:48:55 -05:00
|
|
|
Cow::Owned(format!("{:?}", panic!()))
|
2017-03-02 20:15:26 -06:00
|
|
|
} else {
|
2017-03-18 14:22:48 -05:00
|
|
|
Cow::Borrowed("")
|
2017-03-02 20:15:26 -06:00
|
|
|
};
|
|
|
|
}
|