Skip to content

Commit 25d4f09

Browse files
committed
rust: arc: move From<UniqueArc<T>> for Pin<UniqueArc<T>> impl
This is part of the effort to minimize the differences of the `rust` branch with respect to mainline in order to eventually drop it. Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 85a58b2 commit 25d4f09

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

rust/kernel/sync/arc.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -370,14 +370,6 @@ impl<T: ?Sized> From<UniqueArc<T>> for Arc<T> {
370370
}
371371
}
372372

373-
impl<T: ?Sized> From<UniqueArc<T>> for Pin<UniqueArc<T>> {
374-
fn from(obj: UniqueArc<T>) -> Self {
375-
// SAFETY: It is not possible to move/replace `T` inside a `Pin<UniqueArc<T>>` (unless `T`
376-
// is `Unpin`), so it is ok to convert it to `Pin<UniqueArc<T>>`.
377-
unsafe { Pin::new_unchecked(obj) }
378-
}
379-
}
380-
381373
impl<T: ?Sized> From<Pin<UniqueArc<T>>> for Arc<T> {
382374
fn from(item: Pin<UniqueArc<T>>) -> Self {
383375
// SAFETY: The type invariants of `Arc` guarantee that the data is pinned.
@@ -551,6 +543,14 @@ impl<T> UniqueArc<MaybeUninit<T>> {
551543
}
552544
}
553545

546+
impl<T: ?Sized> From<UniqueArc<T>> for Pin<UniqueArc<T>> {
547+
fn from(obj: UniqueArc<T>) -> Self {
548+
// SAFETY: It is not possible to move/replace `T` inside a `Pin<UniqueArc<T>>` (unless `T`
549+
// is `Unpin`), so it is ok to convert it to `Pin<UniqueArc<T>>`.
550+
unsafe { Pin::new_unchecked(obj) }
551+
}
552+
}
553+
554554
impl<T: ?Sized> Deref for UniqueArc<T> {
555555
type Target = T;
556556

0 commit comments

Comments
 (0)