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 2246a4e commit b7fa550Copy full SHA for b7fa550
library/std/src/sys/thread_local/os.rs
@@ -172,6 +172,9 @@ impl<T: 'static> Storage<T> {
172
// Manually allocate with the requested alignment
173
let layout = Layout::new::<Value<T>>().align_to(align).unwrap();
174
let ptr: *mut Value<T> = (unsafe { crate::alloc::alloc(layout) }).cast();
175
+ if ptr.is_null() {
176
+ crate::alloc::handle_alloc_error(layout);
177
+ }
178
unsafe {
179
ptr.write(Value {
180
value: i.and_then(Option::take).unwrap_or_else(f),
0 commit comments