#[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);
}
#[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);
}
// 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);
}