rust/library/core/src/str
bors be42293944 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.
2025-05-27 22:11:53 +00:00
..
converts.rs specify explicit safety guidance for from_utf8_unchecked 2025-04-27 16:56:31 +08:00
count.rs library: Use size_of from the prelude instead of imported 2025-03-06 20:20:38 -08:00
error.rs add FIXME(const-hack) 2024-09-08 23:08:40 +02:00
iter.rs increase perf of charsearcher for single ascii characters 2025-05-26 01:50:13 +07:00
lossy.rs docs: alias limit to Iterator::take, cite [u8]::utf8_chunks in Utf8Chunks 2025-05-02 23:41:52 +02:00
mod.rs Rollup merge of #140952 - SimonSapin:ascii_whitespace_definition, r=dtolnay 2025-05-26 03:38:17 +02:00
pattern.rs increase perf of charsearcher for single ascii characters 2025-05-26 01:50:13 +07:00
traits.rs Add some track_caller info to precondition panics 2025-05-21 09:10:06 -04:00
validations.rs library: Use size_of from the prelude instead of imported 2025-03-06 20:20:38 -08:00