///
/// To mutably access the data of more than one node at once,
/// use
-/// [`IsTokenMut::multi_static`],
+/// [`IsTokenMut::multi_static`]
+/// or
/// [`IsTokenMut::multi_dynamic`].
-///
/// To avoid runtime aliasing checks, and take manual control of aliasing,
/// you can
/// [`.borrow_mut()`](Ptr::borrow_mut()) with
-/// [`TokenMut::new_unchecked()`].
-/// Or,
+/// [`TokenMut::new_unchecked()`];
+/// or,
/// `p`[`.as_ptr()`](Ptr::as_ptr)[`.as_ref()`](NonNull::as_ref())
/// /
/// `p`[`.as_ptr()`](Ptr::as_ptr)[`.as_mut()`](NonNull::as_mut()).
//---------- stack ----------
+/// A `Ptr` borrowed from stack data
pub struct Borrowed<'t, T: ?Sized> {
ptr: Ptr<T>,
/// Variance and borrowing:
///
/// Using `retained` is recommended:
/// it will ensure that `Ptr`s are still live at that point.
+ ///
+ /// ## Unwinding
+ ///
+ /// Not that `Borrowed` comes with exciting hazards
+ /// in the presence of panics:
+ /// a typical use is to take a stack item,
+ /// link it temporarily into a data structure.
+ ///
+ /// If an unwind occurs before the item is unlinked again,
+ /// the data structure can be corrupted.
+ /// It is the responsibility of the user to avoid this situation.
+ ///
+ /// (Note that use of `Ptr` without `Borrowed` does also come with
+ /// hazards in the face of unwinding,
+ /// but those are typically just memory leaks.)
pub unsafe fn new(t: &mut T) -> Self {
Borrowed {
ptr: Ptr::from_raw(NonNull::from(t)),