a643e59800
Implement `RawWaker` and `Waker` getters for underlying pointers implement #87021 New APIs: - `RawWaker::data(&self) -> *const ()` - `RawWaker::vtable(&self) -> &'static RawWakerVTable` - ~`Waker::as_raw_waker(&self) -> &RawWaker`~ `Waker::as_raw(&self) -> &RawWaker` This third one is an auxiliary function to make the two APIs above more useful. Since we can only get `&Waker` in `Future::poll`, without this, we need to `transmute` it into `&RawWaker` (relying on `repr(transparent)`) in order to access its data/vtable pointers. ~Not sure if it should be named `as_raw` or `as_raw_waker`. Seems we always use `as_<something-raw>` instead of just `as_raw`. But `as_raw_waker` seems not quite consistent with `Waker::from_raw`.~ As suggested in https://github.com/rust-lang/rust/pull/91828#discussion_r770729837, use `as_raw`.
136 lines
3.1 KiB
Rust
136 lines
3.1 KiB
Rust
#![feature(alloc_layout_extra)]
|
|
#![feature(array_chunks)]
|
|
#![feature(array_methods)]
|
|
#![feature(array_windows)]
|
|
#![feature(bench_black_box)]
|
|
#![feature(bool_to_option)]
|
|
#![feature(box_syntax)]
|
|
#![feature(cell_update)]
|
|
#![feature(cfg_panic)]
|
|
#![feature(cfg_target_has_atomic)]
|
|
#![feature(const_assume)]
|
|
#![feature(const_black_box)]
|
|
#![feature(const_bool_to_option)]
|
|
#![feature(const_cell_into_inner)]
|
|
#![feature(const_convert)]
|
|
#![feature(const_heap)]
|
|
#![feature(const_maybe_uninit_as_mut_ptr)]
|
|
#![feature(const_maybe_uninit_assume_init)]
|
|
#![feature(const_maybe_uninit_assume_init_read)]
|
|
#![feature(const_nonnull_new)]
|
|
#![feature(const_num_from_num)]
|
|
#![feature(const_ptr_as_ref)]
|
|
#![feature(const_ptr_read)]
|
|
#![feature(const_ptr_write)]
|
|
#![feature(const_ptr_offset)]
|
|
#![feature(const_trait_impl)]
|
|
#![feature(const_likely)]
|
|
#![feature(core_intrinsics)]
|
|
#![feature(core_private_bignum)]
|
|
#![feature(core_private_diy_float)]
|
|
#![feature(dec2flt)]
|
|
#![feature(div_duration)]
|
|
#![feature(duration_consts_float)]
|
|
#![feature(duration_constants)]
|
|
#![feature(exact_size_is_empty)]
|
|
#![feature(extern_types)]
|
|
#![feature(flt2dec)]
|
|
#![feature(fmt_internals)]
|
|
#![feature(float_minimum_maximum)]
|
|
#![feature(future_join)]
|
|
#![feature(future_poll_fn)]
|
|
#![feature(array_from_fn)]
|
|
#![feature(hashmap_internals)]
|
|
#![feature(try_find)]
|
|
#![feature(inline_const)]
|
|
#![feature(is_sorted)]
|
|
#![feature(pattern)]
|
|
#![feature(sort_internals)]
|
|
#![feature(slice_take)]
|
|
#![feature(maybe_uninit_uninit_array)]
|
|
#![feature(maybe_uninit_array_assume_init)]
|
|
#![feature(maybe_uninit_write_slice)]
|
|
#![feature(min_specialization)]
|
|
#![feature(numfmt)]
|
|
#![feature(step_trait)]
|
|
#![feature(str_internals)]
|
|
#![feature(test)]
|
|
#![feature(trusted_len)]
|
|
#![feature(try_blocks)]
|
|
#![feature(try_trait_v2)]
|
|
#![feature(slice_internals)]
|
|
#![feature(slice_partition_dedup)]
|
|
#![feature(int_log)]
|
|
#![feature(iter_advance_by)]
|
|
#![feature(iter_partition_in_place)]
|
|
#![feature(iter_intersperse)]
|
|
#![feature(iter_is_partitioned)]
|
|
#![feature(iter_order_by)]
|
|
#![feature(iterator_try_reduce)]
|
|
#![feature(const_mut_refs)]
|
|
#![feature(const_pin)]
|
|
#![feature(const_slice_from_raw_parts)]
|
|
#![feature(never_type)]
|
|
#![feature(unwrap_infallible)]
|
|
#![feature(result_into_ok_or_err)]
|
|
#![feature(portable_simd)]
|
|
#![feature(ptr_metadata)]
|
|
#![feature(once_cell)]
|
|
#![feature(option_result_contains)]
|
|
#![feature(unsized_tuple_coercion)]
|
|
#![feature(const_option)]
|
|
#![feature(const_option_ext)]
|
|
#![feature(const_result)]
|
|
#![feature(integer_atomics)]
|
|
#![feature(int_roundings)]
|
|
#![feature(slice_group_by)]
|
|
#![feature(split_array)]
|
|
#![feature(trusted_random_access)]
|
|
#![feature(unsize)]
|
|
#![feature(unzip_option)]
|
|
#![feature(const_array_from_ref)]
|
|
#![feature(const_slice_from_ref)]
|
|
#![feature(waker_getters)]
|
|
#![deny(unsafe_op_in_unsafe_fn)]
|
|
|
|
extern crate test;
|
|
|
|
mod alloc;
|
|
mod any;
|
|
mod array;
|
|
mod ascii;
|
|
mod atomic;
|
|
mod bool;
|
|
mod cell;
|
|
mod char;
|
|
mod clone;
|
|
mod cmp;
|
|
mod const_ptr;
|
|
mod convert;
|
|
mod fmt;
|
|
mod future;
|
|
mod hash;
|
|
mod intrinsics;
|
|
mod iter;
|
|
mod lazy;
|
|
mod macros;
|
|
mod manually_drop;
|
|
mod mem;
|
|
mod nonzero;
|
|
mod num;
|
|
mod ops;
|
|
mod option;
|
|
mod pattern;
|
|
mod pin;
|
|
mod ptr;
|
|
mod result;
|
|
mod simd;
|
|
mod slice;
|
|
mod str;
|
|
mod str_lossy;
|
|
mod task;
|
|
mod time;
|
|
mod tuple;
|
|
mod unicode;
|
|
mod waker;
|