1
Fork 0
rust/tests/ui/array-slice-vec/driftsort-off-by-one-issue-136103.rs
uellenberg 1565254478 Fix off-by-one error causing driftsort to crash
Fixes #136103.
Based on the analysis by @jonathan-gruber-jg and @orlp.
2025-01-28 23:39:46 -08:00

10 lines
317 B
Rust

//@ run-pass
// Ensures that driftsort doesn't crash under specific slice
// length and memory size.
// Based on the example given in https://github.com/rust-lang/rust/issues/136103.
fn main() {
let n = 127;
let mut objs: Vec<_> =
(0..n).map(|i| [(i % 2) as u8; 125001]).collect();
objs.sort();
}