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
This is because of incorrect use of unreachable_unchecked when Lazy structure is poisoned.
pubfnforce(this:&Lazy<T,F>) -> &T{// Safe because closure is guaranteed to be called at most once// so we only call `F` once, this also guarantees no race conditions
this.cell.get_or_init(|| unsafe{match(*this.init.get()).take(){Some(f) => f(),None => unreachable_unchecked(),}})}
This should panic instead of causing unreachable UB.
The text was updated successfully, but these errors were encountered:
The following program causes UB:
This is because of incorrect use of
unreachable_unchecked
whenLazy
structure is poisoned.This should panic instead of causing unreachable UB.
The text was updated successfully, but these errors were encountered: