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" {
10041004 ///
10051005 /// The stabilized version of this intrinsic is
10061006 /// [`std::mem::size_of_val`](../../std/mem/fn.size_of_val.html).
1007+ #[ rustc_const_unstable( feature = "const_size_of_val" , issue = "46571" ) ]
10071008 pub fn size_of_val < T : ?Sized > ( _: * const T ) -> usize ;
10081009 /// The required alignment of the referenced value.
10091010 ///
10101011 /// The stabilized version of this intrinsic is
10111012 /// [`std::mem::align_of_val`](../../std/mem/fn.align_of_val.html).
1013+ #[ rustc_const_unstable( feature = "const_align_of_val" , issue = "46571" ) ]
10121014 pub fn min_align_of_val < T : ?Sized > ( _: * const T ) -> usize ;
10131015
10141016 /// Gets a static string slice containing the name of a type.
Original file line number Diff line number Diff line change 8888#![ feature( const_result) ]
8989#![ feature( const_slice_from_raw_parts) ]
9090#![ feature( const_slice_ptr_len) ]
91+ #![ feature( const_size_of_val) ]
92+ #![ feature( const_align_of_val) ]
9193#![ feature( const_type_name) ]
9294#![ feature( const_likely) ]
9395#![ 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 {
332332/// ```
333333#[ inline]
334334#[ 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 {
336337 intrinsics:: size_of_val ( val)
337338}
338339
@@ -466,9 +467,10 @@ pub const fn align_of<T>() -> usize {
466467/// ```
467468#[ inline]
468469#[ stable( feature = "rust1" , since = "1.0.0" ) ]
470+ #[ rustc_const_unstable( feature = "const_align_of_val" , issue = "46571" ) ]
469471#[ 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)
472474}
473475
474476/// 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