File tree Expand file tree Collapse file tree 2 files changed +1
-23
lines changed Expand file tree Collapse file tree 2 files changed +1
-23
lines changed Original file line number Diff line number Diff line change 1
1
#![ cfg_attr( not( any( feature = "arch-std" , feature = "arch-wasm" ) ) , no_std) ]
2
- #![ cfg_attr( feature = "nightly" , feature( waker_getters) ) ]
3
2
#![ allow( clippy:: new_without_default) ]
4
3
#![ doc = include_str ! ( "../README.md" ) ]
5
4
#![ warn( missing_docs) ]
Original file line number Diff line number Diff line change @@ -32,28 +32,7 @@ pub(crate) unsafe fn from_task(p: TaskRef) -> Waker {
32
32
///
33
33
/// Panics if the waker is not created by the Embassy executor.
34
34
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 ( ) ) ;
57
36
58
37
if vtable != & VTABLE {
59
38
panic ! ( "Found waker not created by the Embassy executor. `embassy_time::Timer` only works with the Embassy executor." )
You can’t perform that action at this time.
0 commit comments