about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src/coverage/debug.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-05-25 13:58:51 +0000
committerbors <bors@rust-lang.org>2022-05-25 13:58:51 +0000
commit9fed13030c2a2ebd79bfb1fd8be4f768cbe8c9d9 (patch)
tree234ddbc5cd5bd5aa60861382ec78854f8b0fc981 /compiler/rustc_mir_transform/src/coverage/debug.rs
parentfe9c64d0af379e6e48ac1e798d65e2031265aa22 (diff)
parent7ccc09b210469fe598e8c829bccd83f3745b9e38 (diff)
downloadrust-9fed13030c2a2ebd79bfb1fd8be4f768cbe8c9d9.tar.gz
rust-9fed13030c2a2ebd79bfb1fd8be4f768cbe8c9d9.zip
Auto merge of #94954 - SimonSapin:null-thin3, r=yaahc
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(const_fn_trait_bound)`
* 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