rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
96.97k stars 12.53k forks source link

ICE: `query 'typeck' not cached due to poisoning` #119784

Open matthiaskrgr opened 8 months ago

matthiaskrgr commented 8 months ago

original:

pub fn iso<A, B, F1, F2>(a: F1, b: F2) -> (Box<dyn Fn(A) -> B>, Box<dyn Fn(B) -> A>)
    where
        F1: (Fn(A) -> B) + 'static,
        F2: (Fn(B) -> A) + 'static,
{
    (Box::new(a), Box::new(b))
}
pub fn iso_un_option<A, B>() -> (Box<dyn Fn(A) -> B>, Box<dyn Fn(B) -> A>) {
   let left = |o_a: Option<_>| o_a.unwrap();
    let right = |o_b: Option<_>| o_b.unwrap();
    iso(left, right)
    //~^ ERROR overflow
}

fn main() {}

Version information

rustc 1.77.0-nightly (ae9d24de8 2024-01-09)
binary: rustc
commit-hash: ae9d24de80b00b4158d1a29a212a6b02aeda0e75
commit-date: 2024-01-09
host: x86_64-unknown-linux-gnu
release: 1.77.0-nightly
LLVM version: 17.0.6

Command: /home/matthias/.rustup/toolchains/master/bin/rustc -Zthreads=16

Program output

``` error[E0275]: overflow evaluating the requirement `Option<_>: Sized` --> mutual-recursion-issue-75860.rs:11:5 | 11 | iso(left, right) | ^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`mutual_recursion_issue_75860`) note: required by a bound in `Option` --> /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:570:17 | 570 | pub enum Option { | ^ required by this bound in `Option` thread 'rustc' panicked at /rustc/ca663b06c5492ac2dde5e53cd11579fa8e4d68bd/compiler/rustc_query_system/src/query/plumbing.rs:290:29: query 'typeck' not cached due to poisoning stack backtrace: 0: 0x7fd35139f7e6 - std::backtrace_rs::backtrace::libunwind::trace::h92488e4bb2264071 at /rustc/ca663b06c5492ac2dde5e53cd11579fa8e4d68bd/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5 1: 0x7fd35139f7e6 - std::backtrace_rs::backtrace::trace_unsynchronized::h97e02be157039c96 at /rustc/ca663b06c5492ac2dde5e53cd11579fa8e4d68bd/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7fd35139f7e6 - std::sys_common::backtrace::_print_fmt::h89a2b01cb3c33339 at /rustc/ca663b06c5492ac2dde5e53cd11579fa8e4d68bd/library/std/src/sys_common/backtrace.rs:68:5 3: 0x7fd35139f7e6 - ::fmt::ha79772b33774e7af at /rustc/ca663b06c5492ac2dde5e53cd11579fa8e4d68bd/library/std/src/sys_common/backtrace.rs:44:22 4: 0x7fd3513f1ed0 - core::fmt::rt::Argument::fmt::h6d2228239beb9437 at /rustc/ca663b06c5492ac2dde5e53cd11579fa8e4d68bd/library/core/src/fmt/rt.rs:142:9 5: 0x7fd3513f1ed0 - core::fmt::write::h9bcb8c2e898ce4b2 at /rustc/ca663b06c5492ac2dde5e53cd11579fa8e4d68bd/library/core/src/fmt/mod.rs:1120:17 6: 0x7fd3513931df - std::io::Write::write_fmt::he7ba80727a5f8d75 at /rustc/ca663b06c5492ac2dde5e53cd11579fa8e4d68bd/library/std/src/io/mod.rs:1810:15 7: 0x7fd35139f5c4 - std::sys_common::backtrace::_print::h9bd2ce6833902b42 at /rustc/ca663b06c5492ac2dde5e53cd11579fa8e4d68bd/library/std/src/sys_common/backtrace.rs:47:5 8: 0x7fd35139f5c4 - std::sys_common::backtrace::print::h09be6e715f2e0cc6 at /rustc/ca663b06c5492ac2dde5e53cd11579fa8e4d68bd/library/std/src/sys_common/backtrace.rs:34:9 9: 0x7fd3513a2357 - std::panicking::default_hook::{{closure}}::h81ac1ebc9ea0357f 10: 0x7fd3513a20b9 - std::panicking::default_hook::hfc7d2f2254fbbaf6 at /rustc/ca663b06c5492ac2dde5e53cd11579fa8e4d68bd/library/std/src/panicking.rs:292:9 11: 0x7fd34e14e03c - std[e13db6861558cd66]::panicking::update_hook::>::{closure#0} 12: 0x7fd3513a2aa6 - as core::ops::function::Fn>::call::h864b8f962a42f35c at /rustc/ca663b06c5492ac2dde5e53cd11579fa8e4d68bd/library/alloc/src/boxed.rs:2030:9 13: 0x7fd3513a2aa6 - std::panicking::rust_panic_with_hook::he5915ec9da668475 at /rustc/ca663b06c5492ac2dde5e53cd11579fa8e4d68bd/library/std/src/panicking.rs:783:13 14: 0x7fd3513a27f2 - std::panicking::begin_panic_handler::{{closure}}::h8912c4af58ae3d2d at /rustc/ca663b06c5492ac2dde5e53cd11579fa8e4d68bd/library/std/src/panicking.rs:657:13 15: 0x7fd35139fce6 - std::sys_common::backtrace::__rust_end_short_backtrace::hfbc35781d5527627 at /rustc/ca663b06c5492ac2dde5e53cd11579fa8e4d68bd/library/std/src/sys_common/backtrace.rs:171:18 16: 0x7fd3513a2550 - rust_begin_unwind at /rustc/ca663b06c5492ac2dde5e53cd11579fa8e4d68bd/library/std/src/panicking.rs:645:5 17: 0x7fd3513ee5d5 - core::panicking::panic_fmt::hc3a8fce14bfb5d21 at /rustc/ca663b06c5492ac2dde5e53cd11579fa8e4d68bd/library/core/src/panicking.rs:72:14 18: 0x7fd34e8cf76e - rustc_query_system[60e151975146506c]::query::plumbing::wait_for_query::>, false, false, false>, rustc_query_impl[ea3ef81316e32b43]::plumbing::QueryCtxt>::{closure#0} 19: 0x7fd34e884016 - rustc_data_structures[b3be3651cdae3ab9]::outline::>, false, false, false>, rustc_query_impl[ea3ef81316e32b43]::plumbing::QueryCtxt>::{closure#0}, !> 20: 0x7fd34f639043 - rustc_query_system[60e151975146506c]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[ea3ef81316e32b43]::plumbing::QueryCtxt, false> 21: 0x7fd34f638450 - rustc_query_impl[ea3ef81316e32b43]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace 22: 0x7fd34fb43b4f - rustc_middle[f3f21a744f51ef87]::query::plumbing::query_get_at::>> 23: 0x7fd34f70ff94 - rustc_hir_typeck[8a944b03b22eb18f]::typeck 24: 0x7fd34f70e475 - rustc_query_impl[ea3ef81316e32b43]::plumbing::__rust_begin_short_backtrace::> 25: 0x7fd34f6387b9 - rustc_query_system[60e151975146506c]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[ea3ef81316e32b43]::plumbing::QueryCtxt, false> 26: 0x7fd34f638450 - rustc_query_impl[ea3ef81316e32b43]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace 27: 0x7fd34f637cd4 - ::par_body_owners::::{closure#0} 28: 0x7fd34e2177da - rayon[803db88657665571]::iter::plumbing::bridge_producer_consumer::helper::, rayon[803db88657665571]::iter::for_each::ForEachConsumer::par_body_owners::{closure#0}>::{closure#0}::{closure#0}>> 29: 0x7fd34e228d0f - rayon_core[f6201257676286fc]::join::join_context::, rayon[803db88657665571]::iter::for_each::ForEachConsumer::par_body_owners::{closure#0}>::{closure#0}::{closure#0}>>::{closure#0}, rayon[803db88657665571]::iter::plumbing::bridge_producer_consumer::helper, rayon[803db88657665571]::iter::for_each::ForEachConsumer::par_body_owners::{closure#0}>::{closure#0}::{closure#0}>>::{closure#1}, (), ()>::{closure#0} 30: 0x7fd34e217979 - rayon[803db88657665571]::iter::plumbing::bridge_producer_consumer::helper::, rayon[803db88657665571]::iter::for_each::ForEachConsumer::par_body_owners::{closure#0}>::{closure#0}::{closure#0}>> 31: 0x7fd34e23d952 - , rayon[803db88657665571]::iter::for_each::ForEachConsumer::par_body_owners::{closure#0}>::{closure#0}::{closure#0}>>::{closure#1}>::{closure#0}, ()> as rayon_core[f6201257676286fc]::job::Job>::execute 32: 0x7fd34dd57c75 - ::wait_until_cold 33: 0x7fd34dd54723 - ::run 34: 0x7fd34e14fd67 - <::spawn<::build_scoped, rustc_driver_impl[f3f951fd75793e59]::run_compiler::{closure#0}>::{closure#0}, core[6f83431ac1278f74]::result::Result<(), rustc_span[b49aba93e0aaec5a]::ErrorGuaranteed>>::{closure#3}::{closure#0}::{closure#0}, rustc_interface[1dfaeeba2be2315d]::util::run_in_thread_pool_with_globals, rustc_driver_impl[f3f951fd75793e59]::run_compiler::{closure#0}>::{closure#0}, core[6f83431ac1278f74]::result::Result<(), rustc_span[b49aba93e0aaec5a]::ErrorGuaranteed>>::{closure#3}::{closure#0}::{closure#1}, core[6f83431ac1278f74]::result::Result<(), rustc_span[b49aba93e0aaec5a]::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}, ()>::{closure#0} as core[6f83431ac1278f74]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 35: 0x7fd34e14929e - std[e13db6861558cd66]::sys_common::backtrace::__rust_begin_short_backtrace:: + core[6f83431ac1278f74]::marker::Send>, ()> 36: 0x7fd34e14fa03 - <::spawn_unchecked_ + core[6f83431ac1278f74]::marker::Send>, ()>::{closure#1} as core[6f83431ac1278f74]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 37: 0x7fd3513ac9d5 - as core::ops::function::FnOnce>::call_once::hb53ed9031b4e247a at /rustc/ca663b06c5492ac2dde5e53cd11579fa8e4d68bd/library/alloc/src/boxed.rs:2016:9 38: 0x7fd3513ac9d5 - as core::ops::function::FnOnce>::call_once::hfb9a49e9b795584d at /rustc/ca663b06c5492ac2dde5e53cd11579fa8e4d68bd/library/alloc/src/boxed.rs:2016:9 39: 0x7fd3513ac9d5 - std::sys::unix::thread::Thread::new::thread_start::h4db5c6ec45610220 at /rustc/ca663b06c5492ac2dde5e53cd11579fa8e4d68bd/library/std/src/sys/unix/thread.rs:108:17 40: 0x7fd34b2749eb - 41: 0x7fd34b2f87cc - 42: 0x0 - 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 attach the file at `/tmp/im/rustc-ice-2024-01-09T21_12_18-2691188.txt` to your bug report note: compiler flags: -Z threads=16 query stack during panic: thread panicked while processing panic. aborting. [1] 2691188 IOT instruction rustc -Zthreads=16 mutual-recursion-issue-75860.rs ```

matthiaskrgr commented 8 months ago

this bisects to https://github.com/rust-lang/rust/pull/119086 hmm

olafes commented 3 months ago

Can't reproduce. This has been failing with overflow since at least #121913. I think this can be closed