Skip to content

symbol names do not include enough information to identify specializations #45691

@froydnj

Description

@froydnj

When looking at symbols in Stylo today, I stumbled upon:

0x1c01c FUNC    LOCAL  DEFAULT   11 _$LT$style..properties..PropertyDeclaration$u20$as$u20$style_traits..values..ToCss$GT$::to_css::hf4dc63cd1d21296c
83152 FUNC    LOCAL  DEFAULT   11 _$LT$style..properties..PropertyDeclaration$u20$as$u20$style_traits..values..ToCss$GT$::to_css::h4cd1bbb5253aecc6
56128 FUNC    LOCAL  DEFAULT   11 _$LT$style..properties..PropertyDeclaration$u20$as$u20$style_traits..values..ToCss$GT$::to_css::h95e73bec7530a735

which initially looked like rustc had duplicated functions (modulo the hashes tacked on at the end). I eventually figured out that they were from:

pub trait ToCss {
    /// Serialize `self` in CSS syntax, writing to `dest`.
    fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: Write;
    // ...other things elided
}

and implementations of said trait. But that's still not much help, because I can't figure out without a lot of tedium which specializations of W are producing which of the above symbols.

I realize C++ symbol names are often long and gross, but they nearly always include enough information to tell you exactly what code you should be looking at. Symbols from rustc often leave out important bits of information, which makes some forms of analysis much more difficult than they ought to be. (You could, if you were so inclined, get some of this information from debug info, but trawling through debug info is its own brand of tedium.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions