Skip to content

Commit 55b85cc

Browse files
committed
Move capacity_overflow function to make ui tests change less
Code changes in raw_vec require blessing UI tests every time
1 parent b7c0a87 commit 55b85cc

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

library/alloc/src/raw_vec.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ use crate::collections::TryReserveErrorKind::*;
1717
#[cfg(test)]
1818
mod tests;
1919

20+
// One central function responsible for reporting capacity overflows. This'll
21+
// ensure that the code generation related to these panics is minimal as there's
22+
// only one location which panics rather than a bunch throughout the module.
23+
#[cfg(not(no_global_oom_handling))]
24+
#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never))]
25+
fn capacity_overflow() -> ! {
26+
panic!("capacity overflow");
27+
}
28+
2029
enum AllocInit {
2130
/// The contents of the new memory are uninitialized.
2231
Uninitialized,
@@ -576,12 +585,3 @@ fn alloc_guard(alloc_size: usize) -> Result<(), TryReserveError> {
576585
Ok(())
577586
}
578587
}
579-
580-
// One central function responsible for reporting capacity overflows. This'll
581-
// ensure that the code generation related to these panics is minimal as there's
582-
// only one location which panics rather than a bunch throughout the module.
583-
#[cfg(not(no_global_oom_handling))]
584-
#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never))]
585-
fn capacity_overflow() -> ! {
586-
panic!("capacity overflow");
587-
}
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
thread 'main' panicked at library/alloc/src/raw_vec.rs:571:5:
1+
thread 'main' panicked at library/alloc/src/raw_vec.rs:26:5:
22
capacity overflow
33
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

0 commit comments

Comments
 (0)