diff options
| author | Ralf Jung <post@ralfj.de> | 2024-05-04 08:40:42 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-05-04 08:40:42 +0200 |
| commit | 4e97c6c5c77fa165e46b7cb1f77917ebf38ad20f (patch) | |
| tree | c0d589607269ea8d6ebe51af431f601305dbf450 | |
| parent | 821d23b32930c68e36a5a246e734fa3a655970d9 (diff) | |
| download | rust-4e97c6c5c77fa165e46b7cb1f77917ebf38ad20f.tar.gz rust-4e97c6c5c77fa165e46b7cb1f77917ebf38ad20f.zip | |
mark const_(de)allocate intrinsics as suitable for Miri
| -rw-r--r-- | library/core/src/intrinsics.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs index 4c7b511cfde..131d0f24498 100644 --- a/library/core/src/intrinsics.rs +++ b/library/core/src/intrinsics.rs @@ -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. |
