Mitigate binary size impact of implicit caller location #70580
Description
Once we've measured the size impact of implicit caller location, we need to decide what (if any) knobs to offer users to mitigate that impact.
The RFC originally proposed a -Zlocation-detail-control
flag for rustc which would allow users to control which fields of Location
were preserved.
On the tracking issue I also proposed an all-or-nothing flag like -Zredact-caller-location
which would either preserve Location
s or rewrite them all to be the same.
Note that both of these options are limited to controlling the locations reported by user code -- unless a user recompiles std
with whatever flag we offer, there will always be "unredacted" locations in their binary.
I'm fond of ideas that would allow us to replace Location
s with something smaller that can be "symbolized" similarly to the way a debugger for an embedded device can identify the source location for a program counter value in a stacktrace. I think most options in this direction require help from the linker that isn't available, but I'd love to be wrong.