We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cb4b650 commit b1bad7aCopy full SHA for b1bad7a
library/alloc/src/alloc.rs
@@ -10,7 +10,7 @@ use core::hint;
10
#[cfg(not(test))]
11
use core::ptr::{self, NonNull};
12
13
-use safety::requires;
+use safety::{ensures,requires};
14
#[cfg(kani)]
15
#[unstable(feature="kani", issue="none")]
16
use core::kani;
@@ -177,8 +177,8 @@ pub unsafe fn alloc_zeroed(layout: Layout) -> *mut u8 {
177
178
179
impl Global {
180
- #[requires(layout.size() == 0 || layout.align() != 0)]
181
#[inline]
+ #[ensures(|ret| layout.size() != 0 || ret.is_ok())]
182
fn alloc_impl(&self, layout: Layout, zeroed: bool) -> Result<NonNull<[u8]>, AllocError> {
183
match layout.size() {
184
0 => Ok(NonNull::slice_from_raw_parts(layout.dangling(), 0)),
0 commit comments