Skip to content

async (Tokio), index-out-of-bounds, 1.80.0-nightly (72fdf913c 2024-06-05) #126083

Open
@dream-dasher

Description

@dream-dasher

Context: I have a repo of scratch files. It's filled with various bin/ files that I drop code snippets into and sometimes save to try something out. (Some quite old.)
various bin

Today I decided drop a a Divan benchmarking snippet in and, seemingly unrelated, errors occurred.
They all are associated with tokio code.

I've added the 5 rust-ice files that popped up and code from the seemingly associated files.

(I have to jump on some work; haven't checked that they are the actual source or paired down to --minimal examples. But can chisel on them later if desired.)--

Code

Files provided in the order of errors produced.
The backtrace files are approximately the same in each case.
The last error (re: tokio-01) was not associated with a backtrace for some reason.

bin/tracing-ex.rs
#![deny(rust_2018_idioms)]
/// run `tokio-console`
/// and run this with: 
/// RUSTFLAGS="--cfg tokio_unstable"
/// to get tokio console to log the trace statements
/// (you may also need RUST_LOG=trace|etc.)
/// 
/// This is a example showing how information is scoped with tokio's
/// `task::spawn`.
///
/// You can run this example by running the following command in a terminal
///
/// ```
/// cargo run --example tokio-spawny-thing
/// ```
use futures::future::try_join_all;
use tracing::{debug, info, instrument, span, Instrument as _, Level};

type Error = Box<dyn std::error::Error + Send + Sync + 'static>;

#[instrument]
async fn parent_task(subtasks: usize) -> Result<(), Error> {
        loop {
                info!("spawning subtasks...");
                let subtasks = (1..=subtasks).map(|number| {
                                                     let span =
                                                             span!(Level::INFO, "subtask", %number);
                                                     debug!(message = "creating subtask;", number);
                                                     tokio::spawn(subtask(number).instrument(span))
                                             })
                                             .collect::<Vec<_>>();

                // the returnable error would be if one of the subtasks panicked.
                let sum: usize = try_join_all(subtasks).await?
                                                       .iter()
                                                       .sum();
                info!(%sum, "all subtasks completed; calculated sum");
        }
        Ok(())
}

async fn subtask(number: usize) -> usize {
        info!(%number, "polling subtask");
        number
}

#[tokio::main]
async fn main() -> Result<(), Error> {
        console_subscriber::init();
        // tracing_subscriber::fmt().with_max_level(tracing::Level::DEBUG)
        //                          .try_init()?;
        parent_task(10).await?;
        Ok(())
}
bin/tokio-03.rs
//! use of semaphore with Tokio to control resource access
//!

use std::sync::Arc;

use futures::{stream::FuturesUnordered, StreamExt};
use tokio::{sync::Semaphore, time::Duration};

#[tokio::main]
async fn main() {
        println!("hi");
        broken_max_concurrent_asynch(10).await;
}

/// async function using sleep and `.await`
async fn sleep_then_print<S>(id: S)
        where S: AsRef<str> {
        let id: &str = id.as_ref();
        println!("Start timer {}.", id);
        tokio::time::sleep(Duration::from_secs(2)).await;
        //                                            ^ execution can be paused here
        println!("Timer {} done.", id);
}

/// flawed suggestion by AI
/// This will block once we hit our maximum concurrent number of permits.
/// The permits are essentially rate controlling creation of futures rather than execution...
async fn broken_max_concurrent_asynch(loop_times: u32) {
        const MAX_CONCURRENT_TASKS: usize = 3;

        println!("\nMax Concurrent Tasks: {}, looping {} times",
                 MAX_CONCURRENT_TASKS, loop_times);

        let semaphore = Arc::new(Semaphore::new(MAX_CONCURRENT_TASKS));

        let mut futures = FuturesUnordered::new();

        for i in 1..=loop_times {
                // let i_clone = i.clone();
                let i_copy = i; //copy
                let semaphore_clone = semaphore.clone();
                let future = async move {
                        let permit = semaphore_clone.acquire_owned()
                                                    .await
                                                    .unwrap();
                        println!("Got permit, #{}", i_copy);
                        sleep_then_print(format!("Sleeping and printing (#{})", i_copy)).await;
                        drop(permit);
                };
                futures.push(future);
        }

        while (futures.next()
                      .await)
                             .is_some()
        {}
}
bin/tokio-02.rs
//! More Tokio work
//! "Semaphore", "JoinAll" on a Vec<Future>, "FuturesUnordered" iterated on
//! NOTE: this conversation
//! <https://users.rust-lang.org/t/idiomatic-way-of-parallel-execution-of-unordered-futures/80474>
//! from mid-2022 with one of the Tokio maintainers suggest that using join_all is bad practice
//! yet suggest using await on spawn ... (which is creating other threads??)
//! Unclear to me the wisdom of that approach -- however they note that the problem
//! with the existing vector of futures is that the compielr won't force you to deal with
//! errors properly...
//!
//! More interesting: `JoinSet
//!

use futures::{future::join_all, stream::FuturesUnordered, StreamExt};
use tokio::{task::JoinSet, time::Duration};

#[tokio::main]
async fn main() {
        multi_async_join_all(5).await;
        multi_async_futunordered(5).await;
        multi_async_joinset(5).await;
}

/// async function using sleep and `.await`
async fn sleep_then_print<S>(id: S)
        where S: AsRef<str> {
        let id: &str = id.as_ref();
        println!("Start timer {}.", id);
        tokio::time::sleep(Duration::from_secs(2)).await;
        //                                            ^ execution can be paused here
        println!("Timer {} done.", id);
}

/// looking at `.await` within another async function
/// using a Vec\<futures\> and `join_all()`
async fn multi_async_joinset(n: u32) {
        println!("\nmulti_async, looping {} times", n);
        let mut futures = JoinSet::new();

        for i in 0..n {
                futures.spawn(sleep_then_print(format!("Vec<future> & JoinSet: {}", i)));
        }
        while (futures.join_next()
                      .await)
                             .is_some()
        {}
}

/// looking at `.await` within another async function
/// using a Vec\<futures\> and `join_all()`
/// WARNING: This may obscure errors due to wrapping them in Vec
async fn multi_async_join_all(n: u32) {
        println!("\nmulti_async, looping {} times", n);
        let mut futures = Vec::new();
        for i in 0..n {
                futures.push(sleep_then_print(format!("Vec<future> & join_all(): {}", i)));
        }
        join_all(futures).await;
}

/// looking at `.await` within another async function
/// using `FuturesUnordered` from the **futures** crate
/// NOTE: this uses the futures crate -- precisely how well it plays with Tokio runtime I'm not yet
/// sure
async fn multi_async_futunordered(n: u32) {
        println!("\nmulti_async, looping {} times", n);
        let mut futures = FuturesUnordered::new();
        for i in 0..n {
                futures.push(sleep_then_print(format!("FuturesUnordered: {}", i)));
        }
        // while let Some(_) = futures.next().await {}
        // clippy prefers the syntax below
        while (futures.next()
                      .await)
                             .is_some()
        {}
}
bin/tokio-semaphore.rs
use std::sync::Arc;

use tokio::sync::Semaphore;
use tracing::{event, Level};

#[tokio::main]
async fn main() {
        tracing_subscriber::fmt::init();
        let semaphore = Semaphore::new(3);

        event!(Level::INFO, "{}", semaphore.available_permits());
        let _a_permit = semaphore.acquire()
                                 .await
                                 .unwrap();
        event!(Level::INFO, "{}", semaphore.available_permits());
        let _two_permits = semaphore.acquire_many(2)
                                    .await
                                    .unwrap();

        event!(Level::INFO, "{}", semaphore.available_permits());

        let permit_attempt = semaphore.try_acquire();
        event!(Level::WARN, "{:?}", permit_attempt.err());
        event!(Level::INFO, "{}", semaphore.available_permits());
        println!("did that error stop things??");
        println!("Nope, not sure why the INFO beneath it didn't show once.  Not sure if async related.");

        // NOTE: *REcycling* the permits!!! :)
        let semaphore = Arc::new(Semaphore::new(3));
        let mut join_handles = Vec::new();

        for i in 0..5 {
                let permit = semaphore.clone()
                                      .acquire_owned()
                                      .await
                                      .unwrap();
                let task_num = i;

                join_handles.push(tokio::spawn(async move {
                                    // Logging the start of the task
                                    event!(Level::INFO, %task_num, "Task started");

                                    // Simulate some work with an async sleep
                                    tokio::time::sleep(tokio::time::Duration::from_secs(1)).await;

                                    // Logging the completion of the task
                                    event!(Level::INFO, %task_num, "Task completed");

                                    // Explicitly own `permit` in the task
                                    drop(permit);
                            }));
        }

        for handle in join_handles {
                handle.await
                      .unwrap();
        }
}
bin/tokio-joins.rs
//! Looking at various ways of combining tokio proto-threads
//! And some errors occurring therein.
//!
//! partly re this convo:
//! <https://stackoverflow.com/questions/69638710/when-should-you-use-tokiojoin-over-tokiospawn>
//!

use color_eyre::{eyre::eyre, Result};
// use futures::future::join_all;
// use futures::stream::FuturesUnordered;
// use futures::StreamExt;
// use tokio::task::JoinSet;
use tokio::time::Duration;

#[tokio::main]
async fn main() -> Result<()> {
        color_eyre::install()?;

        println!();
        let (a, b, c) = tokio::join!(sleep_print_return_errable("1"),
                                     sleep_print_return_errable("2"),
                                     // sleep_print_return_errable("2err"),
                                     sleep_print_return_errable("3"),);
        println!("Returned vales are: {}, {}, {}", a?, b?, c?);

        println!();
        let pre_d = tokio::spawn(sleep_print_return_errable("I"));
        let pre_e = tokio::spawn(sleep_print_return_errable("II"));
        // let pre_e = tokio::spawn(sleep_print_return_errable("IIerr"));
        let pre_f = tokio::spawn(sleep_print_return_errable("III"));
        // note: joining a handle also confers a result value
        let (d, e, f) = (pre_d.await?, pre_e.await?, pre_f.await?);
        println!("Returned vales are: {}, {}, {}", d?, e?, f?);

        println!();
        let pre_g = tokio::spawn(sleep_print_return_errable("."));
        let pre_h = tokio::spawn(sleep_print_return_errable(".."));
        // let pre_e = tokio::spawn(sleep_print_return_errable("IIerr"));
        let pre_i = tokio::spawn(sleep_print_return_errable("..."));
        // note: joining a handle also confers a result value
        let g = pre_g.await?;
        let h = pre_h.await?;
        let i = pre_i.await?;
        println!("Returned vales are: {}, {}, {}", g?, h?, i?);
        //NOTE: ^ because there are ongoing tasks at the time of the awaits they can share time
        //        and this is noted by dint of the spawning automatically setting them up as
        //        proto-threads

        Ok(())
}

/// async function using sleep and `.await`
async fn sleep_print_return_errable<S>(id: S) -> Result<String>
        where S: AsRef<str> {
        let id: &str = id.as_ref();
        println!("Start timer {}.", id);
        tokio::time::sleep(Duration::from_secs(2)).await;

        if id.contains("err") {
                println!("Whoopsie Dasies got us an \"err\"!");
                return Err(eyre!("oh no!"));
        }
        //                                            ^ execution can be paused here
        println!("Timer {} done.", id);
        Ok(String::from(id))
}
bin/tokio-01.rs
//! For very basic exploration of the tokio async system(s)
//!

use std::{fmt::Debug, time::Duration as stdDuration};

use tokio::time::Duration as tokDuration;
use tracing_subscriber::fmt::format::FmtSpan;
// use tracing_subscriber::EnvFilter;

#[tokio::main]
#[tracing::instrument]
async fn main() {
        tracing_subscriber::fmt().with_env_filter("trace")
                                 // .with_env_filter(EnvFilter::from_default_env())
                                 .with_thread_names(true)
                                 .with_span_events(FmtSpan::FULL)
                                 .pretty()
                                 .init();

        multi_async(3).await;

        // these two will occur in *serial*
        println!("\nRunning two times via raw calls:");
        sleep_then_print_tokio("raw_1").await;
        println!("Boop a.");
        println!("Boop b.");
        println!("Boop c.");
        println!("Boop d.");
        println!("Note: none of those were yielded.");
        sleep_then_print_tokio("raw_2").await;

        // The join! macro lets you run multiple things concurrently.
        println!("\nProper asynching with `.await`.");
        tokio::join!(sleep_then_print_tokio("tokio::time::sleep 1"),
                     sleep_then_print_tokio("tokio::time::sleep 2"),
                     sleep_then_print_tokio("tokio::time::sleep 3"),);

        println!("\nFailed asynching without `.await`.");
        tokio::join!(sleep_then_print_std("std::thread::sleep 1"),
                     sleep_then_print_std("std::thread::sleep 2"),
                     sleep_then_print_std("std::thread::sleep 3"),);
}

/// async function using sleep and **NO** `.await`
#[tracing::instrument(level = "warn")]
async fn sleep_then_print_std<S>(id: S)
        where S: AsRef<str> + Debug {
        let id: &str = id.as_ref();
        println!("Start timer {}.", id);
        std::thread::sleep(stdDuration::from_secs(2));
        // execution won't pause or allow switching, due to lack of `.await`
        println!("Timer {} done.", id);
}

/// async function using sleep and `.await`
#[tracing::instrument(level = "debug")]
async fn sleep_then_print_tokio<S>(id: S)
        where S: AsRef<str> + Debug {
        let id: &str = id.as_ref();
        println!("Start timer {}.", id);
        tokio::time::sleep(tokDuration::from_secs(2)).await;
        //                                            ^ execution can be paused here
        println!("Timer {} done.", id);
}

/// looking at `.await` within another async function
#[tracing::instrument(level = "trace")]
async fn multi_async(n: u32) {
        println!("\nmulti_async, looping {} times", n);
        for i in 0..n {
                sleep_then_print_tokio(format!("boop bop {}", i)).await;
        }
}

Meta

rustc --version --verbose:

~/coding_dirs/rust/letsplay on  main [!?] is 📦 v0.1.0 via 🦀 v1.80.0-nightly
❯ rustc --version --verbose
rustc 1.80.0-nightly (72fdf913c 2024-06-05)
binary: rustc
commit-hash: 72fdf913c53dd0e75313ba83e4aa80df3f6e2871
commit-date: 2024-06-05
host: aarch64-apple-darwin
release: 1.80.0-nightly
LLVM version: 18.1.6

Error output

shell output
~/coding_dirs/rust/letsplay on  main [!?] is 📦 v0.1.0 via 🦀 v1.80.0-nightly
❮ cargo bench --bench divan_test
   Compiling letsplay v0.1.0 (/Users/esl/coding_dirs/rust/letsplay)
warning: unused variable: `add`
  --> src/bin/faer.rs:15:13
   |
15 |         let add = &a + &b;
   |             ^^^ help: if this is intentional, prefix it with an underscore: `_add`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: unused variable: `sub`
  --> src/bin/faer.rs:16:13
   |
16 |         let sub = &a - &b;
   |             ^^^ help: if this is intentional, prefix it with an underscore: `_sub`

warning: unused variable: `scale`
  --> src/bin/faer.rs:17:13
   |
17 |         let scale = scale(3.0) * &a;
   |             ^^^^^ help: if this is intentional, prefix it with an underscore: `_scale`

warning: unused import: `Report`
  --> src/bin/error-stack-spantrace.rs:18:19
   |
18 | use error_stack::{Report, Result};
   |                   ^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

warning: `letsplay` (bin "faer") generated 3 warnings
warning: `letsplay` (bin "error-stack-spantrace") generated 1 warning (run `cargo fix --bin "error-stack-spantrace"` to apply 1 suggestion)
warning: struct `RunDisplay` is never constructed
  --> src/bin/option_unwrap.rs:14:8
   |
14 | struct RunDisplay(Run);
   |        ^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: `letsplay` (bin "option_unwrap") generated 1 warning
warning: unused import: `fmt`
 --> src/bin/error-stack2.rs:1:11
  |
1 | use std::{fmt, fs, path::Path};
  |           ^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `Context`
 --> src/bin/error-stack2.rs:4:19
  |
4 | use error_stack::{Context, Report, ResultExt};
  |                   ^^^^^^^

warning: unexpected `cfg` condition name: `nightly`
  --> src/bin/error-stack2.rs:32:23
   |
32 |                 #[cfg(nightly)]
   |                       ^^^^^^^
   |
   = help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `ub_checks`, `unix`, and `windows`
   = help: consider using a Cargo feature instead
   = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
            [lints.rust]
            unexpected_cfgs = { level = "warn", check-cfg = ['cfg(nightly)'] }
   = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(nightly)");` to the top of the `build.rs`
   = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
   = note: `#[warn(unexpected_cfgs)]` on by default

warning: field `0` is never read
  --> src/bin/error-stack2.rs:11:19
   |
11 | struct Suggestion(&'static str);
   |        ---------- ^^^^^^^^^^^^
   |        |
   |        field in this struct
   |
   = note: `#[warn(dead_code)]` on by default
help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field
   |
11 | struct Suggestion(());
   |                   ~~

warning: `letsplay` (bin "error-stack2") generated 4 warnings (run `cargo fix --bin "error-stack2"` to apply 2 suggestions)
warning: unreachable expression
  --> src/bin/tracing-ex.rs:39:9
   |
23 | /         loop {
24 | |                 info!("spawning subtasks...");
25 | |                 let subtasks = (1..=subtasks).map(|number| {
26 | |                                                      let span =
...  |
37 | |                 info!(%sum, "all subtasks completed; calculated sum");
38 | |         }
   | |_________- any code following this expression is unreachable
39 |           Ok(())
   |           ^^^^^^ unreachable expression
   |
   = note: `#[warn(unreachable_code)]` on by default

warning: `letsplay` (bin "tracing-ex") generated 1 warning
thread 'rustc' panicked at compiler/rustc_codegen_ssa/src/back/link.rs:2700:27:
index out of bounds: the len is 47 but the index is 47
stack backtrace:
   0:        0x10369d3dc - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h61cab6a51874328d
   1:        0x1036e1a44 - core::fmt::write::hb5e15975e5da6323
   2:        0x10369379c - std::io::Write::write_fmt::h0b12ac3b69876109
   3:        0x10369d234 - std::sys_common::backtrace::print::hf384cefaf458b4b2
   4:        0x10369f840 - std::panicking::default_hook::{{closure}}::h2ea0749a19af1081
   5:        0x10369f50c - std::panicking::default_hook::hbb10431af7fb84d0
   6:        0x10cf31b58 - <alloc[21813a2f4a1dddb8]::boxed::Box<rustc_driver_impl[87babf7360fe8007]::install_ice_hook::{closure#0}> as core[96dda71451d2c891]::ops::function::Fn<(&dyn for<'a, 'b> core[96dda71451d2c891]::ops::function::Fn<(&'a core[96dda71451d2c891]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[96dda71451d2c891]::marker::Sync + core[96dda71451d2c891]::marker::Send, &core[96dda71451d2c891]::panic::panic_info::PanicInfo)>>::call
   7:        0x1036a022c - std::panicking::rust_panic_with_hook::h9811dee7b2a41290
   8:        0x10369fc40 - std::panicking::begin_panic_handler::{{closure}}::h9df6d3c362544de5
   9:        0x10369d860 - std::sys_common::backtrace::__rust_end_short_backtrace::he21a2e349f33ab9e
  10:        0x10369f9b0 - _rust_begin_unwind
  11:        0x1036fd2f0 - core::panicking::panic_fmt::hb07a7fdf73fc1f73
  12:        0x1036fd480 - core::panicking::panic_bounds_check::ha2c1eb644d339da0
  13:        0x10ccd7a30 - rustc_codegen_ssa[a2bce7c714e890ce]::back::link::linker_with_args
  14:        0x10ccce8d4 - rustc_codegen_ssa[a2bce7c714e890ce]::back::link::link_natively
  15:        0x10cccaadc - rustc_codegen_ssa[a2bce7c714e890ce]::back::link::link_binary
  16:        0x10cbed284 - <rustc_codegen_llvm[a1c96cb4fc49f08c]::LlvmCodegenBackend as rustc_codegen_ssa[a2bce7c714e890ce]::traits::backend::CodegenBackend>::link
  17:        0x10d728614 - <rustc_interface[a26f4a552665cc6]::queries::Linker>::link
  18:        0x10cf57ea8 - std[7f886e9aac2088ad]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[a26f4a552665cc6]::util::run_in_thread_with_globals<rustc_interface[a26f4a552665cc6]::util::run_in_thread_pool_with_globals<rustc_interface[a26f4a552665cc6]::interface::run_compiler<core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>, rustc_driver_impl[87babf7360fe8007]::run_compiler::{closure#0}>::{closure#1}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>::{closure#0}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>
  19:        0x10cf25348 - <<std[7f886e9aac2088ad]::thread::Builder>::spawn_unchecked_<rustc_interface[a26f4a552665cc6]::util::run_in_thread_with_globals<rustc_interface[a26f4a552665cc6]::util::run_in_thread_pool_with_globals<rustc_interface[a26f4a552665cc6]::interface::run_compiler<core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>, rustc_driver_impl[87babf7360fe8007]::run_compiler::{closure#0}>::{closure#1}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>::{closure#0}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>::{closure#2} as core[96dda71451d2c891]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  20:        0x1036a8d48 - std::sys::pal::unix::thread::Thread::new::thread_start::h7da3daacdb3dbcd5
  21:        0x19851af94 - __pthread_joiner_wake

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: please attach the file at `/Users/esl/coding_dirs/rust/letsplay/rustc-ice-2024-06-06T16_38_29-51458.txt` to your bug report

note: compiler flags: --crate-type bin -C opt-level=3 -C embed-bitcode=no -C strip=debuginfo

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `letsplay` (bin "tokio-03")
warning: build failed, waiting for other jobs to finish...
thread 'rustc' panicked at compiler/rustc_codegen_ssa/src/back/link.rs:2700:27:
index out of bounds: the len is 47 but the index is 47
stack backtrace:
   0:        0x105e0d3dc - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h61cab6a51874328d
   1:        0x105e51a44 - core::fmt::write::hb5e15975e5da6323
   2:        0x105e0379c - std::io::Write::write_fmt::h0b12ac3b69876109
   3:        0x105e0d234 - std::sys_common::backtrace::print::hf384cefaf458b4b2
   4:        0x105e0f840 - std::panicking::default_hook::{{closure}}::h2ea0749a19af1081
   5:        0x105e0f50c - std::panicking::default_hook::hbb10431af7fb84d0
   6:        0x10f6a1b58 - <alloc[21813a2f4a1dddb8]::boxed::Box<rustc_driver_impl[87babf7360fe8007]::install_ice_hook::{closure#0}> as core[96dda71451d2c891]::ops::function::Fn<(&dyn for<'a, 'b> core[96dda71451d2c891]::ops::function::Fn<(&'a core[96dda71451d2c891]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[96dda71451d2c891]::marker::Sync + core[96dda71451d2c891]::marker::Send, &core[96dda71451d2c891]::panic::panic_info::PanicInfo)>>::call
   7:        0x105e1022c - std::panicking::rust_panic_with_hook::h9811dee7b2a41290
   8:        0x105e0fc40 - std::panicking::begin_panic_handler::{{closure}}::h9df6d3c362544de5
   9:        0x105e0d860 - std::sys_common::backtrace::__rust_end_short_backtrace::he21a2e349f33ab9e
  10:        0x105e0f9b0 - _rust_begin_unwind
  11:        0x105e6d2f0 - core::panicking::panic_fmt::hb07a7fdf73fc1f73
  12:        0x105e6d480 - core::panicking::panic_bounds_check::ha2c1eb644d339da0
  13:        0x10f447a30 - rustc_codegen_ssa[a2bce7c714e890ce]::back::link::linker_with_args
  14:        0x10f43e8d4 - rustc_codegen_ssa[a2bce7c714e890ce]::back::link::link_natively
  15:        0x10f43aadc - rustc_codegen_ssa[a2bce7c714e890ce]::back::link::link_binary
  16:        0x10f35d284 - <rustc_codegen_llvm[a1c96cb4fc49f08c]::LlvmCodegenBackend as rustc_codegen_ssa[a2bce7c714e890ce]::traits::backend::CodegenBackend>::link
  17:        0x10fe98614 - <rustc_interface[a26f4a552665cc6]::queries::Linker>::link
  18:        0x10f6c7ea8 - std[7f886e9aac2088ad]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[a26f4a552665cc6]::util::run_in_thread_with_globals<rustc_interface[a26f4a552665cc6]::util::run_in_thread_pool_with_globals<rustc_interface[a26f4a552665cc6]::interface::run_compiler<core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>, rustc_driver_impl[87babf7360fe8007]::run_compiler::{closure#0}>::{closure#1}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>::{closure#0}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>
  19:        0x10f695348 - <<std[7f886e9aac2088ad]::thread::Builder>::spawn_unchecked_<rustc_interface[a26f4a552665cc6]::util::run_in_thread_with_globals<rustc_interface[a26f4a552665cc6]::util::run_in_thread_pool_with_globals<rustc_interface[a26f4a552665cc6]::interface::run_compiler<core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>, rustc_driver_impl[87babf7360fe8007]::run_compiler::{closure#0}>::{closure#1}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>::{closure#0}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>::{closure#2} as core[96dda71451d2c891]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  20:        0x105e18d48 - std::sys::pal::unix::thread::Thread::new::thread_start::h7da3daacdb3dbcd5
  21:        0x19851af94 - __pthread_joiner_wake

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: please attach the file at `/Users/esl/coding_dirs/rust/letsplay/rustc-ice-2024-06-06T16_38_29-51463.txt` to your bug report

note: compiler flags: --crate-type bin -C opt-level=3 -C embed-bitcode=no -C strip=debuginfo

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `letsplay` (bin "tokio-02")
thread 'rustc' panicked at compiler/rustc_codegen_ssa/src/back/link.rs:2700:27:
index out of bounds: the len is 54 but the index is 54
stack backtrace:
   0:        0x1012353dc - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h61cab6a51874328d
   1:        0x101279a44 - core::fmt::write::hb5e15975e5da6323
   2:        0x10122b79c - std::io::Write::write_fmt::h0b12ac3b69876109
   3:        0x101235234 - std::sys_common::backtrace::print::hf384cefaf458b4b2
   4:        0x101237840 - std::panicking::default_hook::{{closure}}::h2ea0749a19af1081
   5:        0x10123750c - std::panicking::default_hook::hbb10431af7fb84d0
   6:        0x10aac9b58 - <alloc[21813a2f4a1dddb8]::boxed::Box<rustc_driver_impl[87babf7360fe8007]::install_ice_hook::{closure#0}> as core[96dda71451d2c891]::ops::function::Fn<(&dyn for<'a, 'b> core[96dda71451d2c891]::ops::function::Fn<(&'a core[96dda71451d2c891]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[96dda71451d2c891]::marker::Sync + core[96dda71451d2c891]::marker::Send, &core[96dda71451d2c891]::panic::panic_info::PanicInfo)>>::call
   7:        0x10123822c - std::panicking::rust_panic_with_hook::h9811dee7b2a41290
   8:        0x101237c40 - std::panicking::begin_panic_handler::{{closure}}::h9df6d3c362544de5
   9:        0x101235860 - std::sys_common::backtrace::__rust_end_short_backtrace::he21a2e349f33ab9e
  10:        0x1012379b0 - _rust_begin_unwind
  11:        0x1012952f0 - core::panicking::panic_fmt::hb07a7fdf73fc1f73
  12:        0x101295480 - core::panicking::panic_bounds_check::ha2c1eb644d339da0
  13:        0x10a86fa30 - rustc_codegen_ssa[a2bce7c714e890ce]::back::link::linker_with_args
  14:        0x10a8668d4 - rustc_codegen_ssa[a2bce7c714e890ce]::back::link::link_natively
  15:        0x10a862adc - rustc_codegen_ssa[a2bce7c714e890ce]::back::link::link_binary
  16:        0x10a785284 - <rustc_codegen_llvm[a1c96cb4fc49f08c]::LlvmCodegenBackend as rustc_codegen_ssa[a2bce7c714e890ce]::traits::backend::CodegenBackend>::link
  17:        0x10b2c0614 - <rustc_interface[a26f4a552665cc6]::queries::Linker>::link
  18:        0x10aaefea8 - std[7f886e9aac2088ad]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[a26f4a552665cc6]::util::run_in_thread_with_globals<rustc_interface[a26f4a552665cc6]::util::run_in_thread_pool_with_globals<rustc_interface[a26f4a552665cc6]::interface::run_compiler<core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>, rustc_driver_impl[87babf7360fe8007]::run_compiler::{closure#0}>::{closure#1}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>::{closure#0}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>
  19:        0x10aabd348 - <<std[7f886e9aac2088ad]::thread::Builder>::spawn_unchecked_<rustc_interface[a26f4a552665cc6]::util::run_in_thread_with_globals<rustc_interface[a26f4a552665cc6]::util::run_in_thread_pool_with_globals<rustc_interface[a26f4a552665cc6]::interface::run_compiler<core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>, rustc_driver_impl[87babf7360fe8007]::run_compiler::{closure#0}>::{closure#1}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>::{closure#0}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>::{closure#2} as core[96dda71451d2c891]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  20:        0x101240d48 - std::sys::pal::unix::thread::Thread::new::thread_start::h7da3daacdb3dbcd5
  21:        0x19851af94 - __pthread_joiner_wake

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: please attach the file at `/Users/esl/coding_dirs/rust/letsplay/rustc-ice-2024-06-06T16_38_29-51460.txt` to your bug report

note: compiler flags: --crate-type bin -C opt-level=3 -C embed-bitcode=no -C strip=debuginfo

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `letsplay` (bin "tokio-semaphore")
thread 'rustc' panicked at compiler/rustc_codegen_ssa/src/back/link.rs:2700:27:
index out of bounds: the len is 65 but the index is 65
stack backtrace:
   0:        0x1059293dc - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h61cab6a51874328d
   1:        0x10596da44 - core::fmt::write::hb5e15975e5da6323
   2:        0x10591f79c - std::io::Write::write_fmt::h0b12ac3b69876109
   3:        0x105929234 - std::sys_common::backtrace::print::hf384cefaf458b4b2
   4:        0x10592b840 - std::panicking::default_hook::{{closure}}::h2ea0749a19af1081
   5:        0x10592b50c - std::panicking::default_hook::hbb10431af7fb84d0
   6:        0x10f1bdb58 - <alloc[21813a2f4a1dddb8]::boxed::Box<rustc_driver_impl[87babf7360fe8007]::install_ice_hook::{closure#0}> as core[96dda71451d2c891]::ops::function::Fn<(&dyn for<'a, 'b> core[96dda71451d2c891]::ops::function::Fn<(&'a core[96dda71451d2c891]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[96dda71451d2c891]::marker::Sync + core[96dda71451d2c891]::marker::Send, &core[96dda71451d2c891]::panic::panic_info::PanicInfo)>>::call
   7:        0x10592c22c - std::panicking::rust_panic_with_hook::h9811dee7b2a41290
   8:        0x10592bc40 - std::panicking::begin_panic_handler::{{closure}}::h9df6d3c362544de5
   9:        0x105929860 - std::sys_common::backtrace::__rust_end_short_backtrace::he21a2e349f33ab9e
  10:        0x10592b9b0 - _rust_begin_unwind
  11:        0x1059892f0 - core::panicking::panic_fmt::hb07a7fdf73fc1f73
  12:        0x105989480 - core::panicking::panic_bounds_check::ha2c1eb644d339da0
  13:        0x10ef63a30 - rustc_codegen_ssa[a2bce7c714e890ce]::back::link::linker_with_args
  14:        0x10ef5a8d4 - rustc_codegen_ssa[a2bce7c714e890ce]::back::link::link_natively
  15:        0x10ef56adc - rustc_codegen_ssa[a2bce7c714e890ce]::back::link::link_binary
  16:        0x10ee79284 - <rustc_codegen_llvm[a1c96cb4fc49f08c]::LlvmCodegenBackend as rustc_codegen_ssa[a2bce7c714e890ce]::traits::backend::CodegenBackend>::link
  17:        0x10f9b4614 - <rustc_interface[a26f4a552665cc6]::queries::Linker>::link
  18:        0x10f1e3ea8 - std[7f886e9aac2088ad]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[a26f4a552665cc6]::util::run_in_thread_with_globals<rustc_interface[a26f4a552665cc6]::util::run_in_thread_pool_with_globals<rustc_interface[a26f4a552665cc6]::interface::run_compiler<core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>, rustc_driver_impl[87babf7360fe8007]::run_compiler::{closure#0}>::{closure#1}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>::{closure#0}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>
  19:        0x10f1b1348 - <<std[7f886e9aac2088ad]::thread::Builder>::spawn_unchecked_<rustc_interface[a26f4a552665cc6]::util::run_in_thread_with_globals<rustc_interface[a26f4a552665cc6]::util::run_in_thread_pool_with_globals<rustc_interface[a26f4a552665cc6]::interface::run_compiler<core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>, rustc_driver_impl[87babf7360fe8007]::run_compiler::{closure#0}>::{closure#1}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>::{closure#0}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>::{closure#2} as core[96dda71451d2c891]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  20:        0x105934d48 - std::sys::pal::unix::thread::Thread::new::thread_start::h7da3daacdb3dbcd5
  21:        0x19851af94 - __pthread_joiner_wake

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: please attach the file at `/Users/esl/coding_dirs/rust/letsplay/rustc-ice-2024-06-06T16_38_29-51459.txt` to your bug report

note: compiler flags: --crate-type bin -C opt-level=3 -C embed-bitcode=no -C strip=debuginfo

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `letsplay` (bin "tokio-joins")
thread 'rustc' panicked at compiler/rustc_codegen_ssa/src/back/link.rs:2700:27:
index out of bounds: the len is 54 but the index is 54
stack backtrace:
   0:        0x101aa13dc - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h61cab6a51874328d
   1:        0x101ae5a44 - core::fmt::write::hb5e15975e5da6323
   2:        0x101a9779c - std::io::Write::write_fmt::h0b12ac3b69876109
   3:        0x101aa1234 - std::sys_common::backtrace::print::hf384cefaf458b4b2
   4:        0x101aa3840 - std::panicking::default_hook::{{closure}}::h2ea0749a19af1081
   5:        0x101aa350c - std::panicking::default_hook::hbb10431af7fb84d0
   6:        0x10b335b58 - <alloc[21813a2f4a1dddb8]::boxed::Box<rustc_driver_impl[87babf7360fe8007]::install_ice_hook::{closure#0}> as core[96dda71451d2c891]::ops::function::Fn<(&dyn for<'a, 'b> core[96dda71451d2c891]::ops::function::Fn<(&'a core[96dda71451d2c891]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[96dda71451d2c891]::marker::Sync + core[96dda71451d2c891]::marker::Send, &core[96dda71451d2c891]::panic::panic_info::PanicInfo)>>::call
   7:        0x101aa422c - std::panicking::rust_panic_with_hook::h9811dee7b2a41290
   8:        0x101aa3c40 - std::panicking::begin_panic_handler::{{closure}}::h9df6d3c362544de5
   9:        0x101aa1860 - std::sys_common::backtrace::__rust_end_short_backtrace::he21a2e349f33ab9e
  10:        0x101aa39b0 - _rust_begin_unwind
  11:        0x101b012f0 - core::panicking::panic_fmt::hb07a7fdf73fc1f73
  12:        0x101b01480 - core::panicking::panic_bounds_check::ha2c1eb644d339da0
  13:        0x10b0dba30 - rustc_codegen_ssa[a2bce7c714e890ce]::back::link::linker_with_args
  14:        0x10b0d28d4 - rustc_codegen_ssa[a2bce7c714e890ce]::back::link::link_natively
  15:        0x10b0ceadc - rustc_codegen_ssa[a2bce7c714e890ce]::back::link::link_binary
  16:        0x10aff1284 - <rustc_codegen_llvm[a1c96cb4fc49f08c]::LlvmCodegenBackend as rustc_codegen_ssa[a2bce7c714e890ce]::traits::backend::CodegenBackend>::link
  17:        0x10bb2c614 - <rustc_interface[a26f4a552665cc6]::queries::Linker>::link
  18:        0x10b35bea8 - std[7f886e9aac2088ad]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[a26f4a552665cc6]::util::run_in_thread_with_globals<rustc_interface[a26f4a552665cc6]::util::run_in_thread_pool_with_globals<rustc_interface[a26f4a552665cc6]::interface::run_compiler<core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>, rustc_driver_impl[87babf7360fe8007]::run_compiler::{closure#0}>::{closure#1}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>::{closure#0}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>
  19:        0x10b329348 - <<std[7f886e9aac2088ad]::thread::Builder>::spawn_unchecked_<rustc_interface[a26f4a552665cc6]::util::run_in_thread_with_globals<rustc_interface[a26f4a552665cc6]::util::run_in_thread_pool_with_globals<rustc_interface[a26f4a552665cc6]::interface::run_compiler<core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>, rustc_driver_impl[87babf7360fe8007]::run_compiler::{closure#0}>::{closure#1}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>::{closure#0}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[96dda71451d2c891]::result::Result<(), rustc_span[ccde8df03d73fdd2]::ErrorGuaranteed>>::{closure#2} as core[96dda71451d2c891]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  20:        0x101aacd48 - std::sys::pal::unix::thread::Thread::new::thread_start::h7da3daacdb3dbcd5
  21:        0x19851af94 - __pthread_joiner_wake

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: please attach the file at `/Users/esl/coding_dirs/rust/letsplay/rustc-ice-2024-06-06T16_38_29-51465.txt` to your bug report

note: compiler flags: --crate-type bin -C opt-level=3 -C embed-bitcode=no -C strip=debuginfo

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `letsplay` (bin "tokio-01")

Backtraces

rustc-ice-2024-06-06T16_38_29-51458.txt
rustc-ice-2024-06-06T16_38_29-51459.txt
rustc-ice-2024-06-06T16_38_29-51460.txt
rustc-ice-2024-06-06T16_38_29-51463.txt
rustc-ice-2024-06-06T16_38_29-51465.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cratesArea: Crates and their interactions (like crate loading)C-bugCategory: This is a bug.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions