Skip to content

format! allows named arguments to be referenced by position #69110

Closed
@Amanieu

Description

@Amanieu

The following example compiles, but shouldn't.

println!("{0} {foo}", foo = 2);

This seems to be an unintentional regression that was introduced somewhere between 1.11.0 and 1.12.0, most likely by #33642.

However, this code has been accepted on stable for multiple years now (1.12 was in 2016), so fixing this might break existing code. We could still change this back to an error if crater reports no regressions since it is reasonable to say that the code in question is clearly incorrect and was not caught by the compiler by mistake.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions