Skip to content

format_args!() inlining/flattening allows for longer lifetimes #110769

Description

@m-ou-se

Before #109999, this gave an error:

let f = format_args!("{}", "abc"); // error[E0716]: temporary value dropped while borrowed
dbg!(f);

But after #109999, that no longer gives an error.

Ideally it shouldn't give an error in any case, but that's a separate issue. Inlining/flattening format_args shouldn't change what compiles and what doesn't compile, so, for now, this still shouldn't compile.

Activity

  1. added
    C-bugCategory: This is a bug.
    A-fmtArea: `core::fmt`
    on Apr 24, 2023
  2. self-assigned this
    on Apr 24, 2023
  3. m-ou-se commented on Apr 24, 2023

    @m-ou-se
    MemberAuthor

    Luckily the fix is easy. We just need to make sure that any format_args!(…) with arguments still results in an expansion that involves borrowing a temporary.

  4. m-ou-se commented on Apr 24, 2023

    @m-ou-se
    MemberAuthor

    Fix here: #110770

  5. added
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on May 9, 2023
  6. added 2 commits that reference this issue on May 9, 2023
    1eb209a
    e4c8250
  7. removed
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-fmtArea: `core::fmt`C-bugCategory: This is a bug.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions