Skip to content

Commit db9a53b

Browse files
committed
Constify mem::transmute_copy
1 parent 45988ee commit db9a53b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

library/core/src/mem/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,8 @@ pub fn drop<T>(_x: T) {}
933933
/// ```
934934
#[inline]
935935
#[stable(feature = "rust1", since = "1.0.0")]
936-
pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
936+
#[rustc_const_unstable(feature = "const_transmute_copy", issue = "83165")]
937+
pub const unsafe fn transmute_copy<T, U>(src: &T) -> U {
937938
// If U has a higher alignment requirement, src may not be suitably aligned.
938939
if align_of::<U>() > align_of::<T>() {
939940
// SAFETY: `src` is a reference which is guaranteed to be valid for reads.

0 commit comments

Comments
 (0)