Skip to content

Commit de26711

Browse files
committed
Auto merge of rust-lang#79594 - vn-ki:const-eval-intrinsic, r=oli-obk
add const_allocate intrinsic r? `@oli-obk` fixes rust-lang#75390
2 parents ea29d74 + 427afdb commit de26711

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

core/src/intrinsics.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1732,6 +1732,11 @@ extern "rust-intrinsic" {
17321732
/// See documentation of `<*const T>::guaranteed_ne` for details.
17331733
#[rustc_const_unstable(feature = "const_raw_ptr_comparison", issue = "53020")]
17341734
pub fn ptr_guaranteed_ne<T>(ptr: *const T, other: *const T) -> bool;
1735+
1736+
/// Allocate at compile time. Should not be called at runtime.
1737+
#[rustc_const_unstable(feature = "const_heap", issue = "79597")]
1738+
#[cfg(not(bootstrap))]
1739+
pub fn const_allocate(size: usize, align: usize) -> *mut u8;
17351740
}
17361741

17371742
// Some functions are defined here because they accidentally got made

core/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
#![feature(arbitrary_self_types)]
6969
#![feature(asm)]
7070
#![feature(cfg_target_has_atomic)]
71+
#![cfg_attr(not(bootstrap), feature(const_heap))]
7172
#![feature(const_alloc_layout)]
7273
#![feature(const_discriminant)]
7374
#![feature(const_cell_into_inner)]

0 commit comments

Comments
 (0)