Skip to content

rustc panics when compiling code that uses tokio's LocalSet #68109

Closed
@Alovchin91

Description

@Alovchin91

Compiler panics when compiling the following code that uses tokio's LocalSet:

#[tokio::main]
async fn main() {
    tokio::spawn(async move {
        let local = tokio::task::LocalSet::new();
        local.run_until(async { })
    }).await
}

--- or ---

#[tokio::main]
async fn main() {
    tokio::spawn({
        let local = tokio::task::LocalSet::new();
        local.run_until(async {})
    }).await
}

Panic message is as follows:

➜ RUST_BACKTRACE=full cargo build --verbose
       ...
       Fresh tokio v0.2.9
   Compiling rust-bug v0.1.0 (/tmp/rust-bug)
     Running `rustc --edition=2018 --crate-name rust_bug src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=b5f969b2f9a6a1a5 -C extra-filename=-b5f969b2f9a6a1a5 --out-dir /tmp/rust-bug/target/debug/deps -C incremental=/tmp/rust-bug/target/debug/incremental -L dependency=/tmp/rust-bug/target/debug/deps --extern tokio=/tmp/rust-bug/target/debug/deps/libtokio-e472db2be190b401.rlib`
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:378:21
stack backtrace:
   0:        0x104e46b75 - <unknown>
   1:        0x104e7dcc0 - <unknown>
             ...
 101:        0x104e59a6e - <unknown>
 102:     0x7fff6bb56e65 - <unknown>

error: internal compiler error: unexpected panic

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

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.40.0 (73528e339 2019-12-16) running on x86_64-apple-darwin

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

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

query stack during panic:
#0 [typeck_tables_of] processing `tokio::task::local::LocalSet::run_until`
#1 [typeck_tables_of] processing `tokio::task::local::LocalSet::run_until::{{closure}}#0`
#2 [typeck_tables_of] processing `main`
#3 [typeck_tables_of] processing `main::{{closure}}#0`
#4 [type_of] processing `main::{{closure}}#0`
#5 [collect_mod_item_types] collecting item types in top-level module
#6 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `rust-bug`.

Caused by:
  process didn't exit successfully: `rustc --edition=2018 --crate-name rust_bug src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=b5f969b2f9a6a1a5 -C extra-filename=-b5f969b2f9a6a1a5 --out-dir /tmp/rust-bug/target/debug/deps -C incremental=/tmp/rust-bug/target/debug/incremental -L dependency=/tmp/rust-bug/target/debug/deps --extern tokio=/tmp/rust-bug/target/debug/deps/libtokio-e472db2be190b401.rlib` (exit code: 101)

Dependencies:

[dependencies]
tokio = { version = "0.2.9", features = ["full"] }

Sample:

rust-bug.zip

Metadata

Metadata

Assignees

Labels

A-async-awaitArea: Async & AwaitAsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.C-bugCategory: This is a bug.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-asyncWorking group: Async & await

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions