You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The borrows to self and [T] have different lifetimes (implicit and 'a), and the implicit input lifetime will be assigned a different lifetime (not 'a). This means that one could create two mutable references, or a combination of immutable and mutable references, to the same underlying T.
I understand that this is an unsafe function, but this could be a quick fix that addresses one potential memory safety issue. If the lifetimes were instead as follows, this would not allow multiple slice references to the same MemMap.
The lifetime bounds in the methods
as_slice
andas_slice_mut
intypes::abs::MemMap
(link) are currentlyThe borrows to
self
and[T]
have different lifetimes (implicit and'a
), and the implicit input lifetime will be assigned a different lifetime (not'a
). This means that one could create two mutable references, or a combination of immutable and mutable references, to the same underlyingT
.I understand that this is an unsafe function, but this could be a quick fix that addresses one potential memory safety issue. If the lifetimes were instead as follows, this would not allow multiple slice references to the same MemMap.
The text was updated successfully, but these errors were encountered: