rust-lang / rust-clippy

A bunch of lints to catch common mistakes and improve your Rust code. Book: https://doc.rust-lang.org/clippy/
https://rust-lang.github.io/rust-clippy/
Other
10.89k stars 1.46k forks source link

ICE when using `tracing::debug!("").await` in a non-async fn #12703

Closed ReactorScram closed 3 weeks ago

ReactorScram commented 3 weeks ago

Summary

I minimized it to this https://github.com/ReactorScram/rust-ice-repro/blob/main/src/lib.rs Basically

fn _() {
    tracing::debug!("").await
}

cargo check, cargo build, or cargo clippy all seem to crash similarly.

Version

rustc 1.77.2 (25ef9e3d8 2024-04-09)
binary: rustc
commit-hash: 25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04
commit-date: 2024-04-09
host: aarch64-unknown-linux-gnu
release: 1.77.2
LLVM version: 17.0.6

Error output

Backtrace

``` thread 'rustc' panicked at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/compiler/rustc_middle/src/hir/mod.rs:145:88: no entry found for key stack backtrace: 0: rust_begin_unwind at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:647:5 1: core::panicking::panic_fmt at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/panicking.rs:72:14 2: core::panicking::panic_display at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/panicking.rs:196:5 3: core::panicking::panic_str at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/panicking.rs:171:5 4: core::option::expect_failed at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/option.rs:1988:5 5: >::call_once [... omitted 2 frames ...] 6: ::opt_parent_id 7: ::next 8: ::probe_for_lint_level 9: ::lint_level_id_at_node 10: ::lint_level_at_node 11: rustc_hir_analysis::check_unused::check_unused_traits [... omitted 2 frames ...] 12: rustc_hir_analysis::check_crate 13: rustc_interface::passes::analysis [... omitted 2 frames ...] 14: ::enter::> 15: ::enter::, rustc_span::ErrorGuaranteed>> 16: rustc_interface::util::run_in_thread_with_globals::, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0} note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. error: the compiler unexpectedly panicked. this is a bug. ```

y21 commented 3 weeks ago

This is most likely a duplicate of rust-lang/rust#121096 and should already be fixed on nightly.

ReactorScram commented 3 weeks ago

You're right, cargo +nightly check doesn't have the crash. Thanks!