|
let mut ptr = ::core::ptr::null_mut(); |
|
if false { |
|
unsafe { *ptr = Self::#name(self, #(#args),*) }; |
|
} |
|
fn layout_for<T>(_: *mut T) -> ::core::alloc::Layout { |
|
::core::alloc::Layout::new::<T>() |
|
} |
|
layout_for(ptr) |
This snippet can be simplified by calling a generic function to compute layout of the return type:
const fn return_type_layout<T, F: FnOnce() -> T>(_: &F) -> ::core::alloc::Layout {
::core::alloc::Layout::new::<T>()
}
return_type_layout(&|| Self::#name(self, #(#args),*))
playground