Skip to content

Each usage of {:?} on usize appears to generate a separate adapater to core::fmt::Display #47785

@bholley

Description

@bholley

I've been working on removing Debug implementations from Firefox release builds to improve code size. One common culprit is assert_eq!(), which generally takes integers, but formats them with {:?}.

I first assumed that this would probably call straight into Display, or at the very least instantiate a single adapter. Unfortunately, we appear to end up with one adapter per callsite, because the adapters use relative jumps.

So we end up with tons of functions of the form: https://gist.github.com/bholley/b3b8b3a9df649334263338955c10f63d

Which are all identical, except for the offset in the jump instruction: https://gist.github.com/bholley/e2c4ceec5cc3bc38c2462f7cc4bfd242

I'm not sure if this is an LLVM bug or a rustc bug, but it sure seems sub-optimal.

CC @SimonSapin @nox @Manishearth @emilio

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions