2017-03-02 20:15:26 -06:00
|
|
|
// 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 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|