conflicting-borrow
Default severity: error · Identifier: weavec::conflicting-borrow
What it means
Section titled “What it means”An object is freed or moved while a live pointer into it exists: cannot free '<p>' while it is borrowed, cannot move '<p>' while it is borrowed. Note: borrowed by '<q>' here. A pointer is live until its last use (RFC 0006). Not reported for a pointer derived from <p> (q = &p->f, q = p + 1): that is a name for the same object, and its later use is a use-after-free (RFC 0011). With --exclusive-borrows (-fweavec-exclusive-borrows), RFC 0001’s exclusivity rules are enforced too: cannot borrow '<x>' as mutable because it is already borrowed, ... as shared because it is already mutably borrowed, cannot assign to '<x>' while it is borrowed; the note names the other pointer.
How to resolve it
Section titled “How to resolve it”Delay release, transfer, or mutation until the borrow’s final use. Under exclusive-borrow checking, keep mutable access exclusive and shared access read-only. Shorten the borrow by moving its last use earlier.