Skip to content

Commit 6786fa7

Browse files
committed
Rename Waker::new_unchecked to Waker::from_raw
1 parent 01be78d commit 6786fa7

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/libcore/task/wake.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ impl Waker {
215215
// Don't call `drop` -- the waker will be consumed by `wake`.
216216
crate::mem::forget(self);
217217

218-
// SAFETY: This is safe because `Waker::new_unchecked` is the only way
218+
// SAFETY: This is safe because `Waker::from_raw` is the only way
219219
// to initialize `wake` and `data` requiring the user to acknowledge
220220
// that the contract of `RawWaker` is upheld.
221221
unsafe { (wake)(data) };
@@ -253,7 +253,7 @@ impl Waker {
253253
/// in [`RawWaker`]'s and [`RawWakerVTable`]'s documentation is not upheld.
254254
/// Therefore this method is unsafe.
255255
#[inline]
256-
pub unsafe fn new_unchecked(waker: RawWaker) -> Waker {
256+
pub unsafe fn from_raw(waker: RawWaker) -> Waker {
257257
Waker {
258258
waker,
259259
}
@@ -264,7 +264,7 @@ impl Clone for Waker {
264264
#[inline]
265265
fn clone(&self) -> Self {
266266
Waker {
267-
// SAFETY: This is safe because `Waker::new_unchecked` is the only way
267+
// SAFETY: This is safe because `Waker::from_raw` is the only way
268268
// to initialize `clone` and `data` requiring the user to acknowledge
269269
// that the contract of [`RawWaker`] is upheld.
270270
waker: unsafe { (self.waker.vtable.clone)(self.waker.data) },
@@ -275,7 +275,7 @@ impl Clone for Waker {
275275
impl Drop for Waker {
276276
#[inline]
277277
fn drop(&mut self) {
278-
// SAFETY: This is safe because `Waker::new_unchecked` is the only way
278+
// SAFETY: This is safe because `Waker::from_raw` is the only way
279279
// to initialize `drop` and `data` requiring the user to acknowledge
280280
// that the contract of `RawWaker` is upheld.
281281
unsafe { (self.waker.vtable.drop)(self.waker.data) }

src/test/run-pass/auxiliary/arc_wake.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub trait ArcWake {
3030
let ptr = Arc::into_raw(wake) as *const ();
3131

3232
unsafe {
33-
Waker::new_unchecked(RawWaker::new(ptr, waker_vtable!(Self)))
33+
Waker::from_raw(RawWaker::new(ptr, waker_vtable!(Self)))
3434
}
3535
}
3636
}

0 commit comments

Comments
 (0)