about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorTim Diekmann <tim.diekmann@3dvision.de>2020-08-18 22:39:33 +0200
committerTim Diekmann <tim.diekmann@3dvision.de>2020-08-19 06:46:47 +0200
commit438c40efa109d7a4d83efa066c19cb95dad9ed94 (patch)
tree264f37242cd348f83cf3f1b6573b6c561b179672 /src/test
parentbe97d13ffc41961c018c313e909f76ba3bbdc958 (diff)
downloadrust-438c40efa109d7a4d83efa066c19cb95dad9ed94.tar.gz
rust-438c40efa109d7a4d83efa066c19cb95dad9ed94.zip
Allow reallocation to different alignment
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/realloc-16687.rs16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/test/ui/realloc-16687.rs b/src/test/ui/realloc-16687.rs
index bdcd47a7260..2e07fdcbe83 100644
--- a/src/test/ui/realloc-16687.rs
+++ b/src/test/ui/realloc-16687.rs
@@ -48,7 +48,7 @@ unsafe fn test_triangle() -> bool {
             println!("allocate({:?}) = {:?}", layout, ptr);
         }
 
-        ptr.as_non_null_ptr().as_ptr()
+        ptr.as_mut_ptr()
     }
 
     unsafe fn deallocate(ptr: *mut u8, layout: Layout) {
@@ -65,23 +65,17 @@ unsafe fn test_triangle() -> bool {
         }
 
         let memory = if new.size() > old.size() {
-            Global.grow(
-                NonNull::new_unchecked(ptr),
-                old,
-                new.size(),
-            )
+            Global.grow(NonNull::new_unchecked(ptr), old, new)
         } else {
-            Global.shrink(NonNull::new_unchecked(ptr), old, new.size())
+            Global.shrink(NonNull::new_unchecked(ptr), old, new)
         };
 
-        let ptr = memory.unwrap_or_else(|_| {
-            handle_alloc_error(Layout::from_size_align_unchecked(new.size(), old.align()))
-        });
+        let ptr = memory.unwrap_or_else(|_| handle_alloc_error(new));
 
         if PRINT {
             println!("reallocate({:?}, old={:?}, new={:?}) = {:?}", ptr, old, new, ptr);
         }
-        ptr.as_non_null_ptr().as_ptr()
+        ptr.as_mut_ptr()
     }
 
     fn idx_to_size(i: usize) -> usize {