Skip to content

panic::Location Debug implementation now prints a byte array #142279

@tgross35

Description

@tgross35

Since #135054, the Debug implementation for std::panic::Location just prints the byte bag:

fn main() {
    dbg!(std::panic::Location::caller());
}

Stable:

[src/main.rs:2:5] std::panic::Location::caller() = Location {
    file: "src/main.rs",
    line: 2,
    col: 10,
}

Nightly:

[src/main.rs:2:5] std::panic::Location::caller() = Location {
    file_bytes_with_nul: [
        115,
        114,
        99,
        47,
        109,
        97,
        105,
        110,
        46,
        114,
        115,
        0,
    ],
    line: 2,
    col: 10,
}

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=698066c5427dd43cb12df0d2fb5b9300

Originally noticed at #142216.

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.P-highHigh priorityT-libsRelevant to the library team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions