Skip to content

Commit

Permalink
Revert "test: add test case cannot_alloc_max_usize_minus_some"
Browse files Browse the repository at this point in the history
This reverts commit 77b0c40.

Constructing such bug `Layout`s is now refused by `Layout::
from_size_align` as of [rust-lang/rust#95295][1].

[1]: rust-lang/rust#95295
  • Loading branch information
yvt committed Feb 17, 2023
1 parent dd8b212 commit ab0383f
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions crates/rlsf/tests/global.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// Adopted from
// https://github.com/alexcrichton/dlmalloc-rs/blob/master/tests/global.rs
use std::{
alloc::{GlobalAlloc, Layout},
collections::HashMap,
};
use std::collections::HashMap;

#[global_allocator]
#[cfg(any(all(target_arch = "wasm32", not(target_feature = "atomics")), unix))]
Expand Down Expand Up @@ -55,15 +52,3 @@ fn test_larger_than_word_alignment() {
}
}
}

#[test]
fn cannot_alloc_max_usize_minus_some() {
// The test should complete without causing OOM
for offset in (0..64).step_by(8) {
let layout = Layout::from_size_align(usize::MAX - offset, 1).unwrap();
for _ in 0..1000000 {
let result = unsafe { A.alloc(layout) };
assert!(result.is_null());
}
}
}

0 comments on commit ab0383f

Please sign in to comment.