File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -685,6 +685,13 @@ pub const unsafe fn replace<T>(dst: *mut T, mut src: T) -> T {
685
685
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
686
686
#[ rustc_const_unstable( feature = "const_ptr_read" , issue = "80377" ) ]
687
687
pub const unsafe fn read < T > ( src : * const T ) -> T {
688
+ // We are calling the intrinsics directly to avoid function calls in the generated code
689
+ // as `intrinsics::copy_nonoverlapping` is a wrapper function.
690
+ extern "rust-intrinsic" {
691
+ #[ rustc_const_unstable( feature = "const_intrinsic_copy" , issue = "80697" ) ]
692
+ fn copy_nonoverlapping < T > ( src : * const T , dst : * mut T , count : usize ) ;
693
+ }
694
+
688
695
let mut tmp = MaybeUninit :: < T > :: uninit ( ) ;
689
696
// SAFETY: the caller must guarantee that `src` is valid for reads.
690
697
// `src` cannot overlap `tmp` because `tmp` was just allocated on
You can’t perform that action at this time.
0 commit comments