mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-08 01:28:18 +03:00
fmt
This commit is contained in:
@@ -155,8 +155,9 @@ fn test_mremap() {
|
||||
|
||||
// Test all of our error conditions
|
||||
// Not aligned
|
||||
let ptr =
|
||||
unsafe { libc::mremap(ptr::without_provenance_mut(1), page_size, page_size, libc::MREMAP_MAYMOVE) };
|
||||
let ptr = unsafe {
|
||||
libc::mremap(ptr::without_provenance_mut(1), page_size, page_size, libc::MREMAP_MAYMOVE)
|
||||
};
|
||||
assert_eq!(ptr, libc::MAP_FAILED);
|
||||
assert_eq!(Error::last_os_error().raw_os_error().unwrap(), libc::EINVAL);
|
||||
|
||||
|
||||
@@ -29,7 +29,8 @@ fn foo_mut<T>(v: &mut [T]) -> Option<&mut [T]> {
|
||||
|
||||
// In a slice of zero-size elements the pointer is meaningless.
|
||||
// Ensure iteration still works even if the pointer is at the end of the address space.
|
||||
let slice: &[()] = unsafe { slice::from_raw_parts(ptr::without_provenance(-5isize as usize), 10) };
|
||||
let slice: &[()] =
|
||||
unsafe { slice::from_raw_parts(ptr::without_provenance(-5isize as usize), 10) };
|
||||
assert_eq!(slice.len(), 10);
|
||||
assert_eq!(slice.iter().count(), 10);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user