Skip to content

regression on span for panics due to track-caller in cross-crate macros #70963

Closed

Description

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-track_caller`#![feature(track_caller)]`P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions