struct PointersInner<T> {
prev: Option<NonNull<T>>,
next: Option<NonNull<T>>,
_pin: PhantomPinned,
}Expand description
We do not want the compiler to put the noalias attribute on mutable
references to this type, so the type has been made !Unpin with a
PhantomPinned field.
Additionally, we never access the prev or next fields directly, as any
such access would implicitly involve the creation of a reference to the
field, which we want to avoid since the fields are not !Unpin, and would
hence be given the noalias attribute if we were to do such an access. As
an alternative to accessing the fields directly, the Pointers type
provides getters and setters for the two fields, and those are implemented
using ptr-specific methods which avoids the creation of intermediate
references.
See this link for more information: https://github.com/rust-lang/rust/pull/82834
Fields§
§prev: Option<NonNull<T>>The previous node in the list. null if there is no previous node.
next: Option<NonNull<T>>The next node in the list. null if there is no previous node.
_pin: PhantomPinnedThis type is !Unpin due to the heuristic from: https://github.com/rust-lang/rust/pull/82834