mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
17 lines
419 B
Rust
17 lines
419 B
Rust
#![allow(dead_code)]
|
|
|
|
fn bar<'a>(_: std::fmt::Arguments<'a>) {}
|
|
fn main() {
|
|
let x = format_args!("a {} {} {}.", 1, format_args!("b{}!", 2), 3);
|
|
//~^ ERROR temporary value dropped while borrowed
|
|
|
|
bar(x);
|
|
|
|
let foo = format_args!("{}", "hi");
|
|
//~^ ERROR temporary value dropped while borrowed
|
|
bar(foo);
|
|
|
|
let foo = format_args!("hi"); // no placeholder in arguments, so no error
|
|
bar(foo);
|
|
}
|