about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-01-20 17:10:30 +0100
committerGitHub <noreply@github.com>2022-01-20 17:10:30 +0100
commit98cb33894c87d5a92a19b1b1c38d64caa495a197 (patch)
tree1e94d091ef43b579b95c23ef5068fa46fcb5d5ed /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parent74fbbefea8d13683cca5eee62e4740706cb3144a (diff)
parent5c96dcf96100d67370e794d3ffd59762dbc102ed (diff)
downloadrust-98cb33894c87d5a92a19b1b1c38d64caa495a197.tar.gz
rust-98cb33894c87d5a92a19b1b1c38d64caa495a197.zip
Rollup merge of #89747 - Amanieu:maybeuninit_bytes, r=m-ou-se
Add MaybeUninit::(slice_)as_bytes(_mut)

This adds methods to convert between `MaybeUninit<T>` and a slice of `MaybeUninit<u8>`. This is safe since `MaybeUninit<u8>` can correctly handle padding bytes in any `T`.

These methods are added:
```rust
impl<T> MaybeUninit<T> {
	pub fn as_bytes(&self) -> &[MaybeUninit<u8>];
	pub fn as_bytes_mut(&mut self) -> &mut [MaybeUninit<u8>];
	pub fn slice_as_bytes(this: &[MaybeUninit<T>]) -> &[MaybeUninit<u8>];
	pub fn slice_as_bytes_mut(this: &mut [MaybeUninit<T>]) -> &mut [MaybeUninit<u8>];
}
```
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions