From ab0383ff551b6a415b79c785b4c203926fac7dda Mon Sep 17 00:00:00 2001 From: yvt Date: Fri, 17 Feb 2023 10:03:39 +0900 Subject: [PATCH] Revert "test: add test case `cannot_alloc_max_usize_minus_some`" This reverts commit 77b0c40715b08628e2da186e29eff8bc32e659db. Constructing such bug `Layout`s is now refused by `Layout:: from_size_align` as of [rust-lang/rust#95295][1]. [1]: /~https://github.com/rust-lang/rust/pull/95295 --- crates/rlsf/tests/global.rs | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/crates/rlsf/tests/global.rs b/crates/rlsf/tests/global.rs index cf56aed..e548e15 100644 --- a/crates/rlsf/tests/global.rs +++ b/crates/rlsf/tests/global.rs @@ -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))] @@ -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()); - } - } -}