Skip to content

Move from {{closure}}#0 syntax to {closure#0} for (def) path components. #70334

Open
@eddyb

Description

@eddyb

Today if a path refers to unnamed defs such as closures, it's printed using double braces e.g. for the following example, rustc refers to Foo as main::{{closure}}#0::Foo:

fn main() {
    || {
        struct Foo;
        let () = Foo;
        //  ^^ expected struct `main::{{closure}}#0::Foo`, found `()`
    }
}

However, the new Rust Symbol Mangling (rust-lang/rfcs#2603 / #60705), uses {closure#0} instead.

I forget if I wrote about this before, but I prefer the newer form and it would be nice if we could switch everything uniformly to it.

As an aside, I've long believed that the double braces (e.g. {{closure}}, {{impl}}) were meant to be single braces (i.e. {closure}, {impl}), escaped for format!, and that somehow that got lost.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlC-cleanupCategory: PRs that clean code up or issues documenting cleanup.T-compilerRelevant to the compiler 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