about summary refs log tree commit diff
path: root/compiler/rustc_parse/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-05-27 22:11:53 +0000
committerbors <bors@rust-lang.org>2025-05-27 22:11:53 +0000
commitbe422939446d7c5b27ba98debb6b4b8d6a261f1a (patch)
treea79e45d3cedc5d832973ac65906284c894f62ac0 /compiler/rustc_parse/src
parent45f256d9d7cffb66185c0bf1b8a864cba79db90c (diff)
parent6d0e04d6f384d8ac8d2eb00ea90d25ac6dcff914 (diff)
downloadrust-be422939446d7c5b27ba98debb6b4b8d6a261f1a.tar.gz
rust-be422939446d7c5b27ba98debb6b4b8d6a261f1a.zip
Auto merge of #129658 - saethlin:spare-a-crumb, r=jhpratt
Add some track_caller info to precondition panics

Currently, when you encounter a precondition check, you'll always get the caller location of the implementation of the precondition checks. But with this PR, you'll be told the location of the invalid call. Which is useful.

I thought of this while looking at https://github.com/rust-lang/rust/pull/129642#issuecomment-2311703898.

The changes to `tests/ui/const*` happen because the const-eval interpreter skips `#[track_caller]` frames in its backtraces.

The perf implications of this are:
* Increased debug binary sizes. The caller_location implementation requires that the additional data we want to display here be stored in const allocations, which are deduplicated but not across crates. There is no impact on optimized build sizes. The panic path and the caller location data get optimized out.
* The compile time hit to opt-incr-patched bitmaps happens because the patch changes the line number of some function calls with precondition checks, causing us to go from 0 dirty CGUs to 1 dirty CGU.
* The other compile time hits are marginal but real, and due to doing a handful of new queries. Adding more useful data isn't completely free.
Diffstat (limited to 'compiler/rustc_parse/src')
0 files changed, 0 insertions, 0 deletions