diff options
| author | bors <bors@rust-lang.org> | 2024-09-02 00:58:50 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-09-02 00:58:50 +0000 |
| commit | e71f9529121ca8f687e4b725e3c9adc3f1ebab4d (patch) | |
| tree | 19fc505cf76ed238abfb7f6a1440a0c0aa1aa7bd /library/alloc/src/vec | |
| parent | 94885bc699512cfee8560e73c2a01ee6b4b76563 (diff) | |
| parent | 79b5cfdf834a69fd048f2d904bb53026736e24ad (diff) | |
Auto merge of #129063 - the8472:cold-opt-size, r=Amanieu
Apply size optimizations to panic machinery and some cold functions * std dependencies gimli and addr2line are now built with opt-level=s * various panic-related methods and `#[cold]` methods are now marked `#[optimize(size)]` Panics should be cold enough that it doesn't make sense to optimize them for speed. The only tradeoff here is if someone does a lot of backtrace captures (without panics) and printing then the opt-level change might impact their perf. Seems to be the first use of the optimize attribute. Tracking issue #54882
Diffstat (limited to 'library/alloc/src/vec')
| -rw-r--r-- | library/alloc/src/vec/mod.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index cfd2e4a1512..162791ba59d 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -1519,6 +1519,7 @@ impl<T, A: Allocator> Vec<T, A> { #[cold] #[cfg_attr(not(feature = "panic_immediate_abort"), inline(never))] #[track_caller] + #[optimize(size)] fn assert_failed(index: usize, len: usize) -> ! { panic!("swap_remove index (is {index}) should be < len (is {len})"); } @@ -1567,6 +1568,7 @@ impl<T, A: Allocator> Vec<T, A> { #[cold] #[cfg_attr(not(feature = "panic_immediate_abort"), inline(never))] #[track_caller] + #[optimize(size)] fn assert_failed(index: usize, len: usize) -> ! { panic!("insertion index (is {index}) should be <= len (is {len})"); } @@ -1629,6 +1631,7 @@ impl<T, A: Allocator> Vec<T, A> { #[cold] #[cfg_attr(not(feature = "panic_immediate_abort"), inline(never))] #[track_caller] + #[optimize(size)] fn assert_failed(index: usize, len: usize) -> ! { panic!("removal index (is {index}) should be < len (is {len})"); } @@ -2317,6 +2320,7 @@ impl<T, A: Allocator> Vec<T, A> { #[cold] #[cfg_attr(not(feature = "panic_immediate_abort"), inline(never))] #[track_caller] + #[optimize(size)] fn assert_failed(at: usize, len: usize) -> ! { panic!("`at` split index (is {at}) should be <= len (is {len})"); } |
