-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
pin-init/internal/src/dyn_init.rs
Lines 180 to 187 in a176e16
| 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),*))Metadata
Metadata
Assignees
Labels
No labels