Skip to content

Commit a2f0cc6

Browse files
committed
Auto merge of #32550 - tbu-:pr_ref_cell_as_unsafe_cell, r=alexcrichton
Remove `unsafe` qualifier from `RefCell::as_unsafe_cell` This method is no longer unsafe because the field of `UnsafeCell` is no longer public.
2 parents e1195c2 + 4ddbd6b commit a2f0cc6

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/libcore/cell.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,6 @@ impl<T:Copy> Cell<T> {
216216

217217
/// Returns a reference to the underlying `UnsafeCell`.
218218
///
219-
/// # Safety
220-
///
221-
/// This function is `unsafe` because `UnsafeCell`'s field is public.
222-
///
223219
/// # Examples
224220
///
225221
/// ```
@@ -229,11 +225,11 @@ impl<T:Copy> Cell<T> {
229225
///
230226
/// let c = Cell::new(5);
231227
///
232-
/// let uc = unsafe { c.as_unsafe_cell() };
228+
/// let uc = c.as_unsafe_cell();
233229
/// ```
234230
#[inline]
235231
#[unstable(feature = "as_unsafe_cell", issue = "27708")]
236-
pub unsafe fn as_unsafe_cell(&self) -> &UnsafeCell<T> {
232+
pub fn as_unsafe_cell(&self) -> &UnsafeCell<T> {
237233
&self.value
238234
}
239235
}

0 commit comments

Comments
 (0)