Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

io: avoid ptr->ref->ptr roundtrip in RegistrationSet #6929

Merged
merged 7 commits into from
Nov 16, 2024

Conversation

tiif
Copy link
Contributor

@tiif tiif commented Oct 23, 2024

Motivation

Fixes #6926

Solution

Pass &Arc<ScheduledIo>instead of &ScheduledIo to RegistrationSet::remove.

@tiif
Copy link
Contributor Author

tiif commented Oct 23, 2024

@Darksonn Unfortunately the miri test is still failing even after the fix. The error is still the same.

This is the error trace
    Finished `test` profile [unoptimized + debuginfo] target(s) in 0.16s
info: for the target platform, using target runner `/home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo-miri runner` defined by `target.cfg(all()).runner` specified by `--config`
info: for the host platform, using target runner `/home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo-miri runner` defined by `target.cfg(all()).runner` specified by `--config`
------------
 Nextest run ID 33330851-ce20-4860-8d5a-61cd39cf7e54 with nextest profile: default-miri
    Starting 2 tests across 1 binary (20 tests skipped)
        FAIL [   4.239s] tokio::io_async_fd try_new

--- STDOUT:              tokio::io_async_fd try_new ---

running 1 test
test try_new ... 
--- STDERR:              tokio::io_async_fd try_new ---
error: Undefined Behavior: trying to retag from <428321> for SharedReadWrite permission at alloc177965[0x0], but that tag does not exist in the borrow stack for this location
   --> /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs:383:18
    |
383 |         unsafe { &*self.as_ptr().cast_const() }
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |                  |
    |                  trying to retag from <428321> for SharedReadWrite permission at alloc177965[0x0], but that tag does not exist in the borrow stack for this location
    |                  this error occurs as part of retag at alloc177965[0x0..0x100]
    |
    = help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
    = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
help: <428321> was created by a SharedReadOnly retag at offsets [0xd0..0x30d]
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/registration_set.rs:120:45
    |
120 |         let _ = synced.registrations.remove(io.into());
    |                                             ^^^^^^^^^
    = note: BACKTRACE (of the first span) on thread `try_new`:
    = note: inside `std::ptr::NonNull::<alloc::sync::ArcInner<tokio::runtime::io::scheduled_io::ScheduledIo>>::as_ref::<'_>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs:383:18: 383:46
    = note: inside `std::sync::Arc::<tokio::runtime::io::scheduled_io::ScheduledIo>::inner` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:1869:18: 1869:35
    = note: inside `<std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo> as std::ops::Drop>::drop` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:2527:12: 2527:24
    = note: inside `std::ptr::drop_in_place::<std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo>> - shim(Some(std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo>))` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:521:1: 521:56
    = note: inside `std::ptr::drop_in_place::<std::option::Option<std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo>>> - shim(Some(std::option::Option<std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo>>))` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:521:1: 521:56
note: inside `tokio::runtime::io::registration_set::RegistrationSet::remove`
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/registration_set.rs:120:55
    |
120 |         let _ = synced.registrations.remove(io.into());
    |                                                       ^
note: inside `tokio::runtime::io::driver::Handle::add_source::<mio::sys::unix::sourcefd::SourceFd<'_>>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/driver.rs:227:17
    |
227 | /                 self.registrations
228 | |                     .remove(&mut self.synced.lock(), &scheduled_io)
    | |___________________________________________________________________^
note: inside closure
   --> tokio/tests/io_async_fd.rs:861:17
    |
861 |     let error = AsyncFd::try_new(original.clone()).unwrap_err();
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: inside `<std::pin::Pin<&mut dyn futures::Future<Output = ()>> as futures::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
    = note: inside `<std::pin::Pin<&mut std::pin::Pin<&mut dyn futures::Future<Output = ()>>> as futures::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:57
    |
729 | ...   crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
    |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::coop::with_budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn futures::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:107:5
    |
107 |     f()
    |     ^^^
note: inside `tokio::runtime::coop::budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn futures::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:73:5
    |
73  |     with_budget(Budget::initial(), f)
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:25
    |
729 | ...   crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::Context::enter::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn futures::Future<Output = ()>>>>::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:428:19
    |
428 |         let ret = f();
    |                   ^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:728:36
    |
728 |   ...   let (c, res) = context.enter(core, || {
    |  ______________________^
729 | | ...       crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
730 | | ...   });
    | |________^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:68
    |
807 | ...heduler(&self.context, || f(core, context));
    |                              ^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::context::scoped::Scoped::<tokio::runtime::scheduler::Context>::set::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn futures::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/context/scoped.rs:40:9
    |
40  |         f()
    |         ^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:26
    |
180 |         CONTEXT.with(|c| c.scheduler.set(v, f))
    |                          ^^^^^^^^^^^^^^^^^^^^^
    = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::try_with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn futures::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:283:12: 283:27
    = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn futures::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:260:9: 260:25
note: inside `tokio::runtime::context::set_scheduler::<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn futures::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:9
    |
180 |         CONTEXT.with(|c| c.scheduler.set(v, f))
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::CoreGuard::<'_>::enter::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn futures::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:27
    |
807 | ...t) = context::set_scheduler(&self.context, || f(core, context));
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:196:28
    |
196 |                     return core.block_on(future);
    |                            ^^^^^^^^^^^^^^^^^^^^^
note: inside `try_new`
   --> tokio/tests/io_async_fd.rs:864:5
    |
864 |     assert!(Arc::ptr_eq(&original, &returned));
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> tokio/tests/io_async_fd.rs:858:19
    |
857 | #[tokio::test]
    | -------------- in this procedural macro expansion
858 | async fn try_new() {
    |                   ^
    = note: this error originates in the attribute macro `::core::prelude::v1::test` which comes from the expansion of the attribute macro `tokio::test` (in Nightly builds, run with -Z macro-backtrace for more info)

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

error: aborting due to 1 previous error


   Canceling due to test failure: 1 test still running
        FAIL [   4.316s] tokio::io_async_fd try_with_interest

--- STDOUT:              tokio::io_async_fd try_with_interest ---

running 1 test
test try_with_interest ... 
--- STDERR:              tokio::io_async_fd try_with_interest ---
error: Undefined Behavior: trying to retag from <429517> for SharedReadWrite permission at alloc178670[0x0], but that tag does not exist in the borrow stack for this location
   --> /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs:383:18
    |
383 |         unsafe { &*self.as_ptr().cast_const() }
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |                  |
    |                  trying to retag from <429517> for SharedReadWrite permission at alloc178670[0x0], but that tag does not exist in the borrow stack for this location
    |                  this error occurs as part of retag at alloc178670[0x0..0x100]
    |
    = help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
    = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
help: <429517> was created by a SharedReadOnly retag at offsets [0xd0..0x30d]
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/registration_set.rs:120:45
    |
120 |         let _ = synced.registrations.remove(io.into());
    |                                             ^^^^^^^^^
    = note: BACKTRACE (of the first span) on thread `try_with_intere`:
    = note: inside `std::ptr::NonNull::<alloc::sync::ArcInner<tokio::runtime::io::scheduled_io::ScheduledIo>>::as_ref::<'_>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs:383:18: 383:46
    = note: inside `std::sync::Arc::<tokio::runtime::io::scheduled_io::ScheduledIo>::inner` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:1869:18: 1869:35
    = note: inside `<std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo> as std::ops::Drop>::drop` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:2527:12: 2527:24
    = note: inside `std::ptr::drop_in_place::<std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo>> - shim(Some(std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo>))` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:521:1: 521:56
    = note: inside `std::ptr::drop_in_place::<std::option::Option<std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo>>> - shim(Some(std::option::Option<std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo>>))` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:521:1: 521:56
note: inside `tokio::runtime::io::registration_set::RegistrationSet::remove`
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/registration_set.rs:120:55
    |
120 |         let _ = synced.registrations.remove(io.into());
    |                                                       ^
note: inside `tokio::runtime::io::driver::Handle::add_source::<mio::sys::unix::sourcefd::SourceFd<'_>>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/driver.rs:227:17
    |
227 | /                 self.registrations
228 | |                     .remove(&mut self.synced.lock(), &scheduled_io)
    | |___________________________________________________________________^
note: inside closure
   --> tokio/tests/io_async_fd.rs:871:17
    |
871 | ... = AsyncFd::try_with_interest(original.clone(), Interest::READABLE).un...
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: inside `<std::pin::Pin<&mut dyn futures::Future<Output = ()>> as futures::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
    = note: inside `<std::pin::Pin<&mut std::pin::Pin<&mut dyn futures::Future<Output = ()>>> as futures::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:57
    |
729 | ...   crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
    |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::coop::with_budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn futures::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:107:5
    |
107 |     f()
    |     ^^^
note: inside `tokio::runtime::coop::budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn futures::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:73:5
    |
73  |     with_budget(Budget::initial(), f)
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:25
    |
729 | ...   crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::Context::enter::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn futures::Future<Output = ()>>>>::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:428:19
    |
428 |         let ret = f();
    |                   ^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:728:36
    |
728 |   ...   let (c, res) = context.enter(core, || {
    |  ______________________^
729 | | ...       crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
730 | | ...   });
    | |________^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:68
    |
807 | ...heduler(&self.context, || f(core, context));
    |                              ^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::context::scoped::Scoped::<tokio::runtime::scheduler::Context>::set::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn futures::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/context/scoped.rs:40:9
    |
40  |         f()
    |         ^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:26
    |
180 |         CONTEXT.with(|c| c.scheduler.set(v, f))
    |                          ^^^^^^^^^^^^^^^^^^^^^
    = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::try_with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn futures::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:283:12: 283:27
    = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn futures::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:260:9: 260:25
note: inside `tokio::runtime::context::set_scheduler::<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn futures::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:9
    |
180 |         CONTEXT.with(|c| c.scheduler.set(v, f))
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::CoreGuard::<'_>::enter::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn futures::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:27
    |
807 | ...t) = context::set_scheduler(&self.context, || f(core, context));
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:196:28
    |
196 |                     return core.block_on(future);
    |                            ^^^^^^^^^^^^^^^^^^^^^
note: inside `try_with_interest`
   --> tokio/tests/io_async_fd.rs:874:5
    |
874 |     assert!(Arc::ptr_eq(&original, &returned));
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> tokio/tests/io_async_fd.rs:868:29
    |
867 | #[tokio::test]
    | -------------- in this procedural macro expansion
868 | async fn try_with_interest() {
    |                             ^
    = note: this error originates in the attribute macro `::core::prelude::v1::test` which comes from the expansion of the attribute macro `tokio::test` (in Nightly builds, run with -Z macro-backtrace for more info)

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

error: aborting due to 1 previous error


------------
     Summary [   4.319s] 2 tests run: 0 passed, 2 failed, 20 skipped
        FAIL [   4.239s] tokio::io_async_fd try_new
        FAIL [   4.316s] tokio::io_async_fd try_with_interest
error: test run failed

@Darksonn
Copy link
Contributor

Yeah ... also Handle::add_source does call token which should expose it. I guess the provenance is probably getting removed twice?

@tiif
Copy link
Contributor Author

tiif commented Oct 23, 2024

I am not exactly sure how to fix this, but I could take a closer look and try to make miri happy about it. In the meantime, feel free to push the fix to this branch or suggest anything :)

@tiif
Copy link
Contributor Author

tiif commented Nov 1, 2024

These tests passed when running with Tree borrow even before the change is applied.I suspect an error is thrown previously due to some quirks of Stacked Borrow. I will annotate the result on the tests in this PR.

@Darksonn
Copy link
Contributor

Darksonn commented Nov 1, 2024

Oh I see. That sounds tricky.

@tiif
Copy link
Contributor Author

tiif commented Nov 5, 2024

Current status:

I am trying to minimize the code that stacked borrow is complaining about and figure out what's going on underneath. But I might get to nowhere and ended up only annotating the test. This would for sure take some time and help is always welcomed. :)

@tiif
Copy link
Contributor Author

tiif commented Nov 12, 2024

Minimized try_new

#![warn(rust_2018_idioms)]
#![cfg(all(unix, feature = "full"))]

use std::os::unix::io::{AsRawFd, RawFd};
use std::sync::Arc;
use tokio::io::unix::AsyncFd;

#[derive(Debug, PartialEq, Eq)]
struct InvalidSource;

impl AsRawFd for InvalidSource {
    fn as_raw_fd(&self) -> RawFd {
        -1
    }
}

#[tokio::test]
async fn try_new() {
    let original = Arc::new(InvalidSource);
    let _error = AsyncFd::try_new(original);
}
Click here for allocation error trace
test try_new ... note: tracking was triggered
   --> /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:388:25
    |
388 |           let x: Box<_> = Box::new(ArcInner {
    |  _________________________^
389 | |             strong: atomic::AtomicUsize::new(1),
390 | |             weak: atomic::AtomicUsize::new(1),
391 | |             data,
392 | |         });
    | |__________^ created Rust heap allocation of 256 bytes (alignment 128 bytes) with id 164705
    |
    = note: BACKTRACE on thread `try_new`:
    = note: inside `std::sync::Arc::<tokio::runtime::io::scheduled_io::ScheduledIo>::new` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:388:25: 392:11
note: inside `tokio::runtime::io::registration_set::RegistrationSet::allocate`
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/registration_set.rs:61:19
    |
61  |         let ret = Arc::new(ScheduledIo::default());
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::io::driver::Handle::add_source::<mio::sys::unix::sourcefd::SourceFd<'_>>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/driver.rs:219:28
    |
219 |         let scheduled_io = self.registrations.allocate(&mut self.synced.lock())?;
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> tokio/tests/io_async_fd.rs:20:18
    |
20  |     let _error = AsyncFd::try_new(original);
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: inside `<std::pin::Pin<&mut dyn std::future::Future<Output = ()>> as std::future::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
    = note: inside `<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>> as std::future::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:57
    |
729 |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
    |                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::coop::with_budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:107:5
    |
107 |     f()
    |     ^^^
note: inside `tokio::runtime::coop::budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:73:5
    |
73  |     with_budget(Budget::initial(), f)
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:25
    |
729 |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::Context::enter::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:428:19
    |
428 |         let ret = f();
    |                   ^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:728:36
    |
728 |                       let (c, res) = context.enter(core, || {
    |  ____________________________________^
729 | |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
730 | |                     });
    | |______________________^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:68
    |
807 |         let (core, ret) = context::set_scheduler(&self.context, || f(core, context));
    |                                                                    ^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::context::scoped::Scoped::<tokio::runtime::scheduler::Context>::set::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/context/scoped.rs:40:9
    |
40  |         f()
    |         ^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:26
    |
180 |         CONTEXT.with(|c| c.scheduler.set(v, f))
    |                          ^^^^^^^^^^^^^^^^^^^^^
    = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::try_with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:283:12: 283:27
    = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:260:9: 260:25
note: inside `tokio::runtime::context::set_scheduler::<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:9
    |
180 |         CONTEXT.with(|c| c.scheduler.set(v, f))
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::CoreGuard::<'_>::enter::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:27
    |
807 |         let (core, ret) = context::set_scheduler(&self.context, || f(core, context));
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:196:28
    |
196 |                     return core.block_on(future);
    |                            ^^^^^^^^^^^^^^^^^^^^^
note: inside `try_new`
   --> tokio/tests/io_async_fd.rs:20:5
    |
20  |     let _error = AsyncFd::try_new(original);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> tokio/tests/io_async_fd.rs:18:19
    |
17  | #[tokio::test]
    | -------------- in this procedural macro expansion
18  | async fn try_new() {
    |                   ^
    = note: this note originates in the attribute macro `::core::prelude::v1::test` which comes from the expansion of the attribute macro `tokio::test` (in Nightly builds, run with -Z macro-backtrace for more info)

note: tracking was triggered
   --> /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:388:25
    |
388 |           let x: Box<_> = Box::new(ArcInner {
    |  _________________________^
389 | |             strong: atomic::AtomicUsize::new(1),
390 | |             weak: atomic::AtomicUsize::new(1),
391 | |             data,
392 | |         });
    | |__________^ write access to allocation with id 164705
    |
    = note: BACKTRACE on thread `try_new`:
    = note: inside `std::sync::Arc::<tokio::runtime::io::scheduled_io::ScheduledIo>::new` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:388:25: 392:11
note: inside `tokio::runtime::io::registration_set::RegistrationSet::allocate`
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/registration_set.rs:61:19
    |
61  |         let ret = Arc::new(ScheduledIo::default());
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::io::driver::Handle::add_source::<mio::sys::unix::sourcefd::SourceFd<'_>>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/driver.rs:219:28
    |
219 |         let scheduled_io = self.registrations.allocate(&mut self.synced.lock())?;
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> tokio/tests/io_async_fd.rs:20:18
    |
20  |     let _error = AsyncFd::try_new(original);
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: inside `<std::pin::Pin<&mut dyn std::future::Future<Output = ()>> as std::future::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
    = note: inside `<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>> as std::future::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:57
    |
729 |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
    |                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::coop::with_budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:107:5
    |
107 |     f()
    |     ^^^
note: inside `tokio::runtime::coop::budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:73:5
    |
73  |     with_budget(Budget::initial(), f)
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:25
    |
729 |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::Context::enter::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:428:19
    |
428 |         let ret = f();
    |                   ^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:728:36
    |
728 |                       let (c, res) = context.enter(core, || {
    |  ____________________________________^
729 | |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
730 | |                     });
    | |______________________^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:68
    |
807 |         let (core, ret) = context::set_scheduler(&self.context, || f(core, context));
    |                                                                    ^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::context::scoped::Scoped::<tokio::runtime::scheduler::Context>::set::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/context/scoped.rs:40:9
    |
40  |         f()
    |         ^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:26
    |
180 |         CONTEXT.with(|c| c.scheduler.set(v, f))
    |                          ^^^^^^^^^^^^^^^^^^^^^
    = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::try_with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:283:12: 283:27
    = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:260:9: 260:25
note: inside `tokio::runtime::context::set_scheduler::<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:9
    |
180 |         CONTEXT.with(|c| c.scheduler.set(v, f))
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::CoreGuard::<'_>::enter::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:27
    |
807 |         let (core, ret) = context::set_scheduler(&self.context, || f(core, context));
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:196:28
    |
196 |                     return core.block_on(future);
    |                            ^^^^^^^^^^^^^^^^^^^^^
note: inside `try_new`
   --> tokio/tests/io_async_fd.rs:20:5
    |
20  |     let _error = AsyncFd::try_new(original);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> tokio/tests/io_async_fd.rs:18:19
    |
17  | #[tokio::test]
    | -------------- in this procedural macro expansion
18  | async fn try_new() {
    |                   ^
    = note: this note originates in the attribute macro `::core::prelude::v1::test` which comes from the expansion of the attribute macro `tokio::test` (in Nightly builds, run with -Z macro-backtrace for more info)

note: tracking was triggered
    --> /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:2148:24
     |
2148 |         let old_size = self.inner().strong.fetch_add(1, Relaxed);
     |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ read access to allocation with id 164705
     |
     = note: BACKTRACE on thread `try_new`:
     = note: inside `<std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo> as std::clone::Clone>::clone` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:2148:24: 2148:65
note: inside `tokio::runtime::io::registration_set::RegistrationSet::allocate`
    --> /home/gh-tiif/tokio/tokio/src/runtime/io/registration_set.rs:64:41
     |
64   |         synced.registrations.push_front(ret.clone());
     |                                         ^^^^^^^^^^^
note: inside `tokio::runtime::io::driver::Handle::add_source::<mio::sys::unix::sourcefd::SourceFd<'_>>`
    --> /home/gh-tiif/tokio/tokio/src/runtime/io/driver.rs:219:28
     |
219  |         let scheduled_io = self.registrations.allocate(&mut self.synced.lock())?;
     |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
    --> tokio/tests/io_async_fd.rs:20:18
     |
20   |     let _error = AsyncFd::try_new(original);
     |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
     = note: inside `<std::pin::Pin<&mut dyn std::future::Future<Output = ()>> as std::future::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
     = note: inside `<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>> as std::future::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
note: inside closure
    --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:57
     |
729  |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
     |                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::coop::with_budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
    --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:107:5
     |
107  |     f()
     |     ^^^
note: inside `tokio::runtime::coop::budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
    --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:73:5
     |
73   |     with_budget(Budget::initial(), f)
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
    --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:25
     |
729  |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
     |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::Context::enter::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}}>`
    --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:428:19
     |
428  |         let ret = f();
     |                   ^^^
note: inside closure
    --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:728:36
     |
728  |                       let (c, res) = context.enter(core, || {
     |  ____________________________________^
729  | |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
730  | |                     });
     | |______________________^
note: inside closure
    --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:68
     |
807  |         let (core, ret) = context::set_scheduler(&self.context, || f(core, context));
     |                                                                    ^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::context::scoped::Scoped::<tokio::runtime::scheduler::Context>::set::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>`
    --> /home/gh-tiif/tokio/tokio/src/runtime/context/scoped.rs:40:9
     |
40   |         f()
     |         ^^^
note: inside closure
    --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:26
     |
180  |         CONTEXT.with(|c| c.scheduler.set(v, f))
     |                          ^^^^^^^^^^^^^^^^^^^^^
     = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::try_with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:283:12: 283:27
     = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:260:9: 260:25
note: inside `tokio::runtime::context::set_scheduler::<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>`
    --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:9
     |
180  |         CONTEXT.with(|c| c.scheduler.set(v, f))
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::CoreGuard::<'_>::enter::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>`
    --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:27
     |
807  |         let (core, ret) = context::set_scheduler(&self.context, || f(core, context));
     |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
    --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:196:28
     |
196  |                     return core.block_on(future);
     |                            ^^^^^^^^^^^^^^^^^^^^^
note: inside `try_new`
    --> tokio/tests/io_async_fd.rs:20:5
     |
20   |     let _error = AsyncFd::try_new(original);
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
    --> tokio/tests/io_async_fd.rs:18:19
     |
17   | #[tokio::test]
     | -------------- in this procedural macro expansion
18   | async fn try_new() {
     |                   ^
     = note: this note originates in the attribute macro `::core::prelude::v1::test` which comes from the expansion of the attribute macro `tokio::test` (in Nightly builds, run with -Z macro-backtrace for more info)

note: tracking was triggered
    --> /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:2148:24
     |
2148 |         let old_size = self.inner().strong.fetch_add(1, Relaxed);
     |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ write access to allocation with id 164705
     |
     = note: BACKTRACE on thread `try_new`:
     = note: inside `<std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo> as std::clone::Clone>::clone` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:2148:24: 2148:65
note: inside `tokio::runtime::io::registration_set::RegistrationSet::allocate`
    --> /home/gh-tiif/tokio/tokio/src/runtime/io/registration_set.rs:64:41
     |
64   |         synced.registrations.push_front(ret.clone());
     |                                         ^^^^^^^^^^^
note: inside `tokio::runtime::io::driver::Handle::add_source::<mio::sys::unix::sourcefd::SourceFd<'_>>`
    --> /home/gh-tiif/tokio/tokio/src/runtime/io/driver.rs:219:28
     |
219  |         let scheduled_io = self.registrations.allocate(&mut self.synced.lock())?;
     |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
    --> tokio/tests/io_async_fd.rs:20:18
     |
20   |     let _error = AsyncFd::try_new(original);
     |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
     = note: inside `<std::pin::Pin<&mut dyn std::future::Future<Output = ()>> as std::future::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
     = note: inside `<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>> as std::future::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
note: inside closure
    --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:57
     |
729  |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
     |                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::coop::with_budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
    --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:107:5
     |
107  |     f()
     |     ^^^
note: inside `tokio::runtime::coop::budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
    --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:73:5
     |
73   |     with_budget(Budget::initial(), f)
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
    --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:25
     |
729  |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
     |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::Context::enter::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}}>`
    --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:428:19
     |
428  |         let ret = f();
     |                   ^^^
note: inside closure
    --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:728:36
     |
728  |                       let (c, res) = context.enter(core, || {
     |  ____________________________________^
729  | |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
730  | |                     });
     | |______________________^
note: inside closure
    --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:68
     |
807  |         let (core, ret) = context::set_scheduler(&self.context, || f(core, context));
     |                                                                    ^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::context::scoped::Scoped::<tokio::runtime::scheduler::Context>::set::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>`
    --> /home/gh-tiif/tokio/tokio/src/runtime/context/scoped.rs:40:9
     |
40   |         f()
     |         ^^^
note: inside closure
    --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:26
     |
180  |         CONTEXT.with(|c| c.scheduler.set(v, f))
     |                          ^^^^^^^^^^^^^^^^^^^^^
     = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::try_with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:283:12: 283:27
     = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:260:9: 260:25
note: inside `tokio::runtime::context::set_scheduler::<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>`
    --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:9
     |
180  |         CONTEXT.with(|c| c.scheduler.set(v, f))
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::CoreGuard::<'_>::enter::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>`
    --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:27
     |
807  |         let (core, ret) = context::set_scheduler(&self.context, || f(core, context));
     |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
    --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:196:28
     |
196  |                     return core.block_on(future);
     |                            ^^^^^^^^^^^^^^^^^^^^^
note: inside `try_new`
    --> tokio/tests/io_async_fd.rs:20:5
     |
20   |     let _error = AsyncFd::try_new(original);
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
    --> tokio/tests/io_async_fd.rs:18:19
     |
17   | #[tokio::test]
     | -------------- in this procedural macro expansion
18   | async fn try_new() {
     |                   ^
     = note: this note originates in the attribute macro `::core::prelude::v1::test` which comes from the expansion of the attribute macro `tokio::test` (in Nightly builds, run with -Z macro-backtrace for more info)

note: tracking was triggered
   --> /home/gh-tiif/tokio/tokio/src/util/linked_list.rs:451:13
    |
451 |             ptr::addr_of_mut!((*self.inner.get()).next).write(value);
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ write access to allocation with id 164705
    |
    = note: BACKTRACE on thread `try_new`:
    = note: inside `tokio::util::linked_list::Pointers::<tokio::runtime::io::scheduled_io::ScheduledIo>::set_next` at /home/gh-tiif/tokio/tokio/src/util/linked_list.rs:451:13: 451:69
note: inside `tokio::util::linked_list::LinkedList::<std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo>, <std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo> as tokio::util::linked_list::Link>::Target>::push_front`
   --> /home/gh-tiif/tokio/tokio/src/util/linked_list.rs:125:13
    |
125 |             L::pointers(ptr).as_mut().set_next(self.head);
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::io::registration_set::RegistrationSet::allocate`
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/registration_set.rs:64:9
    |
64  |         synced.registrations.push_front(ret.clone());
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::io::driver::Handle::add_source::<mio::sys::unix::sourcefd::SourceFd<'_>>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/driver.rs:219:28
    |
219 |         let scheduled_io = self.registrations.allocate(&mut self.synced.lock())?;
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> tokio/tests/io_async_fd.rs:20:18
    |
20  |     let _error = AsyncFd::try_new(original);
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: inside `<std::pin::Pin<&mut dyn std::future::Future<Output = ()>> as std::future::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
    = note: inside `<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>> as std::future::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:57
    |
729 |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
    |                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::coop::with_budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:107:5
    |
107 |     f()
    |     ^^^
note: inside `tokio::runtime::coop::budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:73:5
    |
73  |     with_budget(Budget::initial(), f)
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:25
    |
729 |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::Context::enter::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:428:19
    |
428 |         let ret = f();
    |                   ^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:728:36
    |
728 |                       let (c, res) = context.enter(core, || {
    |  ____________________________________^
729 | |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
730 | |                     });
    | |______________________^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:68
    |
807 |         let (core, ret) = context::set_scheduler(&self.context, || f(core, context));
    |                                                                    ^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::context::scoped::Scoped::<tokio::runtime::scheduler::Context>::set::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/context/scoped.rs:40:9
    |
40  |         f()
    |         ^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:26
    |
180 |         CONTEXT.with(|c| c.scheduler.set(v, f))
    |                          ^^^^^^^^^^^^^^^^^^^^^
    = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::try_with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:283:12: 283:27
    = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:260:9: 260:25
note: inside `tokio::runtime::context::set_scheduler::<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:9
    |
180 |         CONTEXT.with(|c| c.scheduler.set(v, f))
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::CoreGuard::<'_>::enter::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:27
    |
807 |         let (core, ret) = context::set_scheduler(&self.context, || f(core, context));
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:196:28
    |
196 |                     return core.block_on(future);
    |                            ^^^^^^^^^^^^^^^^^^^^^
note: inside `try_new`
   --> tokio/tests/io_async_fd.rs:20:5
    |
20  |     let _error = AsyncFd::try_new(original);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> tokio/tests/io_async_fd.rs:18:19
    |
17  | #[tokio::test]
    | -------------- in this procedural macro expansion
18  | async fn try_new() {
    |                   ^
    = note: this note originates in the attribute macro `::core::prelude::v1::test` which comes from the expansion of the attribute macro `tokio::test` (in Nightly builds, run with -Z macro-backtrace for more info)

note: tracking was triggered
   --> /home/gh-tiif/tokio/tokio/src/util/linked_list.rs:445:13
    |
445 |             ptr::addr_of_mut!((*self.inner.get()).prev).write(value);
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ write access to allocation with id 164705
    |
    = note: BACKTRACE on thread `try_new`:
    = note: inside `tokio::util::linked_list::Pointers::<tokio::runtime::io::scheduled_io::ScheduledIo>::set_prev` at /home/gh-tiif/tokio/tokio/src/util/linked_list.rs:445:13: 445:69
note: inside `tokio::util::linked_list::LinkedList::<std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo>, <std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo> as tokio::util::linked_list::Link>::Target>::push_front`
   --> /home/gh-tiif/tokio/tokio/src/util/linked_list.rs:126:13
    |
126 |             L::pointers(ptr).as_mut().set_prev(None);
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::io::registration_set::RegistrationSet::allocate`
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/registration_set.rs:64:9
    |
64  |         synced.registrations.push_front(ret.clone());
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::io::driver::Handle::add_source::<mio::sys::unix::sourcefd::SourceFd<'_>>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/driver.rs:219:28
    |
219 |         let scheduled_io = self.registrations.allocate(&mut self.synced.lock())?;
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> tokio/tests/io_async_fd.rs:20:18
    |
20  |     let _error = AsyncFd::try_new(original);
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: inside `<std::pin::Pin<&mut dyn std::future::Future<Output = ()>> as std::future::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
    = note: inside `<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>> as std::future::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:57
    |
729 |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
    |                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::coop::with_budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:107:5
    |
107 |     f()
    |     ^^^
note: inside `tokio::runtime::coop::budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:73:5
    |
73  |     with_budget(Budget::initial(), f)
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:25
    |
729 |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::Context::enter::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:428:19
    |
428 |         let ret = f();
    |                   ^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:728:36
    |
728 |                       let (c, res) = context.enter(core, || {
    |  ____________________________________^
729 | |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
730 | |                     });
    | |______________________^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:68
    |
807 |         let (core, ret) = context::set_scheduler(&self.context, || f(core, context));
    |                                                                    ^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::context::scoped::Scoped::<tokio::runtime::scheduler::Context>::set::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/context/scoped.rs:40:9
    |
40  |         f()
    |         ^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:26
    |
180 |         CONTEXT.with(|c| c.scheduler.set(v, f))
    |                          ^^^^^^^^^^^^^^^^^^^^^
    = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::try_with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:283:12: 283:27
    = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:260:9: 260:25
note: inside `tokio::runtime::context::set_scheduler::<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:9
    |
180 |         CONTEXT.with(|c| c.scheduler.set(v, f))
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::CoreGuard::<'_>::enter::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:27
    |
807 |         let (core, ret) = context::set_scheduler(&self.context, || f(core, context));
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:196:28
    |
196 |                     return core.block_on(future);
    |                            ^^^^^^^^^^^^^^^^^^^^^
note: inside `try_new`
   --> tokio/tests/io_async_fd.rs:20:5
    |
20  |     let _error = AsyncFd::try_new(original);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> tokio/tests/io_async_fd.rs:18:19
    |
17  | #[tokio::test]
    | -------------- in this procedural macro expansion
18  | async fn try_new() {
    |                   ^
    = note: this note originates in the attribute macro `::core::prelude::v1::test` which comes from the expansion of the attribute macro `tokio::test` (in Nightly builds, run with -Z macro-backtrace for more info)

note: tracking was triggered
   --> /home/gh-tiif/tokio/tokio/src/util/linked_list.rs:435:18
    |
435 |         unsafe { ptr::addr_of!((*self.inner.get()).prev).read() }
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ read access to allocation with id 164705
    |
    = note: BACKTRACE on thread `try_new`:
    = note: inside `tokio::util::linked_list::Pointers::<tokio::runtime::io::scheduled_io::ScheduledIo>::get_prev` at /home/gh-tiif/tokio/tokio/src/util/linked_list.rs:435:18: 435:64
note: inside `tokio::util::linked_list::LinkedList::<std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo>, <std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo> as tokio::util::linked_list::Link>::Target>::remove`
   --> /home/gh-tiif/tokio/tokio/src/util/linked_list.rs:201:29
    |
201 |         if let Some(prev) = L::pointers(node).as_ref().get_prev() {
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::io::registration_set::RegistrationSet::remove`
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/registration_set.rs:118:17
    |
118 |         let _ = synced.registrations.remove(io.into());
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::io::driver::Handle::add_source::<mio::sys::unix::sourcefd::SourceFd<'_>>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/driver.rs:227:17
    |
227 | /                 self.registrations
228 | |                     .remove(&mut self.synced.lock(), &scheduled_io)
    | |___________________________________________________________________^
note: inside closure
   --> tokio/tests/io_async_fd.rs:20:18
    |
20  |     let _error = AsyncFd::try_new(original);
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: inside `<std::pin::Pin<&mut dyn std::future::Future<Output = ()>> as std::future::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
    = note: inside `<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>> as std::future::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:57
    |
729 |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
    |                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::coop::with_budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:107:5
    |
107 |     f()
    |     ^^^
note: inside `tokio::runtime::coop::budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:73:5
    |
73  |     with_budget(Budget::initial(), f)
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:25
    |
729 |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::Context::enter::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:428:19
    |
428 |         let ret = f();
    |                   ^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:728:36
    |
728 |                       let (c, res) = context.enter(core, || {
    |  ____________________________________^
729 | |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
730 | |                     });
    | |______________________^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:68
    |
807 |         let (core, ret) = context::set_scheduler(&self.context, || f(core, context));
    |                                                                    ^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::context::scoped::Scoped::<tokio::runtime::scheduler::Context>::set::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/context/scoped.rs:40:9
    |
40  |         f()
    |         ^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:26
    |
180 |         CONTEXT.with(|c| c.scheduler.set(v, f))
    |                          ^^^^^^^^^^^^^^^^^^^^^
    = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::try_with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:283:12: 283:27
    = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:260:9: 260:25
note: inside `tokio::runtime::context::set_scheduler::<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:9
    |
180 |         CONTEXT.with(|c| c.scheduler.set(v, f))
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::CoreGuard::<'_>::enter::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:27
    |
807 |         let (core, ret) = context::set_scheduler(&self.context, || f(core, context));
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:196:28
    |
196 |                     return core.block_on(future);
    |                            ^^^^^^^^^^^^^^^^^^^^^
note: inside `try_new`
   --> tokio/tests/io_async_fd.rs:20:5
    |
20  |     let _error = AsyncFd::try_new(original);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> tokio/tests/io_async_fd.rs:18:19
    |
17  | #[tokio::test]
    | -------------- in this procedural macro expansion
18  | async fn try_new() {
    |                   ^
    = note: this note originates in the attribute macro `::core::prelude::v1::test` which comes from the expansion of the attribute macro `tokio::test` (in Nightly builds, run with -Z macro-backtrace for more info)

note: tracking was triggered
   --> /home/gh-tiif/tokio/tokio/src/util/linked_list.rs:439:18
    |
439 |         unsafe { ptr::addr_of!((*self.inner.get()).next).read() }
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ read access to allocation with id 164705
    |
    = note: BACKTRACE on thread `try_new`:
    = note: inside `tokio::util::linked_list::Pointers::<tokio::runtime::io::scheduled_io::ScheduledIo>::get_next` at /home/gh-tiif/tokio/tokio/src/util/linked_list.rs:439:18: 439:64
note: inside `tokio::util::linked_list::LinkedList::<std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo>, <std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo> as tokio::util::linked_list::Link>::Target>::remove`
   --> /home/gh-tiif/tokio/tokio/src/util/linked_list.rs:211:25
    |
211 |             self.head = L::pointers(node).as_ref().get_next();
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::io::registration_set::RegistrationSet::remove`
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/registration_set.rs:118:17
    |
118 |         let _ = synced.registrations.remove(io.into());
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::io::driver::Handle::add_source::<mio::sys::unix::sourcefd::SourceFd<'_>>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/driver.rs:227:17
    |
227 | /                 self.registrations
228 | |                     .remove(&mut self.synced.lock(), &scheduled_io)
    | |___________________________________________________________________^
note: inside closure
   --> tokio/tests/io_async_fd.rs:20:18
    |
20  |     let _error = AsyncFd::try_new(original);
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: inside `<std::pin::Pin<&mut dyn std::future::Future<Output = ()>> as std::future::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
    = note: inside `<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>> as std::future::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:57
    |
729 |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
    |                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::coop::with_budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:107:5
    |
107 |     f()
    |     ^^^
note: inside `tokio::runtime::coop::budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:73:5
    |
73  |     with_budget(Budget::initial(), f)
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:25
    |
729 |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::Context::enter::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:428:19
    |
428 |         let ret = f();
    |                   ^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:728:36
    |
728 |                       let (c, res) = context.enter(core, || {
    |  ____________________________________^
729 | |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
730 | |                     });
    | |______________________^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:68
    |
807 |         let (core, ret) = context::set_scheduler(&self.context, || f(core, context));
    |                                                                    ^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::context::scoped::Scoped::<tokio::runtime::scheduler::Context>::set::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/context/scoped.rs:40:9
    |
40  |         f()
    |         ^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:26
    |
180 |         CONTEXT.with(|c| c.scheduler.set(v, f))
    |                          ^^^^^^^^^^^^^^^^^^^^^
    = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::try_with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:283:12: 283:27
    = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:260:9: 260:25
note: inside `tokio::runtime::context::set_scheduler::<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:9
    |
180 |         CONTEXT.with(|c| c.scheduler.set(v, f))
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::CoreGuard::<'_>::enter::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:27
    |
807 |         let (core, ret) = context::set_scheduler(&self.context, || f(core, context));
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:196:28
    |
196 |                     return core.block_on(future);
    |                            ^^^^^^^^^^^^^^^^^^^^^
note: inside `try_new`
   --> tokio/tests/io_async_fd.rs:20:5
    |
20  |     let _error = AsyncFd::try_new(original);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> tokio/tests/io_async_fd.rs:18:19
    |
17  | #[tokio::test]
    | -------------- in this procedural macro expansion
18  | async fn try_new() {
    |                   ^
    = note: this note originates in the attribute macro `::core::prelude::v1::test` which comes from the expansion of the attribute macro `tokio::test` (in Nightly builds, run with -Z macro-backtrace for more info)

note: tracking was triggered
   --> /home/gh-tiif/tokio/tokio/src/util/linked_list.rs:439:18
    |
439 |         unsafe { ptr::addr_of!((*self.inner.get()).next).read() }
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ read access to allocation with id 164705
    |
    = note: BACKTRACE on thread `try_new`:
    = note: inside `tokio::util::linked_list::Pointers::<tokio::runtime::io::scheduled_io::ScheduledIo>::get_next` at /home/gh-tiif/tokio/tokio/src/util/linked_list.rs:439:18: 439:64
note: inside `tokio::util::linked_list::LinkedList::<std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo>, <std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo> as tokio::util::linked_list::Link>::Target>::remove`
   --> /home/gh-tiif/tokio/tokio/src/util/linked_list.rs:214:29
    |
214 |         if let Some(next) = L::pointers(node).as_ref().get_next() {
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::io::registration_set::RegistrationSet::remove`
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/registration_set.rs:118:17
    |
118 |         let _ = synced.registrations.remove(io.into());
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::io::driver::Handle::add_source::<mio::sys::unix::sourcefd::SourceFd<'_>>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/driver.rs:227:17
    |
227 | /                 self.registrations
228 | |                     .remove(&mut self.synced.lock(), &scheduled_io)
    | |___________________________________________________________________^
note: inside closure
   --> tokio/tests/io_async_fd.rs:20:18
    |
20  |     let _error = AsyncFd::try_new(original);
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: inside `<std::pin::Pin<&mut dyn std::future::Future<Output = ()>> as std::future::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
    = note: inside `<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>> as std::future::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:57
    |
729 |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
    |                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::coop::with_budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:107:5
    |
107 |     f()
    |     ^^^
note: inside `tokio::runtime::coop::budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:73:5
    |
73  |     with_budget(Budget::initial(), f)
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:25
    |
729 |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::Context::enter::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:428:19
    |
428 |         let ret = f();
    |                   ^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:728:36
    |
728 |                       let (c, res) = context.enter(core, || {
    |  ____________________________________^
729 | |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
730 | |                     });
    | |______________________^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:68
    |
807 |         let (core, ret) = context::set_scheduler(&self.context, || f(core, context));
    |                                                                    ^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::context::scoped::Scoped::<tokio::runtime::scheduler::Context>::set::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/context/scoped.rs:40:9
    |
40  |         f()
    |         ^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:26
    |
180 |         CONTEXT.with(|c| c.scheduler.set(v, f))
    |                          ^^^^^^^^^^^^^^^^^^^^^
    = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::try_with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:283:12: 283:27
    = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:260:9: 260:25
note: inside `tokio::runtime::context::set_scheduler::<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:9
    |
180 |         CONTEXT.with(|c| c.scheduler.set(v, f))
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::CoreGuard::<'_>::enter::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:27
    |
807 |         let (core, ret) = context::set_scheduler(&self.context, || f(core, context));
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:196:28
    |
196 |                     return core.block_on(future);
    |                            ^^^^^^^^^^^^^^^^^^^^^
note: inside `try_new`
   --> tokio/tests/io_async_fd.rs:20:5
    |
20  |     let _error = AsyncFd::try_new(original);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> tokio/tests/io_async_fd.rs:18:19
    |
17  | #[tokio::test]
    | -------------- in this procedural macro expansion
18  | async fn try_new() {
    |                   ^
    = note: this note originates in the attribute macro `::core::prelude::v1::test` which comes from the expansion of the attribute macro `tokio::test` (in Nightly builds, run with -Z macro-backtrace for more info)

note: tracking was triggered
   --> /home/gh-tiif/tokio/tokio/src/util/linked_list.rs:435:18
    |
435 |         unsafe { ptr::addr_of!((*self.inner.get()).prev).read() }
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ read access to allocation with id 164705
    |
    = note: BACKTRACE on thread `try_new`:
    = note: inside `tokio::util::linked_list::Pointers::<tokio::runtime::io::scheduled_io::ScheduledIo>::get_prev` at /home/gh-tiif/tokio/tokio/src/util/linked_list.rs:435:18: 435:64
note: inside `tokio::util::linked_list::LinkedList::<std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo>, <std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo> as tokio::util::linked_list::Link>::Target>::remove`
   --> /home/gh-tiif/tokio/tokio/src/util/linked_list.rs:225:25
    |
225 |             self.tail = L::pointers(node).as_ref().get_prev();
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::io::registration_set::RegistrationSet::remove`
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/registration_set.rs:118:17
    |
118 |         let _ = synced.registrations.remove(io.into());
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::io::driver::Handle::add_source::<mio::sys::unix::sourcefd::SourceFd<'_>>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/driver.rs:227:17
    |
227 | /                 self.registrations
228 | |                     .remove(&mut self.synced.lock(), &scheduled_io)
    | |___________________________________________________________________^
note: inside closure
   --> tokio/tests/io_async_fd.rs:20:18
    |
20  |     let _error = AsyncFd::try_new(original);
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: inside `<std::pin::Pin<&mut dyn std::future::Future<Output = ()>> as std::future::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
    = note: inside `<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>> as std::future::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:57
    |
729 |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
    |                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::coop::with_budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:107:5
    |
107 |     f()
    |     ^^^
note: inside `tokio::runtime::coop::budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:73:5
    |
73  |     with_budget(Budget::initial(), f)
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:25
    |
729 |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::Context::enter::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:428:19
    |
428 |         let ret = f();
    |                   ^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:728:36
    |
728 |                       let (c, res) = context.enter(core, || {
    |  ____________________________________^
729 | |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
730 | |                     });
    | |______________________^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:68
    |
807 |         let (core, ret) = context::set_scheduler(&self.context, || f(core, context));
    |                                                                    ^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::context::scoped::Scoped::<tokio::runtime::scheduler::Context>::set::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/context/scoped.rs:40:9
    |
40  |         f()
    |         ^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:26
    |
180 |         CONTEXT.with(|c| c.scheduler.set(v, f))
    |                          ^^^^^^^^^^^^^^^^^^^^^
    = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::try_with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:283:12: 283:27
    = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:260:9: 260:25
note: inside `tokio::runtime::context::set_scheduler::<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:9
    |
180 |         CONTEXT.with(|c| c.scheduler.set(v, f))
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::CoreGuard::<'_>::enter::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:27
    |
807 |         let (core, ret) = context::set_scheduler(&self.context, || f(core, context));
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:196:28
    |
196 |                     return core.block_on(future);
    |                            ^^^^^^^^^^^^^^^^^^^^^
note: inside `try_new`
   --> tokio/tests/io_async_fd.rs:20:5
    |
20  |     let _error = AsyncFd::try_new(original);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> tokio/tests/io_async_fd.rs:18:19
    |
17  | #[tokio::test]
    | -------------- in this procedural macro expansion
18  | async fn try_new() {
    |                   ^
    = note: this note originates in the attribute macro `::core::prelude::v1::test` which comes from the expansion of the attribute macro `tokio::test` (in Nightly builds, run with -Z macro-backtrace for more info)

note: tracking was triggered
   --> /home/gh-tiif/tokio/tokio/src/util/linked_list.rs:451:13
    |
451 |             ptr::addr_of_mut!((*self.inner.get()).next).write(value);
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ write access to allocation with id 164705
    |
    = note: BACKTRACE on thread `try_new`:
    = note: inside `tokio::util::linked_list::Pointers::<tokio::runtime::io::scheduled_io::ScheduledIo>::set_next` at /home/gh-tiif/tokio/tokio/src/util/linked_list.rs:451:13: 451:69
note: inside `tokio::util::linked_list::LinkedList::<std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo>, <std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo> as tokio::util::linked_list::Link>::Target>::remove`
   --> /home/gh-tiif/tokio/tokio/src/util/linked_list.rs:228:9
    |
228 |         L::pointers(node).as_mut().set_next(None);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::io::registration_set::RegistrationSet::remove`
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/registration_set.rs:118:17
    |
118 |         let _ = synced.registrations.remove(io.into());
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::io::driver::Handle::add_source::<mio::sys::unix::sourcefd::SourceFd<'_>>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/driver.rs:227:17
    |
227 | /                 self.registrations
228 | |                     .remove(&mut self.synced.lock(), &scheduled_io)
    | |___________________________________________________________________^
note: inside closure
   --> tokio/tests/io_async_fd.rs:20:18
    |
20  |     let _error = AsyncFd::try_new(original);
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: inside `<std::pin::Pin<&mut dyn std::future::Future<Output = ()>> as std::future::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
    = note: inside `<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>> as std::future::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:57
    |
729 |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
    |                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::coop::with_budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:107:5
    |
107 |     f()
    |     ^^^
note: inside `tokio::runtime::coop::budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:73:5
    |
73  |     with_budget(Budget::initial(), f)
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:25
    |
729 |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::Context::enter::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:428:19
    |
428 |         let ret = f();
    |                   ^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:728:36
    |
728 |                       let (c, res) = context.enter(core, || {
    |  ____________________________________^
729 | |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
730 | |                     });
    | |______________________^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:68
    |
807 |         let (core, ret) = context::set_scheduler(&self.context, || f(core, context));
    |                                                                    ^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::context::scoped::Scoped::<tokio::runtime::scheduler::Context>::set::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/context/scoped.rs:40:9
    |
40  |         f()
    |         ^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:26
    |
180 |         CONTEXT.with(|c| c.scheduler.set(v, f))
    |                          ^^^^^^^^^^^^^^^^^^^^^
    = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::try_with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:283:12: 283:27
    = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:260:9: 260:25
note: inside `tokio::runtime::context::set_scheduler::<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:9
    |
180 |         CONTEXT.with(|c| c.scheduler.set(v, f))
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::CoreGuard::<'_>::enter::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:27
    |
807 |         let (core, ret) = context::set_scheduler(&self.context, || f(core, context));
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:196:28
    |
196 |                     return core.block_on(future);
    |                            ^^^^^^^^^^^^^^^^^^^^^
note: inside `try_new`
   --> tokio/tests/io_async_fd.rs:20:5
    |
20  |     let _error = AsyncFd::try_new(original);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> tokio/tests/io_async_fd.rs:18:19
    |
17  | #[tokio::test]
    | -------------- in this procedural macro expansion
18  | async fn try_new() {
    |                   ^
    = note: this note originates in the attribute macro `::core::prelude::v1::test` which comes from the expansion of the attribute macro `tokio::test` (in Nightly builds, run with -Z macro-backtrace for more info)

note: tracking was triggered
   --> /home/gh-tiif/tokio/tokio/src/util/linked_list.rs:445:13
    |
445 |             ptr::addr_of_mut!((*self.inner.get()).prev).write(value);
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ write access to allocation with id 164705
    |
    = note: BACKTRACE on thread `try_new`:
    = note: inside `tokio::util::linked_list::Pointers::<tokio::runtime::io::scheduled_io::ScheduledIo>::set_prev` at /home/gh-tiif/tokio/tokio/src/util/linked_list.rs:445:13: 445:69
note: inside `tokio::util::linked_list::LinkedList::<std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo>, <std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo> as tokio::util::linked_list::Link>::Target>::remove`
   --> /home/gh-tiif/tokio/tokio/src/util/linked_list.rs:229:9
    |
229 |         L::pointers(node).as_mut().set_prev(None);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::io::registration_set::RegistrationSet::remove`
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/registration_set.rs:118:17
    |
118 |         let _ = synced.registrations.remove(io.into());
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::io::driver::Handle::add_source::<mio::sys::unix::sourcefd::SourceFd<'_>>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/driver.rs:227:17
    |
227 | /                 self.registrations
228 | |                     .remove(&mut self.synced.lock(), &scheduled_io)
    | |___________________________________________________________________^
note: inside closure
   --> tokio/tests/io_async_fd.rs:20:18
    |
20  |     let _error = AsyncFd::try_new(original);
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: inside `<std::pin::Pin<&mut dyn std::future::Future<Output = ()>> as std::future::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
    = note: inside `<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>> as std::future::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:57
    |
729 |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
    |                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::coop::with_budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:107:5
    |
107 |     f()
    |     ^^^
note: inside `tokio::runtime::coop::budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:73:5
    |
73  |     with_budget(Budget::initial(), f)
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:25
    |
729 |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::Context::enter::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:428:19
    |
428 |         let ret = f();
    |                   ^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:728:36
    |
728 |                       let (c, res) = context.enter(core, || {
    |  ____________________________________^
729 | |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
730 | |                     });
    | |______________________^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:68
    |
807 |         let (core, ret) = context::set_scheduler(&self.context, || f(core, context));
    |                                                                    ^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::context::scoped::Scoped::<tokio::runtime::scheduler::Context>::set::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/context/scoped.rs:40:9
    |
40  |         f()
    |         ^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:26
    |
180 |         CONTEXT.with(|c| c.scheduler.set(v, f))
    |                          ^^^^^^^^^^^^^^^^^^^^^
    = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::try_with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:283:12: 283:27
    = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:260:9: 260:25
note: inside `tokio::runtime::context::set_scheduler::<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:9
    |
180 |         CONTEXT.with(|c| c.scheduler.set(v, f))
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::CoreGuard::<'_>::enter::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:27
    |
807 |         let (core, ret) = context::set_scheduler(&self.context, || f(core, context));
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:196:28
    |
196 |                     return core.block_on(future);
    |                            ^^^^^^^^^^^^^^^^^^^^^
note: inside `try_new`
   --> tokio/tests/io_async_fd.rs:20:5
    |
20  |     let _error = AsyncFd::try_new(original);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> tokio/tests/io_async_fd.rs:18:19
    |
17  | #[tokio::test]
    | -------------- in this procedural macro expansion
18  | async fn try_new() {
    |                   ^
    = note: this note originates in the attribute macro `::core::prelude::v1::test` which comes from the expansion of the attribute macro `tokio::test` (in Nightly builds, run with -Z macro-backtrace for more info)

error: Undefined Behavior: trying to retag from <390256> for SharedReadWrite permission at alloc164705[0x0], but that tag does not exist in the borrow stack for this location
   --> /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs:383:18
    |
383 |         unsafe { &*self.as_ptr().cast_const() }
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |                  |
    |                  trying to retag from <390256> for SharedReadWrite permission at alloc164705[0x0], but that tag does not exist in the borrow stack for this location
    |                  this error occurs as part of retag at alloc164705[0x0..0x100]
    |
    = help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
    = help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
help: <390256> was created by a SharedReadOnly retag at offsets [0xd0..0x30d]
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/registration_set.rs:118:45
    |
118 |         let _ = synced.registrations.remove(io.into());
    |                                             ^^^^^^^^^
    = note: BACKTRACE (of the first span) on thread `try_new`:
    = note: inside `std::ptr::NonNull::<alloc::sync::ArcInner<tokio::runtime::io::scheduled_io::ScheduledIo>>::as_ref::<'_>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/non_null.rs:383:18: 383:46
    = note: inside `std::sync::Arc::<tokio::runtime::io::scheduled_io::ScheduledIo>::inner` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:1869:18: 1869:35
    = note: inside `<std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo> as std::ops::Drop>::drop` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/sync.rs:2527:12: 2527:24
    = note: inside `std::ptr::drop_in_place::<std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo>> - shim(Some(std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo>))` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:521:1: 521:56
    = note: inside `std::ptr::drop_in_place::<std::option::Option<std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo>>> - shim(Some(std::option::Option<std::sync::Arc<tokio::runtime::io::scheduled_io::ScheduledIo>>))` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:521:1: 521:56
note: inside `tokio::runtime::io::registration_set::RegistrationSet::remove`
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/registration_set.rs:118:55
    |
118 |         let _ = synced.registrations.remove(io.into());
    |                                                       ^
note: inside `tokio::runtime::io::driver::Handle::add_source::<mio::sys::unix::sourcefd::SourceFd<'_>>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/io/driver.rs:227:17
    |
227 | /                 self.registrations
228 | |                     .remove(&mut self.synced.lock(), &scheduled_io)
    | |___________________________________________________________________^
note: inside closure
   --> tokio/tests/io_async_fd.rs:20:18
    |
20  |     let _error = AsyncFd::try_new(original);
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: inside `<std::pin::Pin<&mut dyn std::future::Future<Output = ()>> as std::future::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
    = note: inside `<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>> as std::future::Future>::poll` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/future.rs:123:9: 123:61
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:57
    |
729 |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
    |                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::coop::with_budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:107:5
    |
107 |     f()
    |     ^^^
note: inside `tokio::runtime::coop::budget::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/coop.rs:73:5
    |
73  |     with_budget(Budget::initial(), f)
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:729:25
    |
729 |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::Context::enter::<std::task::Poll<()>, {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:428:19
    |
428 |         let ret = f();
    |                   ^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:728:36
    |
728 |                       let (c, res) = context.enter(core, || {
    |  ____________________________________^
729 | |                         crate::runtime::coop::budget(|| future.as_mut().poll(&mut cx))
730 | |                     });
    | |______________________^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:68
    |
807 |         let (core, ret) = context::set_scheduler(&self.context, || f(core, context));
    |                                                                    ^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::context::scoped::Scoped::<tokio::runtime::scheduler::Context>::set::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/context/scoped.rs:40:9
    |
40  |         f()
    |         ^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:26
    |
180 |         CONTEXT.with(|c| c.scheduler.set(v, f))
    |                          ^^^^^^^^^^^^^^^^^^^^^
    = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::try_with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:283:12: 283:27
    = note: inside `std::thread::LocalKey::<tokio::runtime::context::Context>::with::<{closure@tokio::runtime::context::set_scheduler<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>::{closure#0}}, (std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>)>` at /home/gh-tiif/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/local.rs:260:9: 260:25
note: inside `tokio::runtime::context::set_scheduler::<(std::boxed::Box<tokio::runtime::scheduler::current_thread::Core>, std::option::Option<()>), {closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::enter<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>::{closure#0}}>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/context.rs:180:9
    |
180 |         CONTEXT.with(|c| c.scheduler.set(v, f))
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `tokio::runtime::scheduler::current_thread::CoreGuard::<'_>::enter::<{closure@tokio::runtime::scheduler::current_thread::CoreGuard<'_>::block_on<std::pin::Pin<&mut std::pin::Pin<&mut dyn std::future::Future<Output = ()>>>>::{closure#0}}, std::option::Option<()>>`
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:807:27
    |
807 |         let (core, ret) = context::set_scheduler(&self.context, || f(core, context));
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> /home/gh-tiif/tokio/tokio/src/runtime/scheduler/current_thread/mod.rs:196:28
    |
196 |                     return core.block_on(future);
    |                            ^^^^^^^^^^^^^^^^^^^^^
note: inside `try_new`
   --> tokio/tests/io_async_fd.rs:20:5
    |
20  |     let _error = AsyncFd::try_new(original);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> tokio/tests/io_async_fd.rs:18:19
    |
17  | #[tokio::test]
    | -------------- in this procedural macro expansion
18  | async fn try_new() {
    |                   ^
    = note: this error originates in the attribute macro `::core::prelude::v1::test` which comes from the expansion of the attribute macro `tokio::test` (in Nightly builds, run with -Z macro-backtrace for more info)

@Darksonn
Copy link
Contributor

Darksonn commented Nov 13, 2024

I found the problem. Here's the fix:

diff --git a/tokio/src/runtime/io/registration_set.rs b/tokio/src/runtime/io/registration_set.rs
index 9b2f3f13..9b23732d 100644
--- a/tokio/src/runtime/io/registration_set.rs
+++ b/tokio/src/runtime/io/registration_set.rs
@@ -106,7 +106,7 @@ impl RegistrationSet {
 
         for io in pending {
             // safety: the registration is part of our list
-            unsafe { self.remove(synced, io.as_ref()) }
+            unsafe { self.remove(synced, &io) }
         }
 
         self.num_pending_release.store(0, Release);
@@ -114,9 +114,12 @@ impl RegistrationSet {
 
     // This function is marked as unsafe, because the caller must make sure that
     // `io` is part of the registration set.
-    pub(super) unsafe fn remove(&self, synced: &mut Synced, io: &ScheduledIo) {
-        super::EXPOSE_IO.unexpose_provenance(io);
-        let _ = synced.registrations.remove(io.into());
+    pub(super) unsafe fn remove(&self, synced: &mut Synced, io: &Arc<ScheduledIo>) {
+        // SAFETY: Pointers into an Arc are never null.
+        let io = unsafe { NonNull::new_unchecked(Arc::as_ptr(io).cast_mut()) };
+
+        super::EXPOSE_IO.unexpose_provenance(io.as_ptr());
+        let _ = synced.registrations.remove(io);
     }
 }
 

When calling LinkedList::remove we can't pass a raw pointer derived from a shared reference to the item, because it must have access to the refcount which is outside of the &ScheduledIo reference's view.

@tiif tiif marked this pull request as ready for review November 15, 2024 12:45
@tiif
Copy link
Contributor Author

tiif commented Nov 15, 2024

@Darksonn Thanks for investigating! This PR is ready now. :)

Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. What's the status on F_GETFL?

@tiif
Copy link
Contributor Author

tiif commented Nov 15, 2024

What's the status on F_GETFL?

It is is tracked under rust-lang/miri#3963.

May I know why this flag is being used here? If it is self-contained enough maybe it could be supported sooner.

@Darksonn
Copy link
Contributor

This is the relevant codepath:

fn set_nonblocking(fd: RawFd) {
use nix::fcntl::{OFlag, F_GETFL, F_SETFL};
let flags = nix::fcntl::fcntl(fd, F_GETFL).expect("fcntl(F_GETFD)");
if flags < 0 {
panic!(
"bad return value from fcntl(F_GETFL): {} ({:?})",
flags,
nix::Error::last()
);
}
let flags = OFlag::from_bits_truncate(flags) | OFlag::O_NONBLOCK;
nix::fcntl::fcntl(fd, F_SETFL(flags)).expect("fcntl(F_SETFD)");
}

@Darksonn Darksonn changed the title io_async_fd expose provenance io: avoid ptr->ref->ptr roundtrip in RegistrationSet Nov 16, 2024
@Darksonn Darksonn added A-tokio Area: The main tokio crate M-io Module: tokio/io labels Nov 16, 2024
@Darksonn Darksonn merged commit 2f89914 into tokio-rs:master Nov 16, 2024
87 checks passed
@tiif tiif deleted the io_async_fd_fix branch November 16, 2024 12:30
kodiakhq bot pushed a commit to pdylanross/fatigue that referenced this pull request Dec 4, 2024
Bumps tokio from 1.41.1 to 1.42.0.

Release notes
Sourced from tokio's releases.

Tokio v1.42.0
1.42.0 (Dec 3rd, 2024)
Added

io: add AsyncFd::{try_io, try_io_mut} (#6967)

Fixed

io: avoid ptr->ref->ptr roundtrip in RegistrationSet (#6929)
runtime: do not defer yield_now inside block_in_place (#6999)

Changes

io: simplify io readiness logic (#6966)

Documented

net: fix docs for tokio::net::unix::{pid_t, gid_t, uid_t} (#6791)
time: fix a typo in Instant docs (#6982)

#6791: tokio-rs/tokio#6791
#6929: tokio-rs/tokio#6929
#6966: tokio-rs/tokio#6966
#6967: tokio-rs/tokio#6967
#6982: tokio-rs/tokio#6982
#6999: tokio-rs/tokio#6999



Commits

bb9d570 chore: prepare Tokio v1.42.0 (#7005)
af9c683 tests: fix typo in build test instructions (#7004)
4bc5a1a ci: allow Unicode-3.0 license for unicode-ident (#7006)
f8948ea runtime: do not defer yield_now inside block_in_place (#6999)
bce9780 time: use array::from_fn instead of manually creating array (#7000)
38151f3 readme: unlist 1.32.x as LTS release (#6997)
5dda72d ci: pin valgrind to rustc 1.82 (#6998)
c07257f io: simplify io readiness logic (#6966)
d08578f time: fix a typo in Instant docs (#6982)
4047d79 miri: add annotations for tests with miri ignore (#6981)
Additional commits viewable in compare view




Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

@dependabot rebase will rebase this PR
@dependabot recreate will recreate this PR, overwriting any edits that have been made to it
@dependabot merge will merge this PR after your CI passes on it
@dependabot squash and merge will squash and merge this PR after your CI passes on it
@dependabot cancel merge will cancel a previously requested merge and block automerging
@dependabot reopen will reopen this PR if it is closed
@dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
@dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
@dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
@@ -655,7 +671,7 @@ fn send_oob_data<S: AsRawFd>(stream: &S, data: &[u8]) -> io::Result<usize> {
}

#[tokio::test]
#[cfg_attr(miri, ignore)]
#[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth implementing F_GETFL in Miri? That doesn't sound like it would be particularly hard.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I think it's worth it. We just need to make miri remember the flag whenever it is used, then return it when F_GETFL is called.

But looking at the codepath, to properly support the test here, we might also need F_SETFL?

Copy link

@RalfJung RalfJung Jan 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O_NONBLOCK is the only flag we currently support that could be exposed via that.

And yeah, adding both GET and SET makes sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am concerned about the interaction between F_SETFL and anything that involves this.block_thread because F_SETFL can change the status of O_NONBLOCK flag. But I can't verify if the concern is valid until I test it out, we can always get it done first and see if the problem arise.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we to decide what happens when a previously blocking FD is marked as non-blocking and there are waiting threads. Do they wake up immediately, or at some later point, or never?

@tiif can you file a Miri issue, and note this question there?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-io Module: tokio/io
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Miri reported UB in io_async_fd
3 participants