Give const_deallocate a default body
This commit is contained in:
parent
9a0743747f
commit
6b73fe2d09
4 changed files with 18 additions and 25 deletions
|
@ -1229,11 +1229,6 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
||||||
ret.write_cvalue(fx, CValue::by_val(cmp, ret.layout()));
|
ret.write_cvalue(fx, CValue::by_val(cmp, ret.layout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
sym::const_deallocate => {
|
|
||||||
intrinsic_args!(fx, args => (_ptr, _size, _align); intrinsic);
|
|
||||||
// nop at runtime.
|
|
||||||
}
|
|
||||||
|
|
||||||
sym::black_box => {
|
sym::black_box => {
|
||||||
intrinsic_args!(fx, args => (a); intrinsic);
|
intrinsic_args!(fx, args => (a); intrinsic);
|
||||||
|
|
||||||
|
|
|
@ -281,11 +281,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sym::const_deallocate => {
|
|
||||||
// nop at runtime.
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
|
|
||||||
// This requires that atomic intrinsics follow a specific naming pattern:
|
// This requires that atomic intrinsics follow a specific naming pattern:
|
||||||
// "atomic_<operation>[_<ordering>]"
|
// "atomic_<operation>[_<ordering>]"
|
||||||
name if let Some(atomic) = name_str.strip_prefix("atomic_") => {
|
name if let Some(atomic) = name_str.strip_prefix("atomic_") => {
|
||||||
|
|
|
@ -367,7 +367,7 @@ pub fn check_intrinsic_type(
|
||||||
}
|
}
|
||||||
sym::const_deallocate => (
|
sym::const_deallocate => (
|
||||||
0,
|
0,
|
||||||
0,
|
1,
|
||||||
vec![Ty::new_mut_ptr(tcx, tcx.types.u8), tcx.types.usize, tcx.types.usize],
|
vec![Ty::new_mut_ptr(tcx, tcx.types.u8), tcx.types.usize, tcx.types.usize],
|
||||||
Ty::new_unit(tcx),
|
Ty::new_unit(tcx),
|
||||||
),
|
),
|
||||||
|
|
|
@ -2368,20 +2368,6 @@ extern "rust-intrinsic" {
|
||||||
#[rustc_nounwind]
|
#[rustc_nounwind]
|
||||||
pub fn ptr_guaranteed_cmp<T>(ptr: *const T, other: *const T) -> u8;
|
pub fn ptr_guaranteed_cmp<T>(ptr: *const T, other: *const T) -> u8;
|
||||||
|
|
||||||
/// Deallocates a memory which allocated by `intrinsics::const_allocate` at compile time.
|
|
||||||
/// At runtime, does nothing.
|
|
||||||
///
|
|
||||||
/// # Safety
|
|
||||||
///
|
|
||||||
/// - The `align` argument must be a power of two.
|
|
||||||
/// - At compile time, a compile error occurs if this constraint is violated.
|
|
||||||
/// - At runtime, it is not checked.
|
|
||||||
/// - If the `ptr` is created in an another const, this intrinsic doesn't deallocate it.
|
|
||||||
/// - If the `ptr` is pointing to a local variable, this intrinsic doesn't deallocate it.
|
|
||||||
#[rustc_const_unstable(feature = "const_heap", issue = "79597")]
|
|
||||||
#[rustc_nounwind]
|
|
||||||
pub fn const_deallocate(ptr: *mut u8, size: usize, align: usize);
|
|
||||||
|
|
||||||
/// Determines whether the raw bytes of the two values are equal.
|
/// Determines whether the raw bytes of the two values are equal.
|
||||||
///
|
///
|
||||||
/// This is particularly handy for arrays, since it allows things like just
|
/// This is particularly handy for arrays, since it allows things like just
|
||||||
|
@ -2591,6 +2577,7 @@ pub(crate) const unsafe fn debug_assertions() -> bool {
|
||||||
/// - At compile time, a compile error occurs if this constraint is violated.
|
/// - At compile time, a compile error occurs if this constraint is violated.
|
||||||
/// - At runtime, it is not checked.
|
/// - At runtime, it is not checked.
|
||||||
#[rustc_const_unstable(feature = "const_heap", issue = "79597")]
|
#[rustc_const_unstable(feature = "const_heap", issue = "79597")]
|
||||||
|
#[unstable(feature = "core_intrinsics", issue = "none")]
|
||||||
#[rustc_nounwind]
|
#[rustc_nounwind]
|
||||||
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
|
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
|
||||||
pub const unsafe fn const_allocate(_size: usize, _align: usize) -> *mut u8 {
|
pub const unsafe fn const_allocate(_size: usize, _align: usize) -> *mut u8 {
|
||||||
|
@ -2598,6 +2585,22 @@ pub const unsafe fn const_allocate(_size: usize, _align: usize) -> *mut u8 {
|
||||||
crate::ptr::null_mut()
|
crate::ptr::null_mut()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Deallocates a memory which allocated by `intrinsics::const_allocate` at compile time.
|
||||||
|
/// At runtime, does nothing.
|
||||||
|
///
|
||||||
|
/// # Safety
|
||||||
|
///
|
||||||
|
/// - The `align` argument must be a power of two.
|
||||||
|
/// - At compile time, a compile error occurs if this constraint is violated.
|
||||||
|
/// - At runtime, it is not checked.
|
||||||
|
/// - If the `ptr` is created in an another const, this intrinsic doesn't deallocate it.
|
||||||
|
/// - If the `ptr` is pointing to a local variable, this intrinsic doesn't deallocate it.
|
||||||
|
#[rustc_const_unstable(feature = "const_heap", issue = "79597")]
|
||||||
|
#[unstable(feature = "core_intrinsics", issue = "none")]
|
||||||
|
#[rustc_nounwind]
|
||||||
|
#[cfg_attr(not(bootstrap), rustc_intrinsic)]
|
||||||
|
pub const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {}
|
||||||
|
|
||||||
// Some functions are defined here because they accidentally got made
|
// Some functions are defined here because they accidentally got made
|
||||||
// available in this module on stable. See <https://github.com/rust-lang/rust/issues/15702>.
|
// available in this module on stable. See <https://github.com/rust-lang/rust/issues/15702>.
|
||||||
// (`transmute` also falls into this category, but it cannot be wrapped due to the
|
// (`transmute` also falls into this category, but it cannot be wrapped due to the
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue