rust-lang / rust

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

ICE: `asked to assemble auto trait candidates of unexpected type: FreshTy(0)` #130411

Open matthiaskrgr opened 1 week ago

matthiaskrgr commented 1 week ago

auto-reduced (treereduce-rust):

trait Project {
    const SELF: Self;
}

fn take1(_: Project<SELF = {}>) {}

original:

trait Project {
    const SELF: Self;
}

fn take1(_: Project<SELF = {
    let mut res = Vec::new();
    loop {
        match decode_packet(itr) {
            Some(p) => { res.push(p); },
            None    => break
        }
    }

    return res;
}>) {}

Version information

rustc 1.83.0-nightly (8c2c9a9ef 2024-09-15)
binary: rustc
commit-hash: 8c2c9a9ef527edb453bcee638d34beb0e7b4616b
commit-date: 2024-09-15
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0

Command: /home/matthias/.rustup/toolchains/master/bin/rustc

Program output

``` error[E0658]: associated const equality is incomplete --> /tmp/icemaker_global_tempdir.gI8qCq1Vuhv8/rustc_testrunner_tmpdir_reporting.wExSU1hbC7Cc/mvce.rs:5:21 | 5 | fn take1(_: Project) {} | ^^^^^^^^^ | = note: see issue #92827 for more information = help: add `#![feature(associated_const_equality)]` to the crate attributes to enable = note: this compiler was built on 2024-09-15; consider upgrading it if it is out of date error[E0601]: `main` function not found in crate `mvce` --> /tmp/icemaker_global_tempdir.gI8qCq1Vuhv8/rustc_testrunner_tmpdir_reporting.wExSU1hbC7Cc/mvce.rs:5:35 | 5 | fn take1(_: Project) {} | ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.gI8qCq1Vuhv8/rustc_testrunner_tmpdir_reporting.wExSU1hbC7Cc/mvce.rs` warning: trait objects without an explicit `dyn` are deprecated --> /tmp/icemaker_global_tempdir.gI8qCq1Vuhv8/rustc_testrunner_tmpdir_reporting.wExSU1hbC7Cc/mvce.rs:5:13 | 5 | fn take1(_: Project) {} | ^^^^^^^^^^^^^^^^^^ | = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see = note: `#[warn(bare_trait_objects)]` on by default help: if this is an object-safe trait, use `dyn` | 5 | fn take1(_: dyn Project) {} | +++ error[E0308]: mismatched types --> /tmp/icemaker_global_tempdir.gI8qCq1Vuhv8/rustc_testrunner_tmpdir_reporting.wExSU1hbC7Cc/mvce.rs:5:28 | 5 | fn take1(_: Project) {} | ^^ expected fresh type, found `()` | = note: expected type `FreshTy(0)` found unit type `()` error: internal compiler error: compiler/rustc_infer/src/infer/relate/generalize.rs:464:17: unexpected infer type: FreshTy(0) thread 'rustc' panicked at compiler/rustc_infer/src/infer/relate/generalize.rs:464:17: Box stack backtrace: 0: 0x7f8b8806c1da - ::fmt::hf576e3db34dcd4c0 1: 0x7f8b88803297 - core::fmt::write::h6031a1fcd647db63 2: 0x7f8b89710373 - std::io::Write::write_fmt::h9c4d18eebfa610c9 3: 0x7f8b8806c032 - std::sys::backtrace::BacktraceLock::print::hd5d6f94195a58c57 4: 0x7f8b8806e7b1 - std::panicking::default_hook::{{closure}}::he12b6c1c70a494ea 5: 0x7f8b8806e5e4 - std::panicking::default_hook::h79139f377ef49e73 6: 0x7f8b8717090f - std[1fc20c4bf4345a88]::panicking::update_hook::>::{closure#0} 7: 0x7f8b8806eed8 - std::panicking::rust_panic_with_hook::hb2e822dcfa6f992d 8: 0x7f8b871aa631 - std[1fc20c4bf4345a88]::panicking::begin_panic::::{closure#0} 9: 0x7f8b8719de46 - std[1fc20c4bf4345a88]::sys::backtrace::__rust_end_short_backtrace::::{closure#0}, !> 10: 0x7f8b87199389 - std[1fc20c4bf4345a88]::panicking::begin_panic:: 11: 0x7f8b871b3951 - ::emit_producing_guarantee 12: 0x7f8b877d10e4 - rustc_middle[75f727fe079a4f22]::util::bug::opt_span_bug_fmt::::{closure#0} 13: 0x7f8b877b6bda - rustc_middle[75f727fe079a4f22]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} 14: 0x7f8b877b6a8b - rustc_middle[75f727fe079a4f22]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> 15: 0x7f8b84d715c0 - rustc_middle[75f727fe079a4f22]::util::bug::bug_fmt 16: 0x7f8b888e7f52 - >::tys::{closure#0} 17: 0x7f8b888d7bdf - >::tys 18: 0x7f8b888c7c92 - ::coerce 19: 0x7f8b88a30655 - rustc_hir_typeck[4fd6adf6e1b8df80]::typeck 20: 0x7f8b88a2dd25 - rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::__rust_begin_short_backtrace::> 21: 0x7f8b88c776bd - rustc_query_system[5ff4688cf420f9ff]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::QueryCtxt, false> 22: 0x7f8b88c7628d - rustc_query_impl[85a0e4e3d1ea5e51]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace 23: 0x7f8b890a433d - rustc_mir_build[a4d1425a7ec00b3f]::thir::pattern::check_match::check_match 24: 0x7f8b890a3a63 - rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::__rust_begin_short_backtrace::> 25: 0x7f8b890a31d8 - rustc_query_system[5ff4688cf420f9ff]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::QueryCtxt, false> 26: 0x7f8b890a2e5d - rustc_query_impl[85a0e4e3d1ea5e51]::query_impl::check_match::get_query_non_incr::__rust_end_short_backtrace 27: 0x7f8b890b15d2 - rustc_mir_build[a4d1425a7ec00b3f]::build::mir_build 28: 0x7f8b88806dd4 - rustc_mir_transform[24b7b05644591e31]::mir_built 29: 0x7f8b88806d97 - rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::__rust_begin_short_backtrace::> 30: 0x7f8b88c776bd - rustc_query_system[5ff4688cf420f9ff]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::QueryCtxt, false> 31: 0x7f8b88c771cd - rustc_query_impl[85a0e4e3d1ea5e51]::query_impl::mir_built::get_query_non_incr::__rust_end_short_backtrace 32: 0x7f8b89132f27 - rustc_mir_transform[24b7b05644591e31]::mir_const_qualif 33: 0x7f8b89132e1b - rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::__rust_begin_short_backtrace::> 34: 0x7f8b8913220b - rustc_query_system[5ff4688cf420f9ff]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::QueryCtxt, false> 35: 0x7f8b89131fa3 - rustc_query_impl[85a0e4e3d1ea5e51]::query_impl::mir_const_qualif::get_query_non_incr::__rust_end_short_backtrace 36: 0x7f8b85ccdc73 - rustc_mir_transform[24b7b05644591e31]::mir_promoted 37: 0x7f8b88d30f92 - rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::__rust_begin_short_backtrace::> 38: 0x7f8b88d3125a - rustc_query_system[5ff4688cf420f9ff]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::QueryCtxt, false> 39: 0x7f8b89857190 - rustc_query_impl[85a0e4e3d1ea5e51]::query_impl::mir_promoted::get_query_non_incr::__rust_end_short_backtrace 40: 0x7f8b89857283 - rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::__rust_begin_short_backtrace::> 41: 0x7f8b88c776bd - rustc_query_system[5ff4688cf420f9ff]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::QueryCtxt, false> 42: 0x7f8b88c77113 - rustc_query_impl[85a0e4e3d1ea5e51]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace 43: 0x7f8b88c7ff2d - rustc_mir_transform[24b7b05644591e31]::mir_drops_elaborated_and_const_checked 44: 0x7f8b88c7f555 - rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::__rust_begin_short_backtrace::> 45: 0x7f8b88c776bd - rustc_query_system[5ff4688cf420f9ff]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::QueryCtxt, false> 46: 0x7f8b88c77065 - rustc_query_impl[85a0e4e3d1ea5e51]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace 47: 0x7f8b891477b9 - rustc_mir_transform[24b7b05644591e31]::mir_for_ctfe 48: 0x7f8b89147679 - rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::__rust_begin_short_backtrace::> 49: 0x7f8b8882f8ae - rustc_query_system[5ff4688cf420f9ff]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::QueryCtxt, false> 50: 0x7f8b88fe75af - rustc_query_impl[85a0e4e3d1ea5e51]::query_impl::mir_for_ctfe::get_query_non_incr::__rust_end_short_backtrace 51: 0x7f8b88fe76f0 - >::load_mir 52: 0x7f8b862184f2 - rustc_const_eval[f76452ba52d780f5]::const_eval::eval_queries::eval_to_allocation_raw_provider 53: 0x7f8b88fe8e76 - rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::__rust_begin_short_backtrace::> 54: 0x7f8b88fe8692 - rustc_query_system[5ff4688cf420f9ff]::query::plumbing::try_execute_query::, rustc_middle[75f727fe079a4f22]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::QueryCtxt, false> 55: 0x7f8b88fe826f - rustc_query_impl[85a0e4e3d1ea5e51]::query_impl::eval_to_allocation_raw::get_query_non_incr::__rust_end_short_backtrace 56: 0x7f8b88fdaeaf - rustc_const_eval[f76452ba52d780f5]::const_eval::valtrees::eval_to_valtree 57: 0x7f8b88fdacc3 - )>>::call_once 58: 0x7f8b88fdac7a - rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::__rust_begin_short_backtrace::> 59: 0x7f8b88fdac3b - )>>::call_once 60: 0x7f8b88fe876d - rustc_query_system[5ff4688cf420f9ff]::query::plumbing::try_execute_query::, rustc_middle[75f727fe079a4f22]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::QueryCtxt, false> 61: 0x7f8b88fe808a - rustc_query_impl[85a0e4e3d1ea5e51]::query_impl::eval_to_valtree::get_query_non_incr::__rust_end_short_backtrace 62: 0x7f8b891d21c2 - rustc_middle[75f727fe079a4f22]::query::plumbing::query_get_at::, rustc_middle[75f727fe079a4f22]::query::erase::Erased<[u8; 24usize]>>> 63: 0x7f8b891d1c28 - ::const_eval_global_id_for_typeck 64: 0x7f8b891d0bbe - ::const_eval_resolve_for_typeck 65: 0x7f8b891d084a - ::eval 66: 0x7f8b891d033c - >::fold_const 67: 0x7f8b87e117f3 - >::try_fold_with:: 68: 0x7f8b87f06468 - >::fold_binder::> 69: 0x7f8b88fb7a17 - >::try_super_fold_with:: 70: 0x7f8b88e5d2b9 - ::normalize:: 71: 0x7f8b88e5bd60 - rustc_hir_analysis[f9d0127424903d94]::check::wfcheck::check_fn_or_method 72: 0x7f8b88e5e2f5 - rustc_hir_analysis[f9d0127424903d94]::check::wfcheck::check_item_fn 73: 0x7f8b85f37f61 - rustc_hir_analysis[f9d0127424903d94]::check::wfcheck::check_well_formed 74: 0x7f8b88d1a3c7 - rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::__rust_begin_short_backtrace::> 75: 0x7f8b88d1a63e - rustc_query_system[5ff4688cf420f9ff]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::QueryCtxt, false> 76: 0x7f8b88d1a3a2 - rustc_query_impl[85a0e4e3d1ea5e51]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace 77: 0x7f8b88d1b153 - rustc_hir_analysis[f9d0127424903d94]::check::wfcheck::check_mod_type_wf 78: 0x7f8b88d1af91 - rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::__rust_begin_short_backtrace::> 79: 0x7f8b896aa5bb - rustc_query_system[5ff4688cf420f9ff]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::QueryCtxt, false> 80: 0x7f8b896aa36d - rustc_query_impl[85a0e4e3d1ea5e51]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace 81: 0x7f8b88c73a49 - rustc_hir_analysis[f9d0127424903d94]::check_crate 82: 0x7f8b88c70705 - rustc_interface[21c67170a9071fc5]::passes::run_required_analyses 83: 0x7f8b895166de - rustc_interface[21c67170a9071fc5]::passes::analysis 84: 0x7f8b895166b1 - rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::__rust_begin_short_backtrace::> 85: 0x7f8b896ae22e - rustc_query_system[5ff4688cf420f9ff]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[85a0e4e3d1ea5e51]::plumbing::QueryCtxt, false> 86: 0x7f8b896adf8f - rustc_query_impl[85a0e4e3d1ea5e51]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace 87: 0x7f8b89500bbc - rustc_interface[21c67170a9071fc5]::interface::run_compiler::, rustc_driver_impl[bd499d3fdd772cd8]::run_compiler::{closure#0}>::{closure#1} 88: 0x7f8b895c8850 - std[1fc20c4bf4345a88]::sys::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[bd499d3fdd772cd8]::run_compiler::{closure#0}>::{closure#1}, core[72d89f67a2ed16cb]::result::Result<(), rustc_span[a0fd5433b72e73f5]::ErrorGuaranteed>>::{closure#0}, core[72d89f67a2ed16cb]::result::Result<(), rustc_span[a0fd5433b72e73f5]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[72d89f67a2ed16cb]::result::Result<(), rustc_span[a0fd5433b72e73f5]::ErrorGuaranteed>> 89: 0x7f8b895c8eba - <::spawn_unchecked_, rustc_driver_impl[bd499d3fdd772cd8]::run_compiler::{closure#0}>::{closure#1}, core[72d89f67a2ed16cb]::result::Result<(), rustc_span[a0fd5433b72e73f5]::ErrorGuaranteed>>::{closure#0}, core[72d89f67a2ed16cb]::result::Result<(), rustc_span[a0fd5433b72e73f5]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[72d89f67a2ed16cb]::result::Result<(), rustc_span[a0fd5433b72e73f5]::ErrorGuaranteed>>::{closure#1} as core[72d89f67a2ed16cb]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 90: 0x7f8b895c92ab - std::sys::pal::unix::thread::Thread::new::thread_start::hfd4e0f9214174c65 91: 0x7f8b8ad4739d - 92: 0x7f8b8adcc49c - 93: 0x0 - 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 (8c2c9a9ef 2024-09-15) running on x86_64-unknown-linux-gnu query stack during panic: #0 [typeck] type-checking `take1::{constant#0}` #1 [check_match] match-checking `take1::{constant#0}` end of query stack error: aborting due to 4 previous errors; 1 warning emitted Some errors have detailed explanations: E0308, E0601, E0658. For more information about an error, try `rustc --explain E0308`. ```

matthiaskrgr commented 1 week ago

Regression in nightly-2024-03-12 commit[0] 2024-03-10: Auto merge of #122306 - workingjubilee:backtrace-0.3.70, r=workingjubilee commit[1] 2024-03-10: Auto merge of #122312 - matthiaskrgr:rollup-0p8y7gg, r=matthiaskrgr commit[2] 2024-03-11: Auto merge of #122132 - nnethercote:diag-renaming3, r=nnethercote commit[3] 2024-03-11: Auto merge of #121752 - mu001999:dead_code/improve, r=pnkfelix commit[4] 2024-03-11: Auto merge of #122050 - erikdesjardins:sret, r=nikic commit[5] 2024-03-11: Auto merge of #117156 - jmillikin:os-unix-socket-ext, r=Amanieu,dtolnay commit[6] 2024-03-11: Auto merge of #122331 - jhpratt:rollup-cbl8xsy, r=jhpratt commit[7] 2024-03-11: Auto merge of #122305 - Nilstrieb:target-tiers, r=davidtwco commit[8] 2024-03-11: Auto merge of #122140 - oli-obk:track_errors13, r=davidtwco commit[9] 2024-03-11: Auto merge of #122338 - workingjubilee:rollup-xzpt4v4, r=workingjubilee commit[10] 2024-03-11: Auto merge of #121796 - oli-obk:eager_opaque_checks3, r=lcnr commit[11] 2024-03-11: Auto merge of #112267 - lqd:win-1cgu, r=Kobzol

fmease commented 1 week ago

cc #123456, #123140, #125957 (all different symptoms, same root cause)