Skip to content

Tuple field names in debuginfo are prefixed with __.  #106009

@jswrenn

Description

@jswrenn

The DWARF debugging information entries for tuple field names (and for the field names of tuple-like structs and variants) are prefixed with __. For instance, Option's Some variant is recorded as having a field named __0, rather than 0.

I think this is a little unfortunate. Tuple indices behave quite like field names in Rust, insofar that they're accessed with . and that you can instantiate tuple-like structs and variants as if they are records; e.g.:

Some { 0: true };

It's odd, then, that these fields would not appear in a debugger as they would in Rust.

My own stake in this is deflect, allows you to get fields by name from structs and variants. Users reflecting on tuple-like structs and variants must know to prefix their queries with __, and the pretty-printer and serializers provided by deflect cannot generally strip away the __ from field names.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)C-enhancementCategory: An issue proposing an enhancement or a PR with one.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