diff options
Diffstat (limited to '')
-rw-r--r-- | tests/ui/borrowck/issue-114374-invalid-help-fmt-args.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.rs b/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.rs new file mode 100644 index 000000000..4a6c2f9ed --- /dev/null +++ b/tests/ui/borrowck/issue-114374-invalid-help-fmt-args.rs @@ -0,0 +1,16 @@ +#![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); +} |