File tree Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -1004,11 +1004,13 @@ extern "rust-intrinsic" {
1004
1004
///
1005
1005
/// The stabilized version of this intrinsic is
1006
1006
/// [`std::mem::size_of_val`](../../std/mem/fn.size_of_val.html).
1007
+ #[ rustc_const_unstable( feature = "const_size_of_val" , issue = "46571" ) ]
1007
1008
pub fn size_of_val < T : ?Sized > ( _: * const T ) -> usize ;
1008
1009
/// The required alignment of the referenced value.
1009
1010
///
1010
1011
/// The stabilized version of this intrinsic is
1011
1012
/// [`std::mem::align_of_val`](../../std/mem/fn.align_of_val.html).
1013
+ #[ rustc_const_unstable( feature = "const_align_of_val" , issue = "46571" ) ]
1012
1014
pub fn min_align_of_val < T : ?Sized > ( _: * const T ) -> usize ;
1013
1015
1014
1016
/// Gets a static string slice containing the name of a type.
Original file line number Diff line number Diff line change 88
88
#![ feature( const_result) ]
89
89
#![ feature( const_slice_from_raw_parts) ]
90
90
#![ feature( const_slice_ptr_len) ]
91
+ #![ feature( const_size_of_val) ]
92
+ #![ feature( const_align_of_val) ]
91
93
#![ feature( const_type_name) ]
92
94
#![ feature( const_likely) ]
93
95
#![ feature( const_unreachable_unchecked) ]
Original file line number Diff line number Diff line change @@ -332,7 +332,8 @@ pub const fn size_of<T>() -> usize {
332
332
/// ```
333
333
#[ inline]
334
334
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
335
- pub fn size_of_val < T : ?Sized > ( val : & T ) -> usize {
335
+ #[ rustc_const_unstable( feature = "const_size_of_val" , issue = "46571" ) ]
336
+ pub const fn size_of_val < T : ?Sized > ( val : & T ) -> usize {
336
337
intrinsics:: size_of_val ( val)
337
338
}
338
339
@@ -466,9 +467,10 @@ pub const fn align_of<T>() -> usize {
466
467
/// ```
467
468
#[ inline]
468
469
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
470
+ #[ rustc_const_unstable( feature = "const_align_of_val" , issue = "46571" ) ]
469
471
#[ allow( deprecated) ]
470
- pub fn align_of_val < T : ?Sized > ( val : & T ) -> usize {
471
- min_align_of_val ( val)
472
+ pub const fn align_of_val < T : ?Sized > ( val : & T ) -> usize {
473
+ intrinsics :: min_align_of_val ( val)
472
474
}
473
475
474
476
/// Returns the [ABI]-required minimum alignment of the type of the value that `val` points to.
You can’t perform that action at this time.
0 commit comments