Skip to content

Commit 36c7d6d

Browse files
committed
CTFE: test size/align_of_val_raw on dangling pointers
1 parent 5de54d1 commit 36c7d6d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

core/src/mem/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,8 @@ pub const fn size_of_val<T: ?Sized>(val: &T) -> usize {
374374
/// ```
375375
#[inline]
376376
#[unstable(feature = "layout_for_ptr", issue = "69835")]
377-
pub unsafe fn size_of_val_raw<T: ?Sized>(val: *const T) -> usize {
377+
#[rustc_const_unstable(feature = "const_size_of_val_raw", issue = "46571")]
378+
pub const unsafe fn size_of_val_raw<T: ?Sized>(val: *const T) -> usize {
378379
intrinsics::size_of_val(val)
379380
}
380381

@@ -505,7 +506,8 @@ pub const fn align_of_val<T: ?Sized>(val: &T) -> usize {
505506
/// ```
506507
#[inline]
507508
#[unstable(feature = "layout_for_ptr", issue = "69835")]
508-
pub unsafe fn align_of_val_raw<T: ?Sized>(val: *const T) -> usize {
509+
#[rustc_const_unstable(feature = "const_align_of_val_raw", issue = "46571")]
510+
pub const unsafe fn align_of_val_raw<T: ?Sized>(val: *const T) -> usize {
509511
intrinsics::min_align_of_val(val)
510512
}
511513

0 commit comments

Comments
 (0)