Skip to content

Rust v0: non-ASCII identifiers render as a punycode placeholder #251

Description

@r0ny123

A Rust v0 symbol with a non-ASCII identifier is reported with a placeholder in place of the identifier:

_RNqCs4fqI2P2rA04_11utf8_identsu30____7hkackfecea1cbdathfdh9hlq6y

smda      : utf8_idents::punycode{__-7hkackfecea1cbdathfdh9hlq6y}
rustc-demangle 0.1.28 : utf8_idents::საჭმელად_გემრიელი_სადილი

This is wrong output rather than a clean failure, which makes it worse than leaving the symbol mangled: the reported name is neither the mangled spelling nor the real one, so it cannot be matched against either.

Ident.display() in rust_demangler/rust_v0.py already tries to decode and falls back to the punycode{...} form when try_small_punycode_decode() returns None, which is what happens here. I have not root-caused why the decode fails, so I would not want the fallback simply removed — that would turn a wrong name into a crash-free but empty one. Worth checking whether the hand-rolled decoder can be replaced with the punycode codec in the standard library, which would also delete a chunk of hand-maintained state machine.

How it was found

Cross-checking the demangler against the 18 mangled symbols in rustc-demangle's own test corpus: 8 matched, 9 raised UnableTov0Demangle (the #[splat] grammar, which this port does not implement — raising is the safe outcome, the caller keeps the mangled name), and this one disagreed.

Worth repeating the check after any demangler change; it takes the reference crate's test file as input and needs no fixtures.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions