File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -1224,11 +1224,13 @@ where
12241224 _enum_variant => {
12251225 use crate :: invariant:: { Validity , ValidityKind } ;
12261226 match I :: Validity :: KIND {
1227- // The projectability of a field from an `Uninit` or
1228- // `Initialized` union cannot generally depend on
1229- // the referent's value, because the union's
1230- // discriminant is not in a valid state, and thus
1231- // cannot be used to discriminate between variants.
1227+ // The `Uninit` and `Initialized` validity
1228+ // invariants do not depend on the enum's tag. In
1229+ // particular, we don't actually care about what
1230+ // variant is present – we can treat *any* range of
1231+ // uninitialized or initialized memory as containing
1232+ // an uninitialized or initialized instance of *any*
1233+ // type – the type itself is irrelevant.
12321234 ValidityKind :: Uninit | ValidityKind :: Initialized => true ,
12331235 // The projectability of an enum field from an
12341236 // `AsInitialized` or `Valid` state is a dynamic
You can’t perform that action at this time.
0 commit comments