Per #414 (comment), opsem consensus appeared to be that a &mut T can write an invalid value of T "temporarily", so long as it's restored to a valid form before returning into safe code. Does this also mean that, for a T with niches, it is valid to overwrite the discriminant of a wrapping enum (e.g. could a &mut NonNull<T> transiently write 0 or uninit even if the said NonNull was part of an Option<NonNull<T>>)?
Relevant to rust-lang/rust#161452
Per #414 (comment), opsem consensus appeared to be that a
&mut Tcan write an invalid value of T "temporarily", so long as it's restored to a valid form before returning into safe code. Does this also mean that, for a T with niches, it is valid to overwrite the discriminant of a wrapping enum (e.g. could a&mut NonNull<T>transiently write 0 or uninit even if the saidNonNullwas part of anOption<NonNull<T>>)?Relevant to rust-lang/rust#161452