-
Notifications
You must be signed in to change notification settings - Fork 14k
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
If I use an .into() inside a tracing::instrument call, the compiler panics.
Code
use tracing::instrument;
pub struct X;
impl Into<String> for X {
fn into(self) -> String {
"".to_string()
}
}
#[instrument(fields(value = value.into()))]
fn do_something(value: X) {}
fn main() {
println!("Hello, world!");
}Meta
rustc --version --verbose:
rustc 1.92.0-nightly (844264add 2025-10-14)
binary: rustc
commit-hash: 844264adda6f41ca6d0d61c4bcac0f263fc5072f
commit-date: 2025-10-14
host: aarch64-apple-darwin
release: 1.92.0-nightly
LLVM version: 21.1.3
Error output
thread 'rustc' (122385267) panicked at compiler/rustc_errors/src/lib.rs:385:17:
assertion `left == right` failed: all spans must be disjoint
left: Some([SubstitutionPart { span: src/main.rs:11:41: 12:22 (#0), snippet: ")" }, SubstitutionPart { span: src/main.rs:12:17: 12:17 (#0), snippet: "<X as Into<T>>::into(" }])
right: None
Backtrace
thread 'rustc' (122385267) panicked at compiler/rustc_errors/src/lib.rs:385:17:
assertion `left == right` failed: all spans must be disjoint
left: Some([SubstitutionPart { span: src/main.rs:11:41: 12:22 (#0), snippet: ")" }, SubstitutionPart { span: src/main.rs:12:17: 12:17 (#0), snippet: "<X as Into<T>>::into(" }])
right: None
stack backtrace:
0: __rustc::rust_begin_unwind
1: core::panicking::panic_fmt
2: core::panicking::assert_failed_inner
3: core::panicking::assert_failed::<core::option::Option<&[rustc_errors::SubstitutionPart; 2]>, core::option::Option<&[rustc_errors::SubstitutionPart; 2]>>
4: <core::iter::adapters::filter_map::FilterMap<core::iter::adapters::cloned::Cloned<core::iter::adapters::filter::Filter<core::slice::iter::Iter<rustc_errors::Substitution>, <rustc_errors::CodeSuggestion>::splice_lines::{closure#0}>>, <rustc_errors::CodeSuggestion>::splice_lines::{closure#1}> as core::iter::traits::iterator::Iterator>::next
5: <rustc_errors::emitter::HumanEmitter>::emit_suggestion_default
6: <rustc_errors::emitter::HumanEmitter as rustc_errors::emitter::Emitter>::emit_diagnostic
7: <rustc_errors::json::Diagnostic>::from_errors_diagnostic
8: <rustc_errors::json::JsonEmitter as rustc_errors::emitter::Emitter>::emit_diagnostic
9: <rustc_errors::DiagCtxtInner>::emit_diagnostic::{closure#3}
10: rustc_interface::callbacks::track_diagnostic::<core::option::Option<rustc_span::ErrorGuaranteed>>
11: <rustc_errors::DiagCtxtInner>::emit_diagnostic
12: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
13: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
14: <rustc_trait_selection::error_reporting::TypeErrCtxt>::maybe_report_ambiguity
15: <rustc_trait_selection::error_reporting::TypeErrCtxt>::report_fulfillment_errors
16: rustc_hir_typeck::typeck_with_inspect::{closure#0}
17: rustc_hir_typeck::typeck
[... omitted 1 frame ...]
18: <rustc_middle::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis::check_crate::{closure#2}>::{closure#0}
19: rustc_hir_analysis::check_crate
20: rustc_interface::passes::analysis
[... omitted 1 frame ...]
21: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
22: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
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/akeles/Programming/projects/compilerbug/rustc-ice-2025-11-17T11_26_31-73124.txt` to your bug report
note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -C incremental=[REDACTED]
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [typeck] type-checking `do_something`
#1 [analysis] running analysis passes on this crate
end of query stack
For more information about this error, try `rustc --explain E0283`.
error: could not compile `compilerbug` (bin "compilerbug")
Caused by:
process didn't exit successfully: `/Users/akeles/.rustup/toolchains/nightly-aarch64-apple-darwin/bin/rustc --crate-name compilerbug --edition=2024 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=162 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=9403f909893285fb -C extra-filename=-9227bcaf6b500129 --out-dir /Users/akeles/Programming/projects/compilerbug/target/debug/deps -C incremental=/Users/akeles/Programming/projects/compilerbug/target/debug/incremental -L dependency=/Users/akeles/Programming/projects/compilerbug/target/debug/deps --extern tracing=/Users/akeles/Programming/projects/compilerbug/target/debug/deps/libtracing-b781d9179eb763e2.rlib` (exit status: 101)
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.