-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Closed
Labels
A-fmtArea: `core::fmt`Area: `core::fmt`A-temporary-lifetime-extensionArea: temporary lifetime extensionArea: temporary lifetime extensionC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
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).)
Metadata
Metadata
Assignees
Labels
A-fmtArea: `core::fmt`Area: `core::fmt`A-temporary-lifetime-extensionArea: temporary lifetime extensionArea: temporary lifetime extensionC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.