diff options
| author | bors <bors@rust-lang.org> | 2024-04-29 00:05:30 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-04-29 00:05:30 +0000 |
| commit | 5fe8b697e729b6eb64841a3905e57da1b47f4ca3 (patch) | |
| tree | a2ba00476aaa376797f416dc8cfdce98c9bea4ff /compiler/rustc_mir_transform/src/coverage/mod.rs | |
| parent | 1fffb2a355dfee65bf6aa5a9db35f33d3ee93aec (diff) | |
| parent | e0f8202ed5828670ac5125d3db2adbfb516cca3d (diff) | |
| download | rust-5fe8b697e729b6eb64841a3905e57da1b47f4ca3.tar.gz rust-5fe8b697e729b6eb64841a3905e57da1b47f4ca3.zip | |
Auto merge of #124498 - tgross35:stabilize-non_null_convenience, r=jhpratt
Stabilize `non_null_convenience`
Fully stabilize the following API, including const where applicable:
```rust
impl <T> NonNull<T> {
pub const unsafe fn offset(self, count: isize) -> Self;
pub const unsafe fn add(self, count: usize) -> Self;
pub const unsafe fn sub(self, count: usize) -> Self;
pub const unsafe fn offset_from(self, origin: NonNull<T>) -> isize;
pub const unsafe fn read(self) -> T;
pub unsafe fn read_volatile(self) -> T;
pub const unsafe fn read_unaligned(self) -> T;
pub unsafe fn write_volatile(self, val: T);
pub unsafe fn replace(self, src: T) -> T;
}
impl<T: ?Sized> NonNull<T> {
pub const unsafe fn byte_offset(self, count: isize) -> Self;
pub const unsafe fn byte_add(self, count: usize) -> Self;
pub const unsafe fn byte_sub(self, count: usize) -> Self;
pub const unsafe fn byte_offset_from<U: ?Sized>(self, origin: NonNull<U>) -> isize;
pub unsafe fn drop_in_place(self);
}
```
Stabilize the following without const:
```rust
impl <T> NonNull<T> {
// const under `const_intrinsic_copy`
pub const unsafe fn copy_to(self, dest: NonNull<T>, count: usize);
pub const unsafe fn copy_to_nonoverlapping(self, dest: NonNull<T>, count: usize);
pub const unsafe fn copy_from(self, src: NonNull<T>, count: usize);
pub const unsafe fn copy_from_nonoverlapping(self, src: NonNull<T>, count: usize);
// const under `const_ptr_write`
pub const unsafe fn write(self, val: T);
pub const unsafe fn write_bytes(self, val: u8, count: usize);
pub const unsafe fn write_unaligned(self, val: T);
// const under `const_swap`
pub const unsafe fn swap(self, with: NonNull<T>);
// const under `const_align_offset`
pub const fn align_offset(self, align: usize) -> usize;
// const under `const_pointer_is_aligned`
pub const fn is_aligned(self) -> bool;
}
```
Left the following unstable:
```rust
impl <T> NonNull<T> {
// moved gate to `ptr_sub_ptr`
pub const unsafe fn sub_ptr(self, subtracted: NonNull<T>) -> usize;
}
impl <T: ?Sized> NonNull<T> {
// moved gate to `pointer_is_aligned_to`
pub const fn is_aligned_to(self, align: usize) -> bool;
}
```
Fixes: https://github.com/rust-lang/rust/issues/117691
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/mod.rs')
0 files changed, 0 insertions, 0 deletions
