Skip to content

Commit c17dc6c

Browse files
committed
embassy-executor: update to use stabilized waker_getters
waker_getters have been stabilized for 1.83. See rust-lang/rust#96992.
1 parent 164b3a9 commit c17dc6c

File tree

2 files changed

+1
-23
lines changed

2 files changed

+1
-23
lines changed

embassy-executor/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![cfg_attr(not(any(feature = "arch-std", feature = "arch-wasm")), no_std)]
2-
#![cfg_attr(feature = "nightly", feature(waker_getters))]
32
#![allow(clippy::new_without_default)]
43
#![doc = include_str!("../README.md")]
54
#![warn(missing_docs)]

embassy-executor/src/raw/waker.rs

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,7 @@ pub(crate) unsafe fn from_task(p: TaskRef) -> Waker {
3232
///
3333
/// Panics if the waker is not created by the Embassy executor.
3434
pub fn task_from_waker(waker: &Waker) -> TaskRef {
35-
let (vtable, data) = {
36-
#[cfg(not(feature = "nightly"))]
37-
{
38-
struct WakerHack {
39-
data: *const (),
40-
vtable: &'static RawWakerVTable,
41-
}
42-
43-
// safety: OK because WakerHack has the same layout as Waker.
44-
// This is not really guaranteed because the structs are `repr(Rust)`, it is
45-
// indeed the case in the current implementation.
46-
// TODO use waker_getters when stable. https://github.com/rust-lang/rust/issues/96992
47-
let hack: &WakerHack = unsafe { core::mem::transmute(waker) };
48-
(hack.vtable, hack.data)
49-
}
50-
51-
#[cfg(feature = "nightly")]
52-
{
53-
let raw_waker = waker.as_raw();
54-
(raw_waker.vtable(), raw_waker.data())
55-
}
56-
};
35+
let (vtable, data) = (waker.vtable(), waker.data());
5736

5837
if vtable != &VTABLE {
5938
panic!("Found waker not created by the Embassy executor. `embassy_time::Timer` only works with the Embassy executor.")

0 commit comments

Comments
 (0)