-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.D-non-disjoint-spansDiagnostics: non-disjoint spansDiagnostics: non-disjoint spansI-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
auto-reduced (treereduce-rust):
//@compile-flags: -Wsingle-use-lifetimes
#![core::contracts::ensures]
fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) {
loop {}
}
original:
#![core::contracts::ensures]
fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) { loop {} }
Version information
rustc 1.92.0-nightly (dd7fda570 2025-09-20)
binary: rustc
commit-hash: dd7fda570040e8a736f7d8bc28ddd1b444aabc82
commit-date: 2025-09-20
host: x86_64-unknown-linux-gnu
release: 1.92.0-nightly
LLVM version: 21.1.1
Possibly related line of code:
rust/compiler/rustc_errors/src/lib.rs
Lines 379 to 391 in dd7fda5
.cloned() | |
.filter_map(|mut substitution| { | |
// Assumption: all spans are in the same file, and all spans | |
// are disjoint. Sort in ascending order. | |
substitution.parts.sort_by_key(|part| part.span.lo()); | |
// Verify the assumption that all spans are disjoint | |
assert_eq!( | |
substitution.parts.array_windows().find(|[a, b]| a.span.overlaps(b.span)), | |
None, | |
"all spans must be disjoint", | |
); | |
// Account for cases where we are suggesting the same code that's already |
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Wsingle-use-lifetimes
Program output
error[E0658]: use of unstable library feature `contracts`
--> /tmp/icemaker_global_tempdir.zn1lhaOVuw4e/rustc_testrunner_tmpdir_reporting.sF8UTF2FxBLI/mvce.rs:1:4
|
1 | #![core::contracts::ensures]
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
= help: add `#![feature(contracts)]` to the crate attributes to enable
= note: this compiler was built on 2025-09-20; consider upgrading it if it is out of date
error[E0658]: inner macro attributes are unstable
--> /tmp/icemaker_global_tempdir.zn1lhaOVuw4e/rustc_testrunner_tmpdir_reporting.sF8UTF2FxBLI/mvce.rs:1:4
|
1 | #![core::contracts::ensures]
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #54726 <https://github.com/rust-lang/rust/issues/54726> for more information
= help: add `#![feature(custom_inner_attributes)]` to the crate attributes to enable
= note: this compiler was built on 2025-09-20; consider upgrading it if it is out of date
error[E0106]: missing lifetime specifiers
--> /tmp/icemaker_global_tempdir.zn1lhaOVuw4e/rustc_testrunner_tmpdir_reporting.sF8UTF2FxBLI/mvce.rs:1:1
|
1 | #![core::contracts::ensures]
| ^
| |
| expected named lifetime parameter
| _expected named lifetime parameter
| _|
| |
2 | |
3 | | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) {
4 | | loop {}
5 | | }
| |_-
| |_|
|
|
= help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments
note: these named lifetimes are available to use
--> /tmp/icemaker_global_tempdir.zn1lhaOVuw4e/rustc_testrunner_tmpdir_reporting.sF8UTF2FxBLI/mvce.rs:1:1
|
1 | / #![core::contracts::ensures]
2 | |
3 | | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) {
4 | | loop {}
5 | | }
| |_^
help: consider using one of the available lifetimes here
|
1 | #'lifetime ![core::contracts::ensures]
| +++++++++
error[E0658]: `#[prelude_import]` is for use by rustc only
--> /tmp/icemaker_global_tempdir.zn1lhaOVuw4e/rustc_testrunner_tmpdir_reporting.sF8UTF2FxBLI/mvce.rs:1:1
|
1 | / #![core::contracts::ensures]
2 | |
3 | | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) {
4 | | loop {}
5 | | }
| |_^
|
= help: add `#![feature(prelude_import)]` to the crate attributes to enable
= note: this compiler was built on 2025-09-20; consider upgrading it if it is out of date
warning: unused `#[macro_use]` import
--> /tmp/icemaker_global_tempdir.zn1lhaOVuw4e/rustc_testrunner_tmpdir_reporting.sF8UTF2FxBLI/mvce.rs:1:1
|
1 | / #![core::contracts::ensures]
2 | |
3 | | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) {
4 | | loop {}
5 | | }
| |_^
|
= note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default
warning: unused import: `#![core::contracts::ensures]
fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) {
loop {}
}`
--> /tmp/icemaker_global_tempdir.zn1lhaOVuw4e/rustc_testrunner_tmpdir_reporting.sF8UTF2FxBLI/mvce.rs:1:1
|
1 | / #![core::contracts::ensures]
2 | |
3 | | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) {
4 | | loop {}
5 | | }
| |_^
warning: lifetime parameter `'a` only used once
--> /tmp/icemaker_global_tempdir.zn1lhaOVuw4e/rustc_testrunner_tmpdir_reporting.sF8UTF2FxBLI/mvce.rs:1:1
|
1 | / #![core::contracts::ensures]
2 | |
3 | | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) {
4 | | loop {}
5 | | }
| | ^
| | |
| |_this lifetime...
| ...is used only here
|
= note: requested on the command line with `-W single-use-lifetimes`
thread 'rustc' (2865353) panicked at compiler/rustc_errors/src/lib.rs:385:17:
assertion `left == right` failed: all spans must be disjoint
left: Some([SubstitutionPart { span: /tmp/icemaker_global_tempdir.zn1lhaOVuw4e/rustc_testrunner_tmpdir_reporting.sF8UTF2FxBLI/mvce.rs:1:1: 5:2 (#0), snippet: "" }, SubstitutionPart { span: /tmp/icemaker_global_tempdir.zn1lhaOVuw4e/rustc_testrunner_tmpdir_reporting.sF8UTF2FxBLI/mvce.rs:1:1: 5:3 (#0), snippet: "" }])
right: None
stack backtrace:
0: 0x7f4675a02983 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h7c6ba7eb3d79c74e
1: 0x7f4676202044 - core::fmt::write::h51b415dc740abb61
2: 0x7f46759b7201 - std::io::Write::write_fmt::h65024e6b411b5d6a
3: 0x7f46759c86f2 - std::sys::backtrace::BacktraceLock::print::h1fa141d4115fcdc7
4: 0x7f46759ce659 - std::panicking::default_hook::{{closure}}::h5b8d1bafc007debc
5: 0x7f46759ce183 - std::panicking::default_hook::hbee1bd2db26bedfe
6: 0x7f46749f23c7 - std[aa543e5c3b33e14e]::panicking::update_hook::<alloc[25bb32ac37752f7b]::boxed::Box<rustc_driver_impl[4e82038d4654c963]::install_ice_hook::{closure#1}>>::{closure#0}
7: 0x7f46759cea7f - std::panicking::panic_with_hook::h8cbd8c4377e6572b
8: 0x7f46759ce83a - std::panicking::panic_handler::{{closure}}::h335ded1aca77b6b6
9: 0x7f46759c8839 - std::sys::backtrace::__rust_end_short_backtrace::hd229ab5df32e8172
10: 0x7f46759a936d - __rustc[8ed8e68a5aa5849d]::rust_begin_unwind
11: 0x7f46729f3dd0 - core::panicking::panic_fmt::hb55754338c38e2ee
12: 0x7f46743e8723 - core::panicking::assert_failed_inner::h05ced653f036a926
13: 0x7f4674a22438 - core[e1f2d92e823976a5]::panicking::assert_failed::<core[e1f2d92e823976a5]::option::Option<&[rustc_errors[a7391ad1ca04e6f8]::SubstitutionPart; 2usize]>, core[e1f2d92e823976a5]::option::Option<&[rustc_errors[a7391ad1ca04e6f8]::SubstitutionPart; 2usize]>>
14: 0x7f46775e406f - <core[e1f2d92e823976a5]::iter::adapters::filter_map::FilterMap<core[e1f2d92e823976a5]::iter::adapters::cloned::Cloned<core[e1f2d92e823976a5]::iter::adapters::filter::Filter<core[e1f2d92e823976a5]::slice::iter::Iter<rustc_errors[a7391ad1ca04e6f8]::Substitution>, <rustc_errors[a7391ad1ca04e6f8]::CodeSuggestion>::splice_lines::{closure#0}>>, <rustc_errors[a7391ad1ca04e6f8]::CodeSuggestion>::splice_lines::{closure#1}> as core[e1f2d92e823976a5]::iter::traits::iterator::Iterator>::next
15: 0x7f46775e525f - <rustc_errors[a7391ad1ca04e6f8]::emitter::HumanEmitter>::emit_suggestion_default
16: 0x7f4677756753 - <rustc_errors[a7391ad1ca04e6f8]::emitter::HumanEmitter as rustc_errors[a7391ad1ca04e6f8]::emitter::Emitter>::emit_diagnostic
17: 0x7f467775dc95 - <rustc_errors[a7391ad1ca04e6f8]::DiagCtxtInner>::emit_diagnostic::{closure#3}
18: 0x7f467775b65a - rustc_interface[ddde8db7de1554b0]::callbacks::track_diagnostic::<core[e1f2d92e823976a5]::option::Option<rustc_span[201c3f2d192352b6]::ErrorGuaranteed>>
19: 0x7f467775a676 - <rustc_errors[a7391ad1ca04e6f8]::DiagCtxtInner>::emit_diagnostic
20: 0x7f467775a53f - <rustc_errors[a7391ad1ca04e6f8]::DiagCtxtHandle>::emit_diagnostic
21: 0x7f467775a3d5 - <() as rustc_errors[a7391ad1ca04e6f8]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
22: 0x7f467711f2b1 - rustc_middle[224366ec5639bfdc]::lint::lint_level::lint_level_impl
23: 0x7f46763a1dda - rustc_ast[59d0fcd6044051c1]::visit::walk_fn::<rustc_lint[7349aa5574e29002]::early::EarlyContextAndPass<rustc_lint[7349aa5574e29002]::BuiltinCombinedEarlyLintPass>>
24: 0x7f467639d451 - <rustc_lint[7349aa5574e29002]::early::EarlyContextAndPass<rustc_lint[7349aa5574e29002]::BuiltinCombinedEarlyLintPass>>::with_lint_attrs::<<rustc_lint[7349aa5574e29002]::early::EarlyContextAndPass<rustc_lint[7349aa5574e29002]::BuiltinCombinedEarlyLintPass> as rustc_ast[59d0fcd6044051c1]::visit::Visitor>::visit_item::{closure#0}>
25: 0x7f4677294d19 - rustc_interface[ddde8db7de1554b0]::passes::early_lint_checks
26: 0x7f46772946c9 - rustc_query_impl[c74c6a12e169b097]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c74c6a12e169b097]::query_impl::early_lint_checks::dynamic_query::{closure#2}::{closure#0}, rustc_middle[224366ec5639bfdc]::query::erase::Erased<[u8; 0usize]>>
27: 0x7f46771c2a60 - rustc_query_system[dabb8f7ac9ad8702]::query::plumbing::try_execute_query::<rustc_query_impl[c74c6a12e169b097]::DynamicConfig<rustc_query_system[dabb8f7ac9ad8702]::query::caches::SingleCache<rustc_middle[224366ec5639bfdc]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[c74c6a12e169b097]::plumbing::QueryCtxt, false>
28: 0x7f46771c2848 - rustc_query_impl[c74c6a12e169b097]::query_impl::early_lint_checks::get_query_non_incr::__rust_end_short_backtrace
29: 0x7f46769ab192 - rustc_ast_lowering[a820d31e47a014f5]::lower_to_hir
30: 0x7f46773d1d62 - rustc_query_impl[c74c6a12e169b097]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c74c6a12e169b097]::query_impl::hir_crate::dynamic_query::{closure#2}::{closure#0}, rustc_middle[224366ec5639bfdc]::query::erase::Erased<[u8; 8usize]>>
31: 0x7f46771befb7 - rustc_query_system[dabb8f7ac9ad8702]::query::plumbing::try_execute_query::<rustc_query_impl[c74c6a12e169b097]::DynamicConfig<rustc_query_system[dabb8f7ac9ad8702]::query::caches::SingleCache<rustc_middle[224366ec5639bfdc]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[c74c6a12e169b097]::plumbing::QueryCtxt, false>
32: 0x7f46771becde - rustc_query_impl[c74c6a12e169b097]::query_impl::hir_crate::get_query_non_incr::__rust_end_short_backtrace
33: 0x7f46778b5a98 - rustc_query_impl[c74c6a12e169b097]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c74c6a12e169b097]::query_impl::opt_hir_owner_nodes::dynamic_query::{closure#2}::{closure#0}, rustc_middle[224366ec5639bfdc]::query::erase::Erased<[u8; 8usize]>>.warm
34: 0x7f4676401344 - rustc_query_system[dabb8f7ac9ad8702]::query::plumbing::try_execute_query::<rustc_query_impl[c74c6a12e169b097]::DynamicConfig<rustc_data_structures[2c2d92c6a626fca3]::vec_cache::VecCache<rustc_span[201c3f2d192352b6]::def_id::LocalDefId, rustc_middle[224366ec5639bfdc]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[dabb8f7ac9ad8702]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[c74c6a12e169b097]::plumbing::QueryCtxt, false>
35: 0x7f4676400fcb - rustc_query_impl[c74c6a12e169b097]::query_impl::opt_hir_owner_nodes::get_query_non_incr::__rust_end_short_backtrace
36: 0x7f46767a52dd - <rustc_middle[224366ec5639bfdc]::ty::context::TyCtxt>::hir_owner_node
37: 0x7f467679e024 - rustc_middle[224366ec5639bfdc]::hir::map::hir_crate_items
38: 0x7f46773d3db3 - rustc_query_impl[c74c6a12e169b097]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c74c6a12e169b097]::query_impl::hir_crate_items::dynamic_query::{closure#2}::{closure#0}, rustc_middle[224366ec5639bfdc]::query::erase::Erased<[u8; 8usize]>>
39: 0x7f46771befb7 - rustc_query_system[dabb8f7ac9ad8702]::query::plumbing::try_execute_query::<rustc_query_impl[c74c6a12e169b097]::DynamicConfig<rustc_query_system[dabb8f7ac9ad8702]::query::caches::SingleCache<rustc_middle[224366ec5639bfdc]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[c74c6a12e169b097]::plumbing::QueryCtxt, false>
40: 0x7f46771be640 - rustc_query_impl[c74c6a12e169b097]::query_impl::hir_crate_items::get_query_non_incr::__rust_end_short_backtrace
41: 0x7f467640275e - rustc_interface[ddde8db7de1554b0]::passes::analysis
42: 0x7f46764026ed - rustc_query_impl[c74c6a12e169b097]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c74c6a12e169b097]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[224366ec5639bfdc]::query::erase::Erased<[u8; 0usize]>>
43: 0x7f46771c2a60 - rustc_query_system[dabb8f7ac9ad8702]::query::plumbing::try_execute_query::<rustc_query_impl[c74c6a12e169b097]::DynamicConfig<rustc_query_system[dabb8f7ac9ad8702]::query::caches::SingleCache<rustc_middle[224366ec5639bfdc]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[c74c6a12e169b097]::plumbing::QueryCtxt, false>
44: 0x7f46771c26b6 - rustc_query_impl[c74c6a12e169b097]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
45: 0x7f46775027cf - rustc_interface[ddde8db7de1554b0]::passes::create_and_enter_global_ctxt::<core[e1f2d92e823976a5]::option::Option<rustc_interface[ddde8db7de1554b0]::queries::Linker>, rustc_driver_impl[4e82038d4654c963]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
46: 0x7f467741643e - rustc_interface[ddde8db7de1554b0]::interface::run_compiler::<(), rustc_driver_impl[4e82038d4654c963]::run_compiler::{closure#0}>::{closure#1}
47: 0x7f4677397db8 - std[aa543e5c3b33e14e]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[ddde8db7de1554b0]::util::run_in_thread_with_globals<rustc_interface[ddde8db7de1554b0]::util::run_in_thread_pool_with_globals<rustc_interface[ddde8db7de1554b0]::interface::run_compiler<(), rustc_driver_impl[4e82038d4654c963]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
48: 0x7f4677397a88 - <<std[aa543e5c3b33e14e]::thread::Builder>::spawn_unchecked_<rustc_interface[ddde8db7de1554b0]::util::run_in_thread_with_globals<rustc_interface[ddde8db7de1554b0]::util::run_in_thread_pool_with_globals<rustc_interface[ddde8db7de1554b0]::interface::run_compiler<(), rustc_driver_impl[4e82038d4654c963]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[e1f2d92e823976a5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
49: 0x7f467739ddcd - std::sys::thread::unix::Thread::new::thread_start::ha9de35456108e0f3
50: 0x7f4670a969cb - <unknown>
51: 0x7f4670b1aa0c - <unknown>
52: 0x0 - <unknown>
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: rustc 1.92.0-nightly (dd7fda570 2025-09-20) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z dump-mir-dir=dir
query stack during panic:
#0 [early_lint_checks] perform lints prior to AST lowering
#1 [hir_crate] getting the crate HIR
#2 [opt_hir_owner_nodes] getting HIR owner items in ``
#3 [hir_crate_items] getting HIR crate items
#4 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 4 previous errors; 3 warnings emitted
Some errors have detailed explanations: E0106, E0658.
For more information about an error, try `rustc --explain E0106`.
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.D-non-disjoint-spansDiagnostics: non-disjoint spansDiagnostics: non-disjoint spansI-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.