2017-08-13 03:46:49 -05:00
|
|
|
// Regression test for issue #27592.
|
2015-08-12 19:58:47 -05:00
|
|
|
|
|
|
|
fn write<'a, F: ::std::ops::FnOnce()->::std::fmt::Arguments<'a> + 'a>(fcn: F) {
|
|
|
|
use std::fmt::Write;
|
|
|
|
let _ = match fcn() { a => write!(&mut Stream, "{}", a), };
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Stream;
|
|
|
|
impl ::std::fmt::Write for Stream {
|
|
|
|
fn write_str(&mut self, _s: &str) -> ::std::fmt::Result {
|
|
|
|
Ok( () )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2017-08-13 03:46:49 -05:00
|
|
|
write(|| format_args!("{}", String::from("Hello world")));
|
2015-08-12 19:58:47 -05:00
|
|
|
//~^ ERROR borrowed value does not live long enough
|
|
|
|
//~| ERROR borrowed value does not live long enough
|
|
|
|
}
|