diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-01-28 22:25:41 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-28 22:25:41 +0100 |
| commit | f21f83d11710f13e285dab4bea7b9bebd1d47814 (patch) | |
| tree | 5107c096fdcbfc3170fc34efe95b28b02ac3033e /src/rustllvm/PassWrapper.cpp | |
| parent | d8a0dd7ae88023bd09fa4b86c9ca1f6ed8095b43 (diff) | |
| parent | 489a79247ddf5da8090019ff4da4b688ad55afa7 (diff) | |
| download | rust-f21f83d11710f13e285dab4bea7b9bebd1d47814.tar.gz rust-f21f83d11710f13e285dab4bea7b9bebd1d47814.zip | |
Rollup merge of #57045 - RalfJung:kill-more-uninit, r=SimonSapin
Kill remaining uses of mem::uninitialized in libcore, liballoc
Kill remaining uses of mem::uninitialized in libcore and liballoc, and enable a lint that will warn when uses are added again in the future.
To avoid casting raw pointers around (which is always very dangerous because it is not typechecked at all -- it doesn't even get the "same size" sanity check that `transmute` gets), I also added two new functions to `MaybeUninit`:
```rust
/// Get a pointer to the first contained values.
pub fn first_ptr(this: &[MaybeUninit<T>]) -> *const T {
this as *const [MaybeUninit<T>] as *const T
}
/// Get a mutable pointer to the first contained values.
pub fn first_mut_ptr(this: &mut [MaybeUninit<T>]) -> *mut T {
this as *mut [MaybeUninit<T>] as *mut T
}
```
I changed some of the existing code to use array-of-`MaybeUninit` instead of `MaybeUninit`-of-array, successfully removing raw pointer casts there as well.
Diffstat (limited to 'src/rustllvm/PassWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
