init(slot).map(|__InitOk| ())
};
// SAFETY: TODO
- let init = unsafe { ::pin_init::#init_from_closure::<_, #error>(init) };
- // FIXME: this let binding is required to avoid a compiler error (cycle when computing the
- // opaque type returned by this function) before Rust 1.81. Remove after MSRV bump.
- #[allow(
- clippy::let_and_return,
- reason = "some clippy versions warn about the let binding"
- )]
- init
+ unsafe { ::pin_init::#init_from_closure::<_, #error>(init) }
}})
}
pub const unsafe fn cast_pin_init<T, U, E>(init: impl PinInit<T, E>) -> impl PinInit<U, E> {
// SAFETY: initialization delegated to a valid initializer. Cast is valid by function safety
// requirements.
- let res = unsafe { pin_init_from_closure(|ptr: *mut U| init.__pinned_init(ptr.cast::<T>())) };
- // FIXME: this let binding is required to avoid a compiler error (cycle when computing the opaque
- // type returned by this function) before Rust 1.81. Remove after MSRV bump.
- #[allow(
- clippy::let_and_return,
- reason = "some clippy versions warn about the let binding"
- )]
- res
+ unsafe { pin_init_from_closure(|ptr: *mut U| init.__pinned_init(ptr.cast::<T>())) }
}
/// Changes the to be initialized type.
pub const unsafe fn cast_init<T, U, E>(init: impl Init<T, E>) -> impl Init<U, E> {
// SAFETY: initialization delegated to a valid initializer. Cast is valid by function safety
// requirements.
- let res = unsafe { init_from_closure(|ptr: *mut U| init.__init(ptr.cast::<T>())) };
- // FIXME: this let binding is required to avoid a compiler error (cycle when computing the opaque
- // type returned by this function) before Rust 1.81. Remove after MSRV bump.
- #[allow(
- clippy::let_and_return,
- reason = "some clippy versions warn about the let binding"
- )]
- res
+ unsafe { init_from_closure(|ptr: *mut U| init.__init(ptr.cast::<T>())) }
}
/// An initializer that leaves the memory uninitialized.