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_async_fd expose provenance #6929

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Miri reported UB in io_async_fd
2 participants