about summary refs log tree commit diff
path: root/src/liballoc/arc.rs
diff options
context:
space:
mode:
authorMike Hommey <mh@glandium.org>2018-05-15 09:56:46 +0900
committerMike Hommey <mh@glandium.org>2018-05-30 05:35:48 +0900
commit0f4ef003ac1691d04f0ce519d1d78696689534aa (patch)
tree389cc750501eda02bc699d4ac967f0000a546fa1 /src/liballoc/arc.rs
parent5015fa346c1bf7e295fc16996ed0d3309c84f09a (diff)
downloadrust-0f4ef003ac1691d04f0ce519d1d78696689534aa.tar.gz
rust-0f4ef003ac1691d04f0ce519d1d78696689534aa.zip
Pass a `Layout` to `oom`
As discussed in
https://github.com/rust-lang/rust/issues/49668#issuecomment-384893456
and subsequent, there are use-cases where the OOM handler needs to know
the size of the allocation that failed. The alignment might also be a
cause for allocation failure, so providing it as well can be useful.
Diffstat (limited to 'src/liballoc/arc.rs')
-rw-r--r--src/liballoc/arc.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs
index d0950bff9ce..f7513248784 100644
--- a/src/liballoc/arc.rs
+++ b/src/liballoc/arc.rs
@@ -553,7 +553,7 @@ impl<T: ?Sized> Arc<T> {
         let layout = Layout::for_value(&*fake_ptr);
 
         let mem = Global.alloc(layout)
-            .unwrap_or_else(|_| oom());
+            .unwrap_or_else(|_| oom(layout));
 
         // Initialize the real ArcInner
         let inner = set_data_ptr(ptr as *mut T, mem.as_ptr() as *mut u8) as *mut ArcInner<T>;