diff options
| author | Deadbeef <ent3rm4n@gmail.com> | 2022-08-23 00:07:26 +0000 |
|---|---|---|
| committer | Deadbeef <ent3rm4n@gmail.com> | 2022-09-04 20:35:23 +0800 |
| commit | 075084f772abbc53263fc946c047a01e0dd65f80 (patch) | |
| tree | 7097f458481e5bbd99cec69bd8ed02309b498bf5 /library/core/src/slice/raw.rs | |
| parent | 8521a8c92da6c0c845d4f6394e903651a227946a (diff) | |
| download | rust-075084f772abbc53263fc946c047a01e0dd65f80.tar.gz rust-075084f772abbc53263fc946c047a01e0dd65f80.zip | |
Make `const_eval_select` a real intrinsic
Diffstat (limited to 'library/core/src/slice/raw.rs')
| -rw-r--r-- | library/core/src/slice/raw.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/core/src/slice/raw.rs b/library/core/src/slice/raw.rs index 107e71ab68b..f1e8bc79bf4 100644 --- a/library/core/src/slice/raw.rs +++ b/library/core/src/slice/raw.rs @@ -90,7 +90,7 @@ use crate::ptr; pub const unsafe fn from_raw_parts<'a, T>(data: *const T, len: usize) -> &'a [T] { // SAFETY: the caller must uphold the safety contract for `from_raw_parts`. unsafe { - assert_unsafe_precondition!( + assert_unsafe_precondition!([T](data: *const T, len: usize) => is_aligned_and_not_null(data) && crate::mem::size_of::<T>().saturating_mul(len) <= isize::MAX as usize ); @@ -134,7 +134,7 @@ pub const unsafe fn from_raw_parts<'a, T>(data: *const T, len: usize) -> &'a [T] pub const unsafe fn from_raw_parts_mut<'a, T>(data: *mut T, len: usize) -> &'a mut [T] { // SAFETY: the caller must uphold the safety contract for `from_raw_parts_mut`. unsafe { - assert_unsafe_precondition!( + assert_unsafe_precondition!([T](data: *mut T, len: usize) => is_aligned_and_not_null(data) && crate::mem::size_of::<T>().saturating_mul(len) <= isize::MAX as usize ); |
