rust/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

17 lines
419 B
Rust
Raw Normal View History

#![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);
}