-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-let_chains`#![feature(let_chains)]``#![feature(let_chains)]`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
auto-reduced (treereduce-rust):
//@compile-flags: -Zlint-mir
#![feature(let_chains)]
struct TupleIter<T, I: Iterator<Item = T>> {
inner: I,
}
impl<T, I: Iterator<Item = T>> Iterator for TupleIter<T, I> {
type Item = (T, T, T);
fn next(&mut self) -> Option<Self::Item> {
let inner = &mut self.inner;
if let Some(first) = inner.next()
&& let Some(second) = inner.next()
&& let Some(third) = inner.next()
{
Some((first, second, third))
} else {
None
}
}
}
fn main() {}original:
//@ compile-flags: -Zvalidate-mir -C opt-level=3
//@ build-pass
//@ edition: 2024
struct TupleIter<T, I: Iterator<Item = T>> {
inner: I,
}
impl<T, I: Iterator<Item = T>> Iterator for TupleIter<T, I> {
type Item = (T, T, T);
fn next(&mut self) -> Option<Self::Item> {
let inner = &mut self.inner;
if let Some(first) = inner.next()
&& let Some(second) = inner.next()
&& let Some(third) = inner.next()
{
Some((first, second, third))
} else {
None
}
}
}
fn main() {
let vec: Vec<u8> = Vec::new();
let mut tup_iter = TupleIter {
inner: vec.into_iter(),
};
tup_iter.next();
}Version information
rustc 1.89.0-nightly (dcecb9917 2025-05-09)
binary: rustc
commit-hash: dcecb99176edf2eec51613730937d21cdd5c8f6e
commit-date: 2025-05-09
host: x86_64-unknown-linux-gnu
release: 1.89.0-nightly
LLVM version: 20.1.4
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zlint-mir -Zcrate-attr=feature(let_chains)
Program output
warning: struct `TupleIter` is never constructed
--> /tmp/icemaker_global_tempdir.8Nvh3CQXZMXY/rustc_testrunner_tmpdir_reporting.LQqC63yDbYhH/mvce.rs:1:8
|
1 | struct TupleIter<T, I: Iterator<Item = T>> {
| ^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: 1 warning emitted
note: no errors encountered even though delayed bugs were created
note: those delayed bugs will now be shown as internal compiler errors
error: internal compiler error: broken MIR in Item(DefId(0:11 ~ mvce[eae9]::{impl#0}::next)) (after pass CheckForceInline) at bb28[1]:
use of local _11, which has no storage here
--> /tmp/icemaker_global_tempdir.8Nvh3CQXZMXY/rustc_testrunner_tmpdir_reporting.LQqC63yDbYhH/mvce.rs:19:5
|
19 | }
| ^
|
note: delayed at compiler/rustc_mir_transform/src/lint.rs:74:22
0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, alloc::string::String>
4: <rustc_mir_transform::lint::Lint>::fail::<alloc::string::String>
5: <rustc_mir_transform::lint::Lint as rustc_middle::mir::visit::Visitor>::visit_local
6: <rustc_mir_transform::lint::Lint as rustc_middle::mir::visit::Visitor>::visit_place
7: <rustc_mir_transform::lint::Lint as rustc_middle::mir::visit::Visitor>::visit_terminator
8: rustc_mir_transform::lint::lint_body
9: rustc_mir_transform::mir_built
10: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_built::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
11: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
12: rustc_query_impl::query_impl::mir_built::get_query_non_incr::__rust_end_short_backtrace
13: rustc_mir_build::check_unsafety::check_unsafety
14: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_unsafety::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
16: rustc_query_impl::query_impl::check_unsafety::get_query_non_incr::__rust_end_short_backtrace
17: rustc_interface::passes::run_required_analyses
18: rustc_interface::passes::analysis
19: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
20: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
21: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
22: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
23: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
24: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
25: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
26: std::sys::pal::unix::thread::Thread::new::thread_start
27: <unknown>
28: <unknown>
--> /tmp/icemaker_global_tempdir.8Nvh3CQXZMXY/rustc_testrunner_tmpdir_reporting.LQqC63yDbYhH/mvce.rs:19:5
|
19 | }
| ^
error: internal compiler error: broken MIR in Item(DefId(0:11 ~ mvce[eae9]::{impl#0}::next)) (after pass CheckForceInline) at bb41[0]:
use of local _7, which has no storage here
--> /tmp/icemaker_global_tempdir.8Nvh3CQXZMXY/rustc_testrunner_tmpdir_reporting.LQqC63yDbYhH/mvce.rs:19:5
|
19 | }
| ^
|
note: delayed at compiler/rustc_mir_transform/src/lint.rs:74:22
0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, alloc::string::String>
4: <rustc_mir_transform::lint::Lint>::fail::<alloc::string::String>
5: <rustc_mir_transform::lint::Lint as rustc_middle::mir::visit::Visitor>::visit_local
6: <rustc_mir_transform::lint::Lint as rustc_middle::mir::visit::Visitor>::visit_place
7: <rustc_mir_transform::lint::Lint as rustc_middle::mir::visit::Visitor>::visit_terminator
8: rustc_mir_transform::lint::lint_body
9: rustc_mir_transform::mir_built
10: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_built::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
11: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
12: rustc_query_impl::query_impl::mir_built::get_query_non_incr::__rust_end_short_backtrace
13: rustc_mir_build::check_unsafety::check_unsafety
14: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_unsafety::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 0]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
16: rustc_query_impl::query_impl::check_unsafety::get_query_non_incr::__rust_end_short_backtrace
17: rustc_interface::passes::run_required_analyses
18: rustc_interface::passes::analysis
19: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
20: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
21: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
22: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
23: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
24: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
25: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
26: std::sys::pal::unix::thread::Thread::new::thread_start
27: <unknown>
28: <unknown>
--> /tmp/icemaker_global_tempdir.8Nvh3CQXZMXY/rustc_testrunner_tmpdir_reporting.LQqC63yDbYhH/mvce.rs:19:5
|
19 | }
| ^
<snip>
error: internal compiler error: broken MIR in Item(DefId(0:11 ~ mvce[eae9]::{impl#0}::next)) (after phase change to runtime-post-cleanup) at bb30[0]:
use of local _11, which has no storage here
--> /tmp/icemaker_global_tempdir.8Nvh3CQXZMXY/rustc_testrunner_tmpdir_reporting.LQqC63yDbYhH/mvce.rs:19:5
|
19 | }
| ^
|
note: delayed at compiler/rustc_mir_transform/src/lint.rs:74:22
0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, alloc::string::String>
4: <rustc_mir_transform::lint::Lint>::fail::<alloc::string::String>
5: <rustc_mir_transform::lint::Lint as rustc_middle::mir::visit::Visitor>::visit_local
6: <rustc_mir_transform::lint::Lint as rustc_middle::mir::visit::Visitor>::visit_place
7: <rustc_mir_transform::lint::Lint as rustc_middle::mir::visit::Visitor>::visit_terminator
8: rustc_mir_transform::lint::lint_body
9: rustc_mir_transform::run_analysis_to_runtime_passes
10: rustc_mir_transform::mir_drops_elaborated_and_const_checked
11: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
12: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
13: rustc_query_impl::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
14: rustc_interface::passes::run_required_analyses
15: rustc_interface::passes::analysis
16: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
17: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
18: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
19: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
20: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
21: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
22: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
23: std::sys::pal::unix::thread::Thread::new::thread_start
24: <unknown>
25: <unknown>
--> /tmp/icemaker_global_tempdir.8Nvh3CQXZMXY/rustc_testrunner_tmpdir_reporting.LQqC63yDbYhH/mvce.rs:19:5
|
19 | }
| ^
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.89.0-nightly (dcecb9917 2025-05-09) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z lint-mir -Z crate-attr=feature(let_chains) -Z dump-mir-dir=dir
query stack during panic:
end of query stack
@rustbot label +F-let_chains
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-let_chains`#![feature(let_chains)]``#![feature(let_chains)]`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.