improve doc test for UnsafeCell::raw_get and fix docs error

This commit is contained in:
gftea 2023-02-22 19:18:19 +01:00
parent d5833423a0
commit 1190c91a61
2 changed files with 3 additions and 1 deletions

View File

@ -2053,6 +2053,8 @@ pub const fn get_mut(&mut self) -> &mut T {
///
/// let m = MaybeUninit::<UnsafeCell<i32>>::uninit();
/// unsafe { UnsafeCell::raw_get(m.as_ptr()).write(5); }
/// // avoid below which references to uninitialized data
/// // unsafe { UnsafeCell::get(&*m.as_ptr()).write(5); }
/// let uc = unsafe { m.assume_init() };
///
/// assert_eq!(uc.into_inner(), 5);

View File

@ -138,7 +138,7 @@ pub fn location(&self) -> Option<&Location<'_>> {
/// whose ABI does not support unwinding.
///
/// It is safe for a panic handler to unwind even when this function returns
/// true, however this will simply cause the panic handler to be called
/// false, however this will simply cause the panic handler to be called
/// again.
#[must_use]
#[unstable(feature = "panic_can_unwind", issue = "92988")]