diff options
Diffstat (limited to 'src/docs/uninit_assumed_init.txt')
| -rw-r--r-- | src/docs/uninit_assumed_init.txt | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/src/docs/uninit_assumed_init.txt b/src/docs/uninit_assumed_init.txt deleted file mode 100644 index cca24093d40..00000000000 --- a/src/docs/uninit_assumed_init.txt +++ /dev/null @@ -1,28 +0,0 @@ -### What it does -Checks for `MaybeUninit::uninit().assume_init()`. - -### Why is this bad? -For most types, this is undefined behavior. - -### Known problems -For now, we accept empty tuples and tuples / arrays -of `MaybeUninit`. There may be other types that allow uninitialized -data, but those are not yet rigorously defined. - -### Example -``` -// Beware the UB -use std::mem::MaybeUninit; - -let _: usize = unsafe { MaybeUninit::uninit().assume_init() }; -``` - -Note that the following is OK: - -``` -use std::mem::MaybeUninit; - -let _: [MaybeUninit<bool>; 5] = unsafe { - MaybeUninit::uninit().assume_init() -}; -``` \ No newline at end of file |
