Closed
Description
auto-reduced (treereduce-rust):
pub struct Statement;
pub struct Rows<'stmt>(&'stmt Statement);
impl<'stmt> Iterator for Rows<'stmt> {
type Item = String;
fn next() -> Option<Self::Item> {
format!("Hello {}", "world").into()
}
}
fn get_names() -> Option<String> {
let stmt = Statement;
let rows = Rows(&stmt);
rows.map(|row| row).next()
}
original:
pub struct Statement;
pub struct Rows<'stmt>(&'stmt Statement);
impl<'stmt> Iterator for Rows<'stmt> {
type Item = String;
fn next() -> Option<Self::Item> {
let stmt = Statement;
let rows = Rows(&stmt);
format!("Hello {}", "world").into()
// x
//
}
}
fn get_names() -> Option<String> {
let stmt = Statement;
let rows = Rows(&stmt);
rows.map(|row| row).next()
// x
//
}
Version information
rustc 1.83.0-nightly (5a4ee43c3 2024-10-05)
binary: rustc
commit-hash: 5a4ee43c387110736440cecc375cb5aedc441dbc
commit-date: 2024-10-05
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zmir-opt-level=5 -Zvalidate-mir -Zcross-crate-inline-threshold=always
Program output
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.6F6DD8mcNIb4/rustc_testrunner_tmpdir_reporting.T2OQxr9MgywH/mvce.rs:23:2
|
23 | }
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.6F6DD8mcNIb4/rustc_testrunner_tmpdir_reporting.T2OQxr9MgywH/mvce.rs`
error[E0186]: method `next` has a `&mut self` declaration in the trait, but not in the impl
--> /tmp/icemaker_global_tempdir.6F6DD8mcNIb4/rustc_testrunner_tmpdir_reporting.T2OQxr9MgywH/mvce.rs:8:5
|
8 | fn next() -> Option<Self::Item> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&mut self` in impl
|
= note: `next` from trait: `fn(&mut Self) -> Option<<Self as Iterator>::Item>`
error: internal compiler error: compiler/rustc_middle/src/mir/tcx.rs:84:21: deref projection of non-dereferenceable ty PlaceTy { ty: [core::fmt::rt::Argument<'{erased}>; 0_usize], variant_index: None }
thread 'rustc' panicked at compiler/rustc_middle/src/mir/tcx.rs:84:21:
Box<dyn Any>
stack backtrace:
0: 0x74eb187249fa - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h585b06d402bc00d5
1: 0x74eb18e03426 - core::fmt::write::h62d1c51a5a367817
2: 0x74eb1a01a651 - std::io::Write::write_fmt::hd7881933ac2a1e16
3: 0x74eb18724852 - std::sys::backtrace::BacktraceLock::print::ha0ac5d8e3803f857
4: 0x74eb18726d26 - std::panicking::default_hook::{{closure}}::h7a48a96dd6d0b686
5: 0x74eb18726b70 - std::panicking::default_hook::h4ad77b5924a748da
6: 0x74eb177db8ff - std[f6927571c1bb7893]::panicking::update_hook::<alloc[1b6d6df6cca9b2d3]::boxed::Box<rustc_driver_impl[83de0f0d7a3bbaf8]::install_ice_hook::{closure#0}>>::{closure#0}
7: 0x74eb18727438 - std::panicking::rust_panic_with_hook::h15ea114d0f0705b7
8: 0x74eb17815451 - std[f6927571c1bb7893]::panicking::begin_panic::<rustc_errors[33bfe5951055d2f3]::ExplicitBug>::{closure#0}
9: 0x74eb178084f6 - std[f6927571c1bb7893]::sys::backtrace::__rust_end_short_backtrace::<std[f6927571c1bb7893]::panicking::begin_panic<rustc_errors[33bfe5951055d2f3]::ExplicitBug>::{closure#0}, !>
10: 0x74eb178084b3 - std[f6927571c1bb7893]::panicking::begin_panic::<rustc_errors[33bfe5951055d2f3]::ExplicitBug>
11: 0x74eb1781ece1 - <rustc_errors[33bfe5951055d2f3]::diagnostic::BugAbort as rustc_errors[33bfe5951055d2f3]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
12: 0x74eb17e49ca4 - rustc_middle[4aa8808438232afe]::util::bug::opt_span_bug_fmt::<rustc_span[b73f4c38f6b79966]::span_encoding::Span>::{closure#0}
13: 0x74eb17e2fb1a - rustc_middle[4aa8808438232afe]::ty::context::tls::with_opt::<rustc_middle[4aa8808438232afe]::util::bug::opt_span_bug_fmt<rustc_span[b73f4c38f6b79966]::span_encoding::Span>::{closure#0}, !>::{closure#0}
14: 0x74eb17e2f9ab - rustc_middle[4aa8808438232afe]::ty::context::tls::with_context_opt::<rustc_middle[4aa8808438232afe]::ty::context::tls::with_opt<rustc_middle[4aa8808438232afe]::util::bug::opt_span_bug_fmt<rustc_span[b73f4c38f6b79966]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
15: 0x74eb153daa80 - rustc_middle[4aa8808438232afe]::util::bug::bug_fmt
16: 0x74eb1a1cac71 - <rustc_middle[4aa8808438232afe]::mir::tcx::PlaceTy>::projection_ty.cold
17: 0x74eb1637d221 - rustc_mir_transform[e62bc607d4a6429b]::validate::validate_types
18: 0x74eb163bb165 - <rustc_mir_transform[e62bc607d4a6429b]::validate::Validator as rustc_mir_transform[e62bc607d4a6429b]::pass_manager::MirPass>::run_pass
19: 0x74eb171067c0 - rustc_mir_transform[e62bc607d4a6429b]::pass_manager::validate_body
20: 0x74eb18e0bb06 - rustc_mir_transform[e62bc607d4a6429b]::pass_manager::run_passes_inner
21: 0x74eb190ae9a2 - rustc_mir_transform[e62bc607d4a6429b]::optimized_mir
22: 0x74eb190ad25b - rustc_query_impl[7b31fe52c1943d23]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[7b31fe52c1943d23]::query_impl::optimized_mir::dynamic_query::{closure#2}::{closure#0}, rustc_middle[4aa8808438232afe]::query::erase::Erased<[u8; 8usize]>>
23: 0x74eb18e2f378 - rustc_query_system[af74fb06ba218297]::query::plumbing::try_execute_query::<rustc_query_impl[7b31fe52c1943d23]::DynamicConfig<rustc_query_system[af74fb06ba218297]::query::caches::DefIdCache<rustc_middle[4aa8808438232afe]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[7b31fe52c1943d23]::plumbing::QueryCtxt, false>
24: 0x74eb18e2e933 - rustc_query_impl[7b31fe52c1943d23]::query_impl::optimized_mir::get_query_non_incr::__rust_end_short_backtrace
25: 0x74eb16135e79 - <rustc_middle[4aa8808438232afe]::ty::context::TyCtxt>::instance_mir
26: 0x74eb1921e74a - rustc_interface[a7beddea6b2aa80d]::passes::run_required_analyses
27: 0x74eb19bf6f9e - rustc_interface[a7beddea6b2aa80d]::passes::analysis
28: 0x74eb19bf6f71 - rustc_query_impl[7b31fe52c1943d23]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[7b31fe52c1943d23]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[4aa8808438232afe]::query::erase::Erased<[u8; 1usize]>>
29: 0x74eb19cd31ee - rustc_query_system[af74fb06ba218297]::query::plumbing::try_execute_query::<rustc_query_impl[7b31fe52c1943d23]::DynamicConfig<rustc_query_system[af74fb06ba218297]::query::caches::SingleCache<rustc_middle[4aa8808438232afe]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[7b31fe52c1943d23]::plumbing::QueryCtxt, false>
30: 0x74eb19cd2ecf - rustc_query_impl[7b31fe52c1943d23]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
31: 0x74eb19b2151e - rustc_interface[a7beddea6b2aa80d]::interface::run_compiler::<core[e1b34d82e9cff2ed]::result::Result<(), rustc_span[b73f4c38f6b79966]::ErrorGuaranteed>, rustc_driver_impl[83de0f0d7a3bbaf8]::run_compiler::{closure#0}>::{closure#1}
32: 0x74eb19bd9150 - std[f6927571c1bb7893]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[a7beddea6b2aa80d]::util::run_in_thread_with_globals<rustc_interface[a7beddea6b2aa80d]::util::run_in_thread_pool_with_globals<rustc_interface[a7beddea6b2aa80d]::interface::run_compiler<core[e1b34d82e9cff2ed]::result::Result<(), rustc_span[b73f4c38f6b79966]::ErrorGuaranteed>, rustc_driver_impl[83de0f0d7a3bbaf8]::run_compiler::{closure#0}>::{closure#1}, core[e1b34d82e9cff2ed]::result::Result<(), rustc_span[b73f4c38f6b79966]::ErrorGuaranteed>>::{closure#0}, core[e1b34d82e9cff2ed]::result::Result<(), rustc_span[b73f4c38f6b79966]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[e1b34d82e9cff2ed]::result::Result<(), rustc_span[b73f4c38f6b79966]::ErrorGuaranteed>>
33: 0x74eb19bd9817 - <<std[f6927571c1bb7893]::thread::Builder>::spawn_unchecked_<rustc_interface[a7beddea6b2aa80d]::util::run_in_thread_with_globals<rustc_interface[a7beddea6b2aa80d]::util::run_in_thread_pool_with_globals<rustc_interface[a7beddea6b2aa80d]::interface::run_compiler<core[e1b34d82e9cff2ed]::result::Result<(), rustc_span[b73f4c38f6b79966]::ErrorGuaranteed>, rustc_driver_impl[83de0f0d7a3bbaf8]::run_compiler::{closure#0}>::{closure#1}, core[e1b34d82e9cff2ed]::result::Result<(), rustc_span[b73f4c38f6b79966]::ErrorGuaranteed>>::{closure#0}, core[e1b34d82e9cff2ed]::result::Result<(), rustc_span[b73f4c38f6b79966]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[e1b34d82e9cff2ed]::result::Result<(), rustc_span[b73f4c38f6b79966]::ErrorGuaranteed>>::{closure#1} as core[e1b34d82e9cff2ed]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
34: 0x74eb19bda701 - std::sys::pal::unix::thread::Thread::new::thread_start::h4498a525a6fc6a9e
35: 0x74eb1b27639d - <unknown>
36: 0x74eb1b2fb49c - <unknown>
37: 0x0 - <unknown>
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.83.0-nightly (5a4ee43c3 2024-10-05) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z mir-opt-level=5 -Z validate-mir -Z cross-crate-inline-threshold=always -Z dump-mir-dir=dir
query stack during panic:
#0 [optimized_mir] optimizing MIR for `get_names`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0186, E0601.
For more information about an error, try `rustc --explain E0186`.