diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2025-02-01 01:19:20 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-01 01:19:20 +0100 |
| commit | f90c321eb2911b101c5af762a9592607ca7da637 (patch) | |
| tree | 6933e6a0c5ba76e8e60450b57087567148054781 /tests | |
| parent | 3c4b9122ec951f493cc2677b354d80202323bf1f (diff) | |
| parent | 15652544786b6787af29cae9bc0bb16d49d48fb4 (diff) | |
| download | rust-f90c321eb2911b101c5af762a9592607ca7da637.tar.gz rust-f90c321eb2911b101c5af762a9592607ca7da637.zip | |
Rollup merge of #136163 - uellenberg:driftsort-off-by-one, r=Mark-Simulacrum
Fix off-by-one error causing slice::sort to abort the program Fixes #136103. Based on the analysis by ``@jonathan-gruber-jg`` and ``@orlp.``
Diffstat (limited to 'tests')
| -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(); +} |
