diff options
| author | Simon Sapin <simon.sapin@exyr.org> | 2022-02-14 20:05:45 +0100 |
|---|---|---|
| committer | Simon Sapin <simon.sapin@exyr.org> | 2022-05-13 18:03:06 +0200 |
| commit | 7ccc09b210469fe598e8c829bccd83f3745b9e38 (patch) | |
| tree | 245f40054a79777e0f4bf8bb6ec7c4914a2cbc18 /compiler/rustc_mir_transform/src/coverage/debug.rs | |
| parent | 1c80ac003b59a2e708f127a721904e92ea51d0b9 (diff) | |
| download | rust-7ccc09b210469fe598e8c829bccd83f3745b9e38.tar.gz rust-7ccc09b210469fe598e8c829bccd83f3745b9e38.zip | |
Extend ptr::null and null_mut to all thin (including extern) types
Fixes https://github.com/rust-lang/rust/issues/93959 This change was accepted in https://rust-lang.github.io/rfcs/2580-ptr-meta.html Note that this changes the signature of **stable** functions. The change should be backward-compatible, but it is **insta-stable** since it cannot (easily, at all?) be made available only through a `#![feature(…)]` opt-in. The RFC also proposed the same change for `NonNull::dangling`, which makes sense it terms of its signature but not in terms of its implementation. `dangling` uses `align_of()` as an address. But what `align_of()` should be for extern types or whether it should be allowed at all remains an open question. This commit depends on https://github.com/rust-lang/rust/pull/93977, which is not yet part of the bootstrap compiler. So `#[cfg]` is used to only apply the change in stage 1+. As far a I know bounds cannot be made conditional with `#[cfg]`, so the entire functions are duplicated. This is unfortunate but temporary. Since this duplication makes it less obvious in the diff, the new definitions differ in: * More permissive bounds (`Thin` instead of implied `Sized`) * Different implementation * Having `rustc_allow_const_fn_unstable(ptr_metadata)`
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/debug.rs')
0 files changed, 0 insertions, 0 deletions
