@@ -1914,13 +1914,27 @@ extern "rust-intrinsic" {
1914
1914
#[ rustc_const_unstable( feature = "const_raw_ptr_comparison" , issue = "53020" ) ]
1915
1915
pub fn ptr_guaranteed_ne < T > ( ptr : * const T , other : * const T ) -> bool ;
1916
1916
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.
1919
1925
#[ rustc_const_unstable( feature = "const_heap" , issue = "79597" ) ]
1920
1926
pub fn const_allocate ( size : usize , align : usize ) -> * mut u8 ;
1921
1927
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.
1924
1938
#[ rustc_const_unstable( feature = "const_heap" , issue = "79597" ) ]
1925
1939
#[ cfg( not( bootstrap) ) ]
1926
1940
pub fn const_deallocate ( ptr : * mut u8 , size : usize , align : usize ) ;
0 commit comments