mirror of
https://github.com/openharmony/third_party_rust_ryu.git
synced 2026-07-19 19:13:31 -04:00
fix: correct old rust builds
This commit is contained in:
+8
-6
@@ -35,13 +35,15 @@ impl Buffer {
|
||||
#[inline]
|
||||
#[cfg_attr(feature = "no-panic", no_panic)]
|
||||
pub fn new() -> Self {
|
||||
// assume_init is safe here, since this is an array of MaybeUninit, which does not need
|
||||
// to be initialized.
|
||||
#[cfg(maybe_uninit)]
|
||||
let bytes = unsafe { MaybeUninit::uninit().assume_init() };
|
||||
#[cfg(not(maybe_uninit))]
|
||||
let bytes = unsafe { mem::uninitialized() };
|
||||
|
||||
Buffer {
|
||||
// assume_init is safe here, since this is an array of MaybeUninit, which does not need
|
||||
// to be initialized.
|
||||
#[cfg(maybe_uninit)]
|
||||
bytes: unsafe { MaybeUninit::uninit().assume_init() },
|
||||
#[cfg(not(maybe_uninit))]
|
||||
bytes: unsafe { mem::uninitialized() },
|
||||
bytes: bytes,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -221,11 +221,11 @@ pub fn d2d(ieee_mantissa: u64, ieee_exponent: u32) -> FloatingDecimal64 {
|
||||
#[cfg(maybe_uninit)]
|
||||
{ vp_uninit.as_mut_ptr() },
|
||||
#[cfg(not(maybe_uninit))]
|
||||
{ &mut vp as *mut u64 },
|
||||
{ &mut vp },
|
||||
#[cfg(maybe_uninit)]
|
||||
{ vm_uninit.as_mut_ptr() },
|
||||
#[cfg(not(maybe_uninit))]
|
||||
{ &mut vm as *mut u64 },
|
||||
{ &mut vm },
|
||||
mm_shift,
|
||||
);
|
||||
#[cfg(maybe_uninit)]
|
||||
@@ -272,11 +272,11 @@ pub fn d2d(ieee_mantissa: u64, ieee_exponent: u32) -> FloatingDecimal64 {
|
||||
#[cfg(maybe_uninit)]
|
||||
{ vp_uninit.as_mut_ptr() },
|
||||
#[cfg(not(maybe_uninit))]
|
||||
{ &mut vp as *mut u64 },
|
||||
{ &mut vp },
|
||||
#[cfg(maybe_uninit)]
|
||||
{ vm_uninit.as_mut_ptr() },
|
||||
#[cfg(not(maybe_uninit))]
|
||||
{ &mut vm as *mut u64 },
|
||||
{ &mut vm },
|
||||
mm_shift,
|
||||
);
|
||||
#[cfg(maybe_uninit)]
|
||||
|
||||
Reference in New Issue
Block a user