Rollup merge of #108356 - gftea:master, r=workingjubilee
improve doc test for UnsafeCell::raw_get improve docs of public API `UnsafeCell::raw_get`
This commit is contained in:
commit
1063548a1a
2 changed files with 3 additions and 1 deletions
|
@ -2100,6 +2100,8 @@ impl<T: ?Sized> UnsafeCell<T> {
|
||||||
///
|
///
|
||||||
/// let m = MaybeUninit::<UnsafeCell<i32>>::uninit();
|
/// let m = MaybeUninit::<UnsafeCell<i32>>::uninit();
|
||||||
/// unsafe { UnsafeCell::raw_get(m.as_ptr()).write(5); }
|
/// 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() };
|
/// let uc = unsafe { m.assume_init() };
|
||||||
///
|
///
|
||||||
/// assert_eq!(uc.into_inner(), 5);
|
/// assert_eq!(uc.into_inner(), 5);
|
||||||
|
|
|
@ -134,7 +134,7 @@ impl<'a> PanicInfo<'a> {
|
||||||
/// whose ABI does not support unwinding.
|
/// whose ABI does not support unwinding.
|
||||||
///
|
///
|
||||||
/// It is safe for a panic handler to unwind even when this function returns
|
/// 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.
|
/// again.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[unstable(feature = "panic_can_unwind", issue = "92988")]
|
#[unstable(feature = "panic_can_unwind", issue = "92988")]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue