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_uncheckedwhenLazystructure is poisoned.This should panic instead of causing unreachable UB.
The text was updated successfully, but these errors were encountered: