format_args!() lifetime-extends its arguments, except when it has only one placeholder:
let a = format_args!("{}", String::new());
dbg!(a); // ERROR
let b = format_args!("{}{}", String::new(), String::new());
dbg!(b); // OK
It should lifetime-extend the temporaries in both cases.
(Originally reported in #145422, see #145422 (comment).)
format_args!()lifetime-extends its arguments, except when it has only one placeholder:It should lifetime-extend the temporaries in both cases.
(Originally reported in #145422, see #145422 (comment).)