This example has regressed (including on stable by now): (playground)
fn main() {
std::collections::VecDeque::<String>::with_capacity(!0);
}
The location reported is now <::core::macros::panic macros>:3:10 (or on nightly, src/libcore/macros/mod.rs:34:9).
(the choice of VecDeque::with_capacity is arbitrary, it just happens to have an assert! inside, and it will be codegen'd in the user crate because it's generic)
In general, we don't track enough information to recover the invocation site, when we have to codegen the MIR cross-crate.
A cheap hack we could do is replace the macro span with the invocation one, when serializing Spans inside MIR (or Spans in general?).
Originally posted by @eddyb in #47809 (comment)
This example has regressed (including on stable by now): (playground)
The location reported is now
<::core::macros::panic macros>:3:10(or on nightly,src/libcore/macros/mod.rs:34:9).(the choice of
VecDeque::with_capacityis arbitrary, it just happens to have anassert!inside, and it will be codegen'd in the user crate because it's generic)In general, we don't track enough information to recover the invocation site, when we have to codegen the MIR cross-crate.
A cheap hack we could do is replace the macro span with the invocation one, when serializing
Spans inside MIR (orSpans in general?).Originally posted by @eddyb in #47809 (comment)