File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -659,7 +659,8 @@ Certain Rust types are defined to never be `null`. This includes references (`&T
659
659
` &mut T ` ), boxes (` Box<T> ` ), and function pointers (` extern "abi" fn() ` ). When
660
660
interfacing with C, pointers that might be ` null ` are often used, which would seem to
661
661
require some messy ` transmute ` s and/or unsafe code to handle conversions to/from Rust types.
662
- However, the language provides a workaround.
662
+ However, trying to construct/work with these invalid values ** is undefined behavior** ,
663
+ so you should use the following workaround instead.
663
664
664
665
As a special case, an ` enum ` is eligible for the "nullable pointer optimization" if it contains
665
666
exactly two variants, one of which contains no data and the other contains a field of one of the
You can’t perform that action at this time.
0 commit comments