adjust some const_eval_select safety comments
This commit is contained in:
parent
15a4ed6937
commit
85558ad5b3
2 changed files with 6 additions and 6 deletions
|
@ -2068,8 +2068,8 @@ pub const unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: us
|
|||
#[cfg(debug_assertions)]
|
||||
const fn compiletime_check<T>(_src: *const T, _dst: *mut T, _count: usize) {}
|
||||
#[cfg(debug_assertions)]
|
||||
// SAFETY: runtime debug-assertions are a best-effort basis; it's fine to
|
||||
// not do them during compile time
|
||||
// SAFETY: As per our safety precondition, we may assume that the `abort` above is never reached.
|
||||
// Therefore, compiletime_check and runtime_check are observably equivalent.
|
||||
unsafe {
|
||||
const_eval_select((src, dst, count), compiletime_check, runtime_check);
|
||||
}
|
||||
|
@ -2159,8 +2159,8 @@ pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
|
|||
#[cfg(debug_assertions)]
|
||||
const fn compiletime_check<T>(_src: *const T, _dst: *mut T) {}
|
||||
#[cfg(debug_assertions)]
|
||||
// SAFETY: runtime debug-assertions are a best-effort basis; it's fine to
|
||||
// not do them during compile time
|
||||
// SAFETY: As per our safety precondition, we may assume that the `abort` above is never reached.
|
||||
// Therefore, compiletime_check and runtime_check are observably equivalent.
|
||||
unsafe {
|
||||
const_eval_select((src, dst), compiletime_check, runtime_check);
|
||||
}
|
||||
|
|
|
@ -149,8 +149,8 @@ const fn debug_check_data_len<T>(data: *const T, len: usize) {
|
|||
// it is not required for safety (the safety must be guatanteed by
|
||||
// the `from_raw_parts[_mut]` caller).
|
||||
//
|
||||
// Since the checks are not required, we ignore them in CTFE as they can't
|
||||
// be done there (alignment does not make much sense there).
|
||||
// As per our safety precondition, we may assume that assertion above never fails.
|
||||
// Therefore, noop and rt_check are observably equivalent.
|
||||
unsafe {
|
||||
crate::intrinsics::const_eval_select((data,), noop, rt_check);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue