-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Description
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.