Skip to content

Commit 3ba944f

Browse files
committed
Resolved merge conflicts with main
Signed-off-by: Liam Davis <davisliam123@gmail.com>
1 parent eae12a2 commit 3ba944f

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/lib.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,18 +1393,22 @@ where
13931393
unsafe { pin_init_from_closure(init) }
13941394
}
13951395

1396-
unsafe impl<T, E> Init<T, E> for T {
1397-
unsafe fn __init(self, slot: *mut T) -> Result<(), E> {
1398-
// SAFETY: `slot` points to a valid, uninitialized memory of the correct size and alignment for type `T`.
1396+
// SAFETY: the `__init` function always returns `Ok(())` and initializes every field of `slot`.
1397+
unsafe impl<T> Init<T> for T {
1398+
unsafe fn __init(self, slot: *mut T) -> Result<(), Infallible> {
1399+
// SAFETY: `slot` is valid for writes by the safety requirements of this function.
13991400
unsafe { slot.write(self) };
14001401
Ok(())
14011402
}
14021403
}
14031404

1404-
unsafe impl<T, E> PinInit<T, E> for T {
1405-
unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), E> {
1406-
// SAFETY: `self` is a valid value of type `T`, and all requirements for `__init` are met.
1407-
unsafe { self.__init(slot) }
1405+
// SAFETY: the `__pinned_init` function always returns `Ok(())` and initializes every field of
1406+
// `slot`. Additionally, all pinning invariants of `T` are upheld.
1407+
unsafe impl<T> PinInit<T> for T {
1408+
unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible> {
1409+
// SAFETY: `slot` is valid for writes by the safety requirements of this function.
1410+
unsafe { slot.write(self) };
1411+
Ok(())
14081412
}
14091413
}
14101414

0 commit comments

Comments
 (0)