diff options
| author | uellenberg <JonahUellenberg@hotmail.com> | 2025-01-27 16:21:08 -0800 |
|---|---|---|
| committer | uellenberg <JonahUellenberg@hotmail.com> | 2025-01-28 23:39:46 -0800 |
| commit | 15652544786b6787af29cae9bc0bb16d49d48fb4 (patch) | |
| tree | 88ecc39195c37200f8a3399c0856ccb2384c5b6a /tests/ui/array-slice-vec | |
| parent | ebcf860e7345e3387b4c6961338c77424b43cbd5 (diff) | |
| download | rust-15652544786b6787af29cae9bc0bb16d49d48fb4.tar.gz rust-15652544786b6787af29cae9bc0bb16d49d48fb4.zip | |
Fix off-by-one error causing driftsort to crash
Fixes #136103. Based on the analysis by @jonathan-gruber-jg and @orlp.
Diffstat (limited to 'tests/ui/array-slice-vec')
| -rw-r--r-- | tests/ui/array-slice-vec/driftsort-off-by-one-issue-136103.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/ui/array-slice-vec/driftsort-off-by-one-issue-136103.rs b/tests/ui/array-slice-vec/driftsort-off-by-one-issue-136103.rs new file mode 100644 index 00000000000..42197ff102d --- /dev/null +++ b/tests/ui/array-slice-vec/driftsort-off-by-one-issue-136103.rs @@ -0,0 +1,10 @@ +//@ 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(); +} |
