mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-04 02:54:00 +00:00
mark const_(de)allocate intrinsics as suitable for Miri
This commit is contained in:
parent
821d23b329
commit
4e97c6c5c7
@ -2821,8 +2821,10 @@ pub const fn ub_checks() -> bool {
|
||||
#[unstable(feature = "core_intrinsics", issue = "none")]
|
||||
#[rustc_nounwind]
|
||||
#[rustc_intrinsic]
|
||||
#[cfg_attr(not(bootstrap), miri::intrinsic_fallback_checks_ub)]
|
||||
pub const unsafe fn const_allocate(_size: usize, _align: usize) -> *mut u8 {
|
||||
// const eval overrides this function, but runtime code should always just return null pointers.
|
||||
// const eval overrides this function, but runtime code for now just returns null pointers.
|
||||
// See <https://github.com/rust-lang/rust/issues/93935>.
|
||||
crate::ptr::null_mut()
|
||||
}
|
||||
|
||||
@ -2840,7 +2842,10 @@ pub const unsafe fn const_allocate(_size: usize, _align: usize) -> *mut u8 {
|
||||
#[unstable(feature = "core_intrinsics", issue = "none")]
|
||||
#[rustc_nounwind]
|
||||
#[rustc_intrinsic]
|
||||
pub const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
|
||||
#[cfg_attr(not(bootstrap), miri::intrinsic_fallback_checks_ub)]
|
||||
pub const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {
|
||||
// Runtime NOP
|
||||
}
|
||||
|
||||
/// `ptr` must point to a vtable.
|
||||
/// The intrinsic will return the size stored in that vtable.
|
||||
|
Loading…
Reference in New Issue
Block a user