File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -581,9 +581,9 @@ However, the language provides a workaround.
581
581
As a special case, an ` enum ` is eligible for the "nullable pointer optimization" if it
582
582
contains exactly two variants, one of which contains no data and the other contains
583
583
a field of one of the non-nullable types listed above (or a struct containing such a type).
584
- This means it is represented as a single pointer, and the non-data variant is represented as a
585
- null pointer . This is called an "optimization", but unlike other optimizations it is guaranteed
586
- to apply to eligible types.
584
+ This means no extra space is required for a discriminant; rather, the empty variant is represented
585
+ by putting a ` null ` value into the non-nullable field . This is called an "optimization", but unlike
586
+ other optimizations it is guaranteed to apply to eligible types.
587
587
588
588
The most common type that takes advantage of the nullable pointer optimization is ` Option<T> ` ,
589
589
where ` None ` corresponds to ` null ` . So ` Option<extern "C" fn(c_int) -> c_int> ` is a correct way
You can’t perform that action at this time.
0 commit comments