@@ -1914,13 +1914,27 @@ extern "rust-intrinsic" {
19141914 #[ rustc_const_unstable( feature = "const_raw_ptr_comparison" , issue = "53020" ) ]
19151915 pub fn ptr_guaranteed_ne < T > ( ptr : * const T , other : * const T ) -> bool ;
19161916
1917- /// Allocate at compile time.
1918- /// Returns a null pointer at runtime.
1917+ /// Allocates a block of memory at compile time.
1918+ /// At runtime, just returns a null pointer.
1919+ ///
1920+ /// # Safety
1921+ ///
1922+ /// - The `align` argument must be a power of two.
1923+ /// - At compile time, a compile error occurs if this constraint is violated.
1924+ /// - At runtime, it is not checked.
19191925 #[ rustc_const_unstable( feature = "const_heap" , issue = "79597" ) ]
19201926 pub fn const_allocate ( size : usize , align : usize ) -> * mut u8 ;
19211927
1922- /// Deallocate a memory which allocated by `intrinsics::const_allocate` at compile time.
1923- /// Does nothing at runtime.
1928+ /// Deallocates a memory which allocated by `intrinsics::const_allocate` at compile time.
1929+ /// At runtime, does nothing.
1930+ ///
1931+ /// # Safety
1932+ ///
1933+ /// - The `align` argument must be a power of two.
1934+ /// - At compile time, a compile error occurs if this constraint is violated.
1935+ /// - At runtime, it is not checked.
1936+ /// - If the `ptr` is created in an another const, this intrinsic doesn't deallocate it.
1937+ /// - If the `ptr` is pointing to a local variable, this intrinsic doesn't deallocate it.
19241938 #[ rustc_const_unstable( feature = "const_heap" , issue = "79597" ) ]
19251939 #[ cfg( not( bootstrap) ) ]
19261940 pub fn const_deallocate ( ptr : * mut u8 , size : usize , align : usize ) ;
0 commit comments