rust-lang / rust

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

ICE: `asked to assemble builtin bounds of unexpected type: FreshTy(0)` #123456

Open matthiaskrgr opened 7 months ago

matthiaskrgr commented 7 months ago

code:

trait Project {
    const SELF: Self;
}

fn take1(
    _: Project<
        SELF = {
                   j2.join().unwrap();
               },
    >,
) {
}

Version information

rustc 1.79.0-nightly (a77322c16 2024-04-02)
binary: rustc
commit-hash: a77322c16f188402fa22a5e87100acce42433cbc
commit-date: 2024-04-02
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.2

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

Program output

``` error[E0425]: cannot find value `j2` in this scope --> ice.rs:8:20 | 8 | j2.join().unwrap(); | ^^ not found in this scope error[E0658]: associated const equality is incomplete --> ice.rs:7:9 | 7 | / SELF = { 8 | | j2.join().unwrap(); 9 | | }, | |________________^ | = 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-04-01; consider upgrading it if it is out of date error[E0601]: `main` function not found in crate `ice` --> ice.rs:12:2 | 12 | } | ^ consider adding a `main` function to `ice.rs` warning: trait objects without an explicit `dyn` are deprecated --> ice.rs:6:8 | 6 | _: Project< | ________^ 7 | | SELF = { 8 | | j2.join().unwrap(); 9 | | }, 10 | | >, | |_____^ | = 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` | 6 | _: dyn Project< | +++ error: internal compiler error: compiler/rustc_trait_selection/src/traits/select/mod.rs:2142:17: asked to assemble builtin bounds of unexpected type: FreshTy(0) thread 'rustc' panicked at compiler/rustc_trait_selection/src/traits/select/mod.rs:2142:17: Box stack backtrace: 0: 0x7753015f2ab5 - std::backtrace_rs::backtrace::libunwind::trace::h5e86bffdda571081 at /rustc/1684a753dbca5d23b2e03568e6fbbb48eb72d0e6/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5 1: 0x7753015f2ab5 - std::backtrace_rs::backtrace::trace_unsynchronized::h4840edcbcc7e117b at /rustc/1684a753dbca5d23b2e03568e6fbbb48eb72d0e6/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7753015f2ab5 - std::sys_common::backtrace::_print_fmt::h49f9d2a3b38d3265 at /rustc/1684a753dbca5d23b2e03568e6fbbb48eb72d0e6/library/std/src/sys_common/backtrace.rs:68:5 3: 0x7753015f2ab5 - ::fmt::h22fedb9c27df8384 at /rustc/1684a753dbca5d23b2e03568e6fbbb48eb72d0e6/library/std/src/sys_common/backtrace.rs:44:22 4: 0x775301641cfb - core::fmt::rt::Argument::fmt::h7d92fedbe4ca8dae at /rustc/1684a753dbca5d23b2e03568e6fbbb48eb72d0e6/library/core/src/fmt/rt.rs:142:9 5: 0x775301641cfb - core::fmt::write::h239b5b3f6d552091 at /rustc/1684a753dbca5d23b2e03568e6fbbb48eb72d0e6/library/core/src/fmt/mod.rs:1153:17 6: 0x7753015e769f - std::io::Write::write_fmt::h104f15578b8aef5e at /rustc/1684a753dbca5d23b2e03568e6fbbb48eb72d0e6/library/std/src/io/mod.rs:1843:15 7: 0x7753015f288e - std::sys_common::backtrace::_print::h01bdd24d8b8cf2a6 at /rustc/1684a753dbca5d23b2e03568e6fbbb48eb72d0e6/library/std/src/sys_common/backtrace.rs:47:5 8: 0x7753015f288e - std::sys_common::backtrace::print::haaea7f67046a5f9d at /rustc/1684a753dbca5d23b2e03568e6fbbb48eb72d0e6/library/std/src/sys_common/backtrace.rs:34:9 9: 0x7753015f52d9 - std::panicking::default_hook::{{closure}}::hfdd7194dd22830d8 10: 0x7753015f5043 - std::panicking::default_hook::h2423e5cd9c76c18c at /rustc/1684a753dbca5d23b2e03568e6fbbb48eb72d0e6/library/std/src/panicking.rs:291:9 11: 0x7752fdfff82f - std[ffd0afd40c23a66b]::panicking::update_hook::>::{closure#0} 12: 0x7753015f59dc - as core::ops::function::Fn>::call::h4f7174da91e62aae at /rustc/1684a753dbca5d23b2e03568e6fbbb48eb72d0e6/library/alloc/src/boxed.rs:2032:9 13: 0x7753015f59dc - std::panicking::rust_panic_with_hook::h13aa4870c5fa7445 at /rustc/1684a753dbca5d23b2e03568e6fbbb48eb72d0e6/library/std/src/panicking.rs:792:13 14: 0x7752fe02f7b4 - std[ffd0afd40c23a66b]::panicking::begin_panic::::{closure#0} 15: 0x7752fe02c526 - std[ffd0afd40c23a66b]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> 16: 0x7752fe02c206 - std[ffd0afd40c23a66b]::panicking::begin_panic:: 17: 0x7752fe038a11 - ::emit_producing_guarantee 18: 0x7752fe4cd16c - rustc_middle[b24e7ff436be1cdb]::util::bug::opt_span_bug_fmt::::{closure#0} 19: 0x7752fe4b0e3a - rustc_middle[b24e7ff436be1cdb]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} 20: 0x7752fe4b0cbb - rustc_middle[b24e7ff436be1cdb]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> 21: 0x7752fc11c2b0 - rustc_middle[b24e7ff436be1cdb]::util::bug::bug_fmt 22: 0x7752fc09aa8b - ::candidate_from_obligation_no_cache 23: 0x7752fbfcdf23 - ::process_obligation 24: 0x7752ff40d1c7 - >::process_obligations:: 25: 0x7752ffc2ca2b - ::check_argument_types 26: 0x7753004ab103 - ::check_method_argument_types 27: 0x7752ffdc2d41 - ::check_expr_with_expectation_and_args 28: 0x7752ffdc2c2c - ::check_expr_with_expectation_and_args 29: 0x7752ffdbd0a6 - ::check_block_with_expected 30: 0x7752ffdc2bf7 - ::check_expr_with_expectation_and_args 31: 0x7752ff5f2445 - rustc_hir_typeck[301e32f4ff213aee]::typeck 32: 0x7752ff5f05d7 - rustc_query_impl[e4150b7ad05f9ce5]::plumbing::__rust_begin_short_backtrace::> 33: 0x7752ff5dd5b1 - rustc_query_system[e9aa61bedf025f9c]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[e4150b7ad05f9ce5]::plumbing::QueryCtxt, false> 34: 0x7752ff5d9a0c - rustc_query_impl[e4150b7ad05f9ce5]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace 35: 0x7752ff824d88 - rustc_mir_build[74f63c492aaa1616]::thir::pattern::check_match::check_match 36: 0x7752ff823ef5 - rustc_query_impl[e4150b7ad05f9ce5]::plumbing::__rust_begin_short_backtrace::> 37: 0x7752ffb7607c - rustc_query_system[e9aa61bedf025f9c]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[e4150b7ad05f9ce5]::plumbing::QueryCtxt, false> 38: 0x7752ffb75d15 - rustc_query_impl[e4150b7ad05f9ce5]::query_impl::check_match::get_query_non_incr::__rust_end_short_backtrace 39: 0x7752ff814173 - rustc_mir_build[74f63c492aaa1616]::build::mir_build 40: 0x7752ff813606 - rustc_query_impl[e4150b7ad05f9ce5]::plumbing::__rust_begin_short_backtrace::> 41: 0x7752ff5dd5b1 - rustc_query_system[e9aa61bedf025f9c]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[e4150b7ad05f9ce5]::plumbing::QueryCtxt, false> 42: 0x7752ff5dd18c - rustc_query_impl[e4150b7ad05f9ce5]::query_impl::mir_built::get_query_non_incr::__rust_end_short_backtrace 43: 0x7752ff5dceb5 - rustc_middle[b24e7ff436be1cdb]::query::plumbing::query_get_at::>> 44: 0x7752ffb67b41 - rustc_mir_transform[26553d121dafebc7]::mir_const_qualif 45: 0x7752ffb67af5 - rustc_query_impl[e4150b7ad05f9ce5]::plumbing::__rust_begin_short_backtrace::> 46: 0x7752ffb675cb - rustc_query_system[e9aa61bedf025f9c]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[e4150b7ad05f9ce5]::plumbing::QueryCtxt, false> 47: 0x7752ffb67349 - rustc_query_impl[e4150b7ad05f9ce5]::query_impl::mir_const_qualif::get_query_non_incr::__rust_end_short_backtrace 48: 0x7752ffb67176 - rustc_middle[b24e7ff436be1cdb]::query::plumbing::query_get_at::>> 49: 0x7752fcf726b6 - rustc_mir_transform[26553d121dafebc7]::mir_promoted 50: 0x7752ff704712 - rustc_query_impl[e4150b7ad05f9ce5]::plumbing::__rust_begin_short_backtrace::> 51: 0x7752ff7049c9 - rustc_query_system[e9aa61bedf025f9c]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[e4150b7ad05f9ce5]::plumbing::QueryCtxt, false> 52: 0x7752ff70460f - rustc_query_impl[e4150b7ad05f9ce5]::query_impl::mir_promoted::get_query_non_incr::__rust_end_short_backtrace 53: 0x7752ff5db732 - rustc_borrowck[2d4acfe3c6e3a1fc]::mir_borrowck 54: 0x7752ff5db667 - rustc_query_impl[e4150b7ad05f9ce5]::plumbing::__rust_begin_short_backtrace::> 55: 0x7752ff5dd5b1 - rustc_query_system[e9aa61bedf025f9c]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[e4150b7ad05f9ce5]::plumbing::QueryCtxt, false> 56: 0x7752ff5dd0cc - rustc_query_impl[e4150b7ad05f9ce5]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace 57: 0x7752ffb6ed6b - rustc_mir_transform[26553d121dafebc7]::mir_drops_elaborated_and_const_checked 58: 0x7752ffb6e465 - rustc_query_impl[e4150b7ad05f9ce5]::plumbing::__rust_begin_short_backtrace::> 59: 0x7752ff5dd5b1 - rustc_query_system[e9aa61bedf025f9c]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[e4150b7ad05f9ce5]::plumbing::QueryCtxt, false> 60: 0x7752ff5dcf5c - rustc_query_impl[e4150b7ad05f9ce5]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace 61: 0x7752ff5dceb5 - rustc_middle[b24e7ff436be1cdb]::query::plumbing::query_get_at::>> 62: 0x7752ffb6d22c - rustc_mir_transform[26553d121dafebc7]::mir_for_ctfe 63: 0x7752ffb6d19b - rustc_query_impl[e4150b7ad05f9ce5]::plumbing::__rust_begin_short_backtrace::> 64: 0x7752ff5c3621 - rustc_query_system[e9aa61bedf025f9c]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[e4150b7ad05f9ce5]::plumbing::QueryCtxt, false> 65: 0x7752fffd2d7a - rustc_query_impl[e4150b7ad05f9ce5]::query_impl::mir_for_ctfe::get_query_non_incr::__rust_end_short_backtrace 66: 0x7752fffd308a - >::load_mir 67: 0x7752fffd4e9b - rustc_const_eval[8a01ac89c9fa5245]::const_eval::eval_queries::eval_to_allocation_raw_provider 68: 0x7752fffd4bfc - rustc_query_impl[e4150b7ad05f9ce5]::plumbing::__rust_begin_short_backtrace::> 69: 0x7752fffd1c96 - rustc_query_system[e9aa61bedf025f9c]::query::plumbing::try_execute_query::, rustc_middle[b24e7ff436be1cdb]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[e4150b7ad05f9ce5]::plumbing::QueryCtxt, false> 70: 0x7752fffd186c - rustc_query_impl[e4150b7ad05f9ce5]::query_impl::eval_to_allocation_raw::get_query_non_incr::__rust_end_short_backtrace 71: 0x7752fffd13f6 - rustc_middle[b24e7ff436be1cdb]::query::plumbing::query_get_at::, rustc_middle[b24e7ff436be1cdb]::query::erase::Erased<[u8; 24usize]>>> 72: 0x7752fffb6ee1 - rustc_const_eval[8a01ac89c9fa5245]::const_eval::valtrees::eval_to_valtree 73: 0x7752fffb6e62 - )>>::call_once 74: 0x7752fffb6e36 - rustc_query_impl[e4150b7ad05f9ce5]::plumbing::__rust_begin_short_backtrace::> 75: 0x7752fffb6def - )>>::call_once 76: 0x7752fffd1d71 - rustc_query_system[e9aa61bedf025f9c]::query::plumbing::try_execute_query::, rustc_middle[b24e7ff436be1cdb]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[e4150b7ad05f9ce5]::plumbing::QueryCtxt, false> 77: 0x7752ff7b346c - rustc_query_impl[e4150b7ad05f9ce5]::query_impl::eval_to_valtree::get_query_non_incr::__rust_end_short_backtrace 78: 0x7752ff7b2054 - rustc_middle[b24e7ff436be1cdb]::query::plumbing::query_get_at::, rustc_middle[b24e7ff436be1cdb]::query::erase::Erased<[u8; 24usize]>>> 79: 0x7752ffd04bcc - ::const_eval_global_id_for_typeck 80: 0x7752ffd04351 - ::const_eval_resolve_for_typeck 81: 0x7752ffd040d6 - ::eval 82: 0x7752ff5ed341 - >::fold_const 83: 0x7752feb07aed - >::fold_binder:: 84: 0x7752ffc472ef - >::try_super_fold_with:: 85: 0x7752ffa5c02c - ::normalize:: 86: 0x7752ffa5ce4b - rustc_hir_analysis[a8349f78157af7d8]::check::wfcheck::check_fn_or_method 87: 0x7752ffa5accf - rustc_hir_analysis[a8349f78157af7d8]::check::wfcheck::check_item_fn 88: 0x7752ffa69dfb - rustc_hir_analysis[a8349f78157af7d8]::check::wfcheck::check_well_formed 89: 0x7752ffa686a1 - rustc_query_impl[e4150b7ad05f9ce5]::plumbing::__rust_begin_short_backtrace::> 90: 0x7752ffa67e40 - rustc_query_system[e9aa61bedf025f9c]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[e4150b7ad05f9ce5]::plumbing::QueryCtxt, false> 91: 0x7752ffa67bbf - rustc_query_impl[e4150b7ad05f9ce5]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace 92: 0x7752ffa65afa - rustc_hir_analysis[a8349f78157af7d8]::check::wfcheck::check_mod_type_wf 93: 0x7752ffa65933 - rustc_query_impl[e4150b7ad05f9ce5]::plumbing::__rust_begin_short_backtrace::> 94: 0x7752ffef56f0 - rustc_query_system[e9aa61bedf025f9c]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[e4150b7ad05f9ce5]::plumbing::QueryCtxt, false> 95: 0x7752ffef549b - rustc_query_impl[e4150b7ad05f9ce5]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace 96: 0x7752ff5d7cbb - rustc_hir_analysis[a8349f78157af7d8]::check_crate 97: 0x7752ff8ee02a - rustc_interface[93c8c2723e408a6]::passes::analysis 98: 0x7752ff8edb9b - rustc_query_impl[e4150b7ad05f9ce5]::plumbing::__rust_begin_short_backtrace::> 99: 0x77530022c1a5 - rustc_query_system[e9aa61bedf025f9c]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[e4150b7ad05f9ce5]::plumbing::QueryCtxt, false> 100: 0x77530022bf09 - rustc_query_impl[e4150b7ad05f9ce5]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace 101: 0x7753000bfad3 - rustc_interface[93c8c2723e408a6]::interface::run_compiler::, rustc_driver_impl[e4eb3d84a143a5f9]::run_compiler::{closure#0}>::{closure#0} 102: 0x77530018cbd3 - std[ffd0afd40c23a66b]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[e4eb3d84a143a5f9]::run_compiler::{closure#0}>::{closure#0}, core[191c6f300f408019]::result::Result<(), rustc_span[b2d5999a99633be2]::ErrorGuaranteed>>::{closure#0}, core[191c6f300f408019]::result::Result<(), rustc_span[b2d5999a99633be2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[191c6f300f408019]::result::Result<(), rustc_span[b2d5999a99633be2]::ErrorGuaranteed>> 103: 0x77530018c9e1 - <::spawn_unchecked_, rustc_driver_impl[e4eb3d84a143a5f9]::run_compiler::{closure#0}>::{closure#0}, core[191c6f300f408019]::result::Result<(), rustc_span[b2d5999a99633be2]::ErrorGuaranteed>>::{closure#0}, core[191c6f300f408019]::result::Result<(), rustc_span[b2d5999a99633be2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[191c6f300f408019]::result::Result<(), rustc_span[b2d5999a99633be2]::ErrorGuaranteed>>::{closure#1} as core[191c6f300f408019]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 104: 0x7753015ff3fb - as core::ops::function::FnOnce>::call_once::h61713b2cd6851117 at /rustc/1684a753dbca5d23b2e03568e6fbbb48eb72d0e6/library/alloc/src/boxed.rs:2018:9 105: 0x7753015ff3fb - as core::ops::function::FnOnce>::call_once::h040bc52a2545405a at /rustc/1684a753dbca5d23b2e03568e6fbbb48eb72d0e6/library/alloc/src/boxed.rs:2018:9 106: 0x7753015ff3fb - std::sys::pal::unix::thread::Thread::new::thread_start::h5a10eabef2ee4b3d at /rustc/1684a753dbca5d23b2e03568e6fbbb48eb72d0e6/library/std/src/sys/pal/unix/thread.rs:108:17 107: 0x7752faea955a - 108: 0x7752faf26a3c - 109: 0x0 - note: it seems that this compiler `1.79.0-nightly (1684a753d 2024-04-01)` is outdated, a newer nightly should have been released in the mean time | = note: please consider running `rustup update nightly` to update the nightly channel and check if this problem still persists = note: if the problem still persists, 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-04-04T14_40_18-3815281.txt` to your bug report query stack during panic: #0 [typeck] type-checking `take1::{constant#0}` #1 [check_match] match-checking `take1::{constant#0}` #2 [mir_built] building MIR for `take1::{constant#0}` #3 [mir_const_qualif] const checking `take1::{constant#0}` #4 [mir_promoted] promoting constants in MIR for `take1::{constant#0}` #5 [mir_borrowck] borrow-checking `take1::{constant#0}` #6 [mir_drops_elaborated_and_const_checked] elaborating drops for `take1::{constant#0}` #7 [mir_for_ctfe] caching mir of `take1::{constant#0}` for CTFE #8 [eval_to_allocation_raw] const-evaluating + checking `take1::{constant#0}` #9 [eval_to_valtree] evaluating type-level constant #10 [check_well_formed] checking that `take1` is well-formed #11 [check_mod_type_wf] checking that types are well-formed in top-level module #12 [analysis] running analysis passes on this crate end of query stack error: aborting due to 4 previous errors; 1 warning emitted Some errors have detailed explanations: E0425, E0601, E0658. For more information about an error, try `rustc --explain E0425`. ```

matthiaskrgr commented 7 months ago

Regression in nightly-2022-02-03

cuviper commented 7 months ago

:one: :two: :three: :four: :five: :six:

matthiaskrgr commented 7 months ago

?

cuviper commented 7 months ago

Don't mind me, just highlighting the neat issue number.

matthiaskrgr commented 7 months ago

nr firefox is not amused :rofl:

cuviper commented 7 months ago

Must be a font thing, because Firefox is fine for me: image

But of course this is irrelevant to the ICE, so I'll be quiet now. :speak_no_evil: