Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE error: Assertion failed in compiler/rustc_ty_utils/src/instance.rs:103:13 #117696

Open
iamanonymouscs opened this issue Nov 8, 2023 · 2 comments
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@iamanonymouscs
Copy link

Code

cat code.rs

fn main() {
    let mut it = (Empty);
    rec(&mut it);
}

struct Empty;

impl Iterator for Empty {
    type Item = ();
    fn next<'a>(&'a mut self) -> core::option::Option<()> {
        None
    }
}

fn identity<T>(x: T) -> T {
    x
}

fn rec<T>(mut it: T)
where
    T: Iterator,
{
    if () == () {
        T::count(it);
    } else {
        rec(identity(&mut it))
    }
}

Meta

rustc --version --verbose:

rustc 1.75.0-nightly (7adc89b69 2023-11-07)
binary: rustc
commit-hash: 7adc89b69b941afceadcf8609dd6b2999353e550
commit-date: 2023-11-07
host: x86_64-unknown-linux-gnu
release: 1.75.0-nightly
LLVM version: 17.0.4

The same problem is reproduced on the stable version(1.73.0 cc66ad468 2023-10-03)

Error output

rustc code.rs

warning: unnecessary parentheses around assigned value
 --> code.rs:2:18
  |
2 |     let mut it = (Empty);
  |                  ^     ^
  |
  = note: `#[warn(unused_parens)]` on by default
help: remove these parentheses
  |
2 -     let mut it = (Empty);
2 +     let mut it = Empty;
  |

thread 'rustc' panicked at compiler/rustc_ty_utils/src/instance.rs:103:13:
assertion failed: !rcvr_args.has_infer()
Backtrace

stack backtrace:
   0:     0x7f05b0cf1cfc - std::backtrace_rs::backtrace::libunwind::trace::h5537bbd154806f59
                               at /rustc/7adc89b69b941afceadcf8609dd6b2999353e550/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f05b0cf1cfc - std::backtrace_rs::backtrace::trace_unsynchronized::hc161d98f857540db
                               at /rustc/7adc89b69b941afceadcf8609dd6b2999353e550/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f05b0cf1cfc - std::sys_common::backtrace::_print_fmt::h4c1c3b705b28156a
                               at /rustc/7adc89b69b941afceadcf8609dd6b2999353e550/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f05b0cf1cfc - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0307538b827551fd
                               at /rustc/7adc89b69b941afceadcf8609dd6b2999353e550/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f05b0d53f20 - core::fmt::rt::Argument::fmt::h478ea729acec0585
                               at /rustc/7adc89b69b941afceadcf8609dd6b2999353e550/library/core/src/fmt/rt.rs:142:9
   5:     0x7f05b0d53f20 - core::fmt::write::hd245c5370776cdd5
                               at /rustc/7adc89b69b941afceadcf8609dd6b2999353e550/library/core/src/fmt/mod.rs:1117:17
   6:     0x7f05b0ce5c1f - std::io::Write::write_fmt::hfbfb5cc218327f78
                               at /rustc/7adc89b69b941afceadcf8609dd6b2999353e550/library/std/src/io/mod.rs:1763:15
   7:     0x7f05b0cf1ae4 - std::sys_common::backtrace::_print::hb0911569cc7c7f62
                               at /rustc/7adc89b69b941afceadcf8609dd6b2999353e550/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f05b0cf1ae4 - std::sys_common::backtrace::print::h726d39a9d4ba5a1b
                               at /rustc/7adc89b69b941afceadcf8609dd6b2999353e550/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f05b0cf4777 - std::panicking::default_hook::{{closure}}::h82ba92f7be888d70
  10:     0x7f05b0cf44df - std::panicking::default_hook::hc218ff80dc9e4cd7
                               at /rustc/7adc89b69b941afceadcf8609dd6b2999353e550/library/std/src/panicking.rs:292:9
  11:     0x7f05b3a2e7c0 - std[3218d6cd77b0d06f]::panicking::update_hook::<alloc[b3fb55f8a078529e]::boxed::Box<rustc_driver_impl[ddf04b8681d0fb7f]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f05b0cf4eb8 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hfd09a4f105e6083e
                               at /rustc/7adc89b69b941afceadcf8609dd6b2999353e550/library/alloc/src/boxed.rs:2021:9
  13:     0x7f05b0cf4eb8 - std::panicking::rust_panic_with_hook::h0290e6db2f0dd7a2
                               at /rustc/7adc89b69b941afceadcf8609dd6b2999353e550/library/std/src/panicking.rs:783:13
  14:     0x7f05b0cf4bd9 - std::panicking::begin_panic_handler::{{closure}}::h7a45355f37d0a7a0
                               at /rustc/7adc89b69b941afceadcf8609dd6b2999353e550/library/std/src/panicking.rs:649:13
  15:     0x7f05b0cf21c6 - std::sys_common::backtrace::__rust_end_short_backtrace::hefe3cc14b81c89c0
                               at /rustc/7adc89b69b941afceadcf8609dd6b2999353e550/library/std/src/sys_common/backtrace.rs:170:18
  16:     0x7f05b0cf4972 - rust_begin_unwind
                               at /rustc/7adc89b69b941afceadcf8609dd6b2999353e550/library/std/src/panicking.rs:645:5
  17:     0x7f05b0d50645 - core::panicking::panic_fmt::h46033962df62bf84
                               at /rustc/7adc89b69b941afceadcf8609dd6b2999353e550/library/core/src/panicking.rs:72:14
  18:     0x7f05b0d506e3 - core::panicking::panic::h3df56cba124c6fd8
                               at /rustc/7adc89b69b941afceadcf8609dd6b2999353e550/library/core/src/panicking.rs:127:5
  19:     0x7f05b2664830 - rustc_ty_utils[960730023ce9d82d]::instance::resolve_instance
  20:     0x7f05b4c49769 - rustc_query_impl[4e47b2e9cc97378d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[4e47b2e9cc97378d]::query_impl::resolve_instance::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1d9f98b98706d2de]::query::erase::Erased<[u8; 32usize]>>
  21:     0x7f05b4c49aab - rustc_query_system[42a82f5a7de036a2]::query::plumbing::try_execute_query::<rustc_query_impl[4e47b2e9cc97378d]::DynamicConfig<rustc_query_system[42a82f5a7de036a2]::query::caches::DefaultCache<rustc_middle[1d9f98b98706d2de]::ty::ParamEnvAnd<(rustc_span[84fcc9c9f755a0da]::def_id::DefId, &rustc_middle[1d9f98b98706d2de]::ty::list::List<rustc_middle[1d9f98b98706d2de]::ty::generic_args::GenericArg>)>, rustc_middle[1d9f98b98706d2de]::query::erase::Erased<[u8; 32usize]>>, false, false, false>, rustc_query_impl[4e47b2e9cc97378d]::plumbing::QueryCtxt, false>
  22:     0x7f05b4c496e1 - rustc_query_impl[4e47b2e9cc97378d]::query_impl::resolve_instance::get_query_non_incr::__rust_end_short_backtrace
  23:     0x7f05b4c46565 - <rustc_middle[1d9f98b98706d2de]::ty::instance::Instance>::expect_resolve
  24:     0x7f05b2b78b5d - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec::{closure#0}
  25:     0x7f05b5b330df - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  26:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  27:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  28:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  29:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  30:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  31:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  32:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  33:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  34:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  35:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  36:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  37:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  38:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  39:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  40:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  41:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  42:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  43:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  44:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  45:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  46:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  47:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  48:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  49:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  50:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  51:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  52:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  53:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  54:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  55:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  56:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  57:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  58:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  59:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  60:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  61:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  62:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  63:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  64:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  65:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  66:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  67:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  68:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  69:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  70:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  71:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  72:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  73:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  74:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  75:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  76:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  77:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  78:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  79:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  80:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  81:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  82:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  83:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  84:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  85:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  86:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  87:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  88:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  89:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  90:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  91:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  92:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  93:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  94:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  95:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  96:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  97:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  98:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
  99:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 100:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 101:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 102:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 103:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 104:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 105:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 106:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 107:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 108:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 109:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 110:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 111:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 112:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 113:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 114:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 115:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 116:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 117:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 118:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 119:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 120:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 121:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 122:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 123:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 124:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 125:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 126:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 127:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 128:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 129:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 130:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 131:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 132:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 133:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 134:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 135:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 136:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 137:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 138:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 139:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 140:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 141:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 142:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 143:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 144:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 145:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 146:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 147:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 148:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 149:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 150:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 151:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 152:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 153:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 154:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 155:     0x7f05b5b335da - rustc_monomorphize[1593c952df30dad4]::collector::collect_items_rec
 156:     0x7f05b5b2ec94 - rustc_monomorphize[1593c952df30dad4]::partitioning::collect_and_partition_mono_items
 157:     0x7f05b5b2dfe4 - rustc_query_impl[4e47b2e9cc97378d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[4e47b2e9cc97378d]::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1d9f98b98706d2de]::query::erase::Erased<[u8; 24usize]>>
 158:     0x7f05b5b2dfc9 - <rustc_query_impl[4e47b2e9cc97378d]::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2} as core[8a68bd8e0f0c6481]::ops::function::FnOnce<(rustc_middle[1d9f98b98706d2de]::ty::context::TyCtxt, ())>>::call_once
 159:     0x7f05b5b2d5c7 - rustc_query_system[42a82f5a7de036a2]::query::plumbing::try_execute_query::<rustc_query_impl[4e47b2e9cc97378d]::DynamicConfig<rustc_query_system[42a82f5a7de036a2]::query::caches::SingleCache<rustc_middle[1d9f98b98706d2de]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[4e47b2e9cc97378d]::plumbing::QueryCtxt, false>
 160:     0x7f05b5b2d2c9 - rustc_query_impl[4e47b2e9cc97378d]::query_impl::collect_and_partition_mono_items::get_query_non_incr::__rust_end_short_backtrace
 161:     0x7f05b54d6f4e - rustc_codegen_ssa[1aedc3416d28b980]::base::codegen_crate::<rustc_codegen_llvm[4f6287d33c037344]::LlvmCodegenBackend>
 162:     0x7f05b54d6bfa - <rustc_codegen_llvm[4f6287d33c037344]::LlvmCodegenBackend as rustc_codegen_ssa[1aedc3416d28b980]::traits::backend::CodegenBackend>::codegen_crate
 163:     0x7f05b54d5297 - rustc_interface[c2a09eed6a0b2444]::passes::start_codegen
 164:     0x7f05b54d4c63 - <rustc_interface[c2a09eed6a0b2444]::queries::Queries>::ongoing_codegen
 165:     0x7f05b5b49085 - rustc_interface[c2a09eed6a0b2444]::interface::run_compiler::<core[8a68bd8e0f0c6481]::result::Result<(), rustc_span[84fcc9c9f755a0da]::ErrorGuaranteed>, rustc_driver_impl[ddf04b8681d0fb7f]::run_compiler::{closure#1}>::{closure#0}
 166:     0x7f05b5b76dca - std[3218d6cd77b0d06f]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[c2a09eed6a0b2444]::util::run_in_thread_with_globals<rustc_interface[c2a09eed6a0b2444]::util::run_in_thread_pool_with_globals<rustc_interface[c2a09eed6a0b2444]::interface::run_compiler<core[8a68bd8e0f0c6481]::result::Result<(), rustc_span[84fcc9c9f755a0da]::ErrorGuaranteed>, rustc_driver_impl[ddf04b8681d0fb7f]::run_compiler::{closure#1}>::{closure#0}, core[8a68bd8e0f0c6481]::result::Result<(), rustc_span[84fcc9c9f755a0da]::ErrorGuaranteed>>::{closure#0}, core[8a68bd8e0f0c6481]::result::Result<(), rustc_span[84fcc9c9f755a0da]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[8a68bd8e0f0c6481]::result::Result<(), rustc_span[84fcc9c9f755a0da]::ErrorGuaranteed>>
 167:     0x7f05b5b76bf3 - <<std[3218d6cd77b0d06f]::thread::Builder>::spawn_unchecked_<rustc_interface[c2a09eed6a0b2444]::util::run_in_thread_with_globals<rustc_interface[c2a09eed6a0b2444]::util::run_in_thread_pool_with_globals<rustc_interface[c2a09eed6a0b2444]::interface::run_compiler<core[8a68bd8e0f0c6481]::result::Result<(), rustc_span[84fcc9c9f755a0da]::ErrorGuaranteed>, rustc_driver_impl[ddf04b8681d0fb7f]::run_compiler::{closure#1}>::{closure#0}, core[8a68bd8e0f0c6481]::result::Result<(), rustc_span[84fcc9c9f755a0da]::ErrorGuaranteed>>::{closure#0}, core[8a68bd8e0f0c6481]::result::Result<(), rustc_span[84fcc9c9f755a0da]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[8a68bd8e0f0c6481]::result::Result<(), rustc_span[84fcc9c9f755a0da]::ErrorGuaranteed>>::{closure#1} as core[8a68bd8e0f0c6481]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
 168:     0x7f05b0cffc25 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hafee0634ee8690ea
                               at /rustc/7adc89b69b941afceadcf8609dd6b2999353e550/library/alloc/src/boxed.rs:2007:9
 169:     0x7f05b0cffc25 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h23cfdaad852345bd
                               at /rustc/7adc89b69b941afceadcf8609dd6b2999353e550/library/alloc/src/boxed.rs:2007:9
 170:     0x7f05b0cffc25 - std::sys::unix::thread::Thread::new::thread_start::h8311638266b07778
                               at /rustc/7adc89b69b941afceadcf8609dd6b2999353e550/library/std/src/sys/unix/thread.rs:108:17
 171:     0x7f05b0bee609 - start_thread
 172:     0x7f05b0b11133 - clone
 173:                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 attach the file at `/home/rustc-ice-2023-11-08T01_42_21-6589.txt` to your bug report

query stack during panic:
thread panicked while processing panic. aborting.
Aborted (core dumped)

@iamanonymouscs iamanonymouscs added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 8, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 8, 2023
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 8, 2023
@DaniPopes
Copy link
Contributor

DaniPopes commented Nov 8, 2023

Minimal:

fn main() {
    rec(&mut None::<()>.into_iter());
}

fn rec<T: Iterator>(mut it: T) {
    if true {
        it.next();
    } else {
        rec(&mut it);
    }
}

Interestingly, another assertion fails when using -C incremental (Cargo):

thread 'rustc' panicked at /rustc/7adc89b69b941afceadcf8609dd6b2999353e550/compiler/rustc_type_ir/src/ty_kind.rs:844:17:
type variables should not be hashed: ?0t

rustc-ice-2023-11-08T10_44_03-358826.txt


Both ICEs:

$ cargo bisect-rustc --start 2017-08-14 --regress ice
$ cargo bisect-rustc --start 2017-08-14 --regress ice --without-cargo --script=rustc -- src/main.rs

searched toolchains nightly-2017-08-14 through nightly-2023-11-08
Regression in nightly-2023-04-16

found 10 bors merge commits in the specified range
commit[0] 2023-04-14: Auto merge of #110331 - matthiaskrgr:rollup-9vldvow, r=matthiaskrgr
commit[1] 2023-04-14: Auto merge of #110197 - cjgillot:codegen-discr, r=pnkfelix
commit[2] 2023-04-15: Auto merge of #110142 - Mark-Simulacrum:reduce-core-counts, r=pietroalbini
commit[3] 2023-04-15: Auto merge of #109802 - notriddle:notriddle/rustdoc-search-generics-nested, r=GuillaumeGomez
commit[4] 2023-04-15: Auto merge of #110335 - asomers:rust-gdb-freebsd, r=jyn514
commit[5] 2023-04-15: Auto merge of #109900 - cjgillot:disable-const-prop, r=oli-obk
commit[6] 2023-04-15: Auto merge of #110323 - lcnr:dropck-uwu, r=compiler-errors
commit[7] 2023-04-15: Auto merge of #110349 - rust-lang:pa-bump-1.71.0, r=pietroalbini
commit[8] 2023-04-15: Auto merge of #110227 - klensy:bs-win, r=Mark-Simulacrum
commit[9] 2023-04-15: Auto merge of #110361 - ehuss:disable-jobserver-error, r=Mark-Simulacrum

@iamanonymouscs
Copy link
Author

Another test case:

fn main() {
    rec(&mut Empty);
}
struct Empty;
impl Iterator for Empty {
    type Item = ();
    fn next<'a>(&'a mut self) -> core::option::Option<()> {
        None
    }
}
fn identity<T>(x: T) -> T {
    x
}
fn rec<T>(mut it: T)
where
    T: Iterator,
{
    if () == () {
        T::count(it);
    } else {
        rec(identity(&mut it))
    }
}

@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants