rust-lang / rust

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

ICE: `expected usize, got UnevaluatedConst` #116186

Closed matthiaskrgr closed 1 year ago

matthiaskrgr commented 1 year ago

Code

rustc --edition=2018

#![feature(generic_const_exprs)]

pub async fn something(path: &[[usize; N_ISLANDS]; N_ISLANDS]) -> usize {
    async {
        match path {
            [] => 0,

            _ => 1,
        }
    }
    .await
}

Meta

rustc --version --verbose:

rustc 1.74.0-nightly (0288f2e19 2023-09-25)
binary: rustc
commit-hash: 0288f2e1955b154262e0669ec5f7bb9a4c6cf5aa
commit-date: 2023-09-25
host: x86_64-unknown-linux-gnu
release: 1.74.0-nightly
LLVM version: 17.0.0

Error output

error[E0425]: cannot find value `N_ISLANDS` in this scope
 --> icemaker_reduced/112607.rs:3:40
  |
3 | pub async fn something(path: &[[usize; N_ISLANDS]; N_ISLANDS]) -> usize {
  |                                        ^^^^^^^^^ not found in this scope

error[E0425]: cannot find value `N_ISLANDS` in this scope
 --> icemaker_reduced/112607.rs:3:52
  |
3 | pub async fn something(path: &[[usize; N_ISLANDS]; N_ISLANDS]) -> usize {
  |                                                    ^^^^^^^^^ not found in this scope

warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
 --> icemaker_reduced/112607.rs:1:12
  |
1 | #![feature(generic_const_exprs)]
  |            ^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
  = note: `#[warn(incomplete_features)]` on by default

error[E0601]: `main` function not found in crate `112607`
  --> icemaker_reduced/112607.rs:12:2
   |
12 | }
   |  ^ consider adding a `main` function to `icemaker_reduced/112607.rs`
Backtrace

``` error: internal compiler error: /rustc/0288f2e1955b154262e0669ec5f7bb9a4c6cf5aa/compiler/rustc_middle/src/ty/consts.rs:375:32: expected usize, got UnevaluatedConst { def: DefId(0:5 ~ 112607[dbca]::something::{constant#1}), args: [] }: usize thread 'rustc' panicked at /rustc/0288f2e1955b154262e0669ec5f7bb9a4c6cf5aa/compiler/rustc_errors/src/lib.rs:1651:9: Box stack backtrace: 0: 0x7f0b99d6427c - std::backtrace_rs::backtrace::libunwind::trace::he0fa95863765c162 at /rustc/0288f2e1955b154262e0669ec5f7bb9a4c6cf5aa/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5 1: 0x7f0b99d6427c - std::backtrace_rs::backtrace::trace_unsynchronized::h72d5f99a2861d02b at /rustc/0288f2e1955b154262e0669ec5f7bb9a4c6cf5aa/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7f0b99d6427c - std::sys_common::backtrace::_print_fmt::h77a4706f5ef94d01 at /rustc/0288f2e1955b154262e0669ec5f7bb9a4c6cf5aa/library/std/src/sys_common/backtrace.rs:67:5 3: 0x7f0b99d6427c - ::fmt::he943404fecf038b0 at /rustc/0288f2e1955b154262e0669ec5f7bb9a4c6cf5aa/library/std/src/sys_common/backtrace.rs:44:22 4: 0x7f0b99dc9edc - core::fmt::rt::Argument::fmt::h13be5e824c591ca7 at /rustc/0288f2e1955b154262e0669ec5f7bb9a4c6cf5aa/library/core/src/fmt/rt.rs:138:9 5: 0x7f0b99dc9edc - core::fmt::write::hf0c0a3e365f4aeb2 at /rustc/0288f2e1955b154262e0669ec5f7bb9a4c6cf5aa/library/core/src/fmt/mod.rs:1114:21 6: 0x7f0b99d56ffe - std::io::Write::write_fmt::hf6231d334faed5a2 at /rustc/0288f2e1955b154262e0669ec5f7bb9a4c6cf5aa/library/std/src/io/mod.rs:1763:15 7: 0x7f0b99d64064 - std::sys_common::backtrace::_print::h94947374abf91134 at /rustc/0288f2e1955b154262e0669ec5f7bb9a4c6cf5aa/library/std/src/sys_common/backtrace.rs:47:5 8: 0x7f0b99d64064 - std::sys_common::backtrace::print::h7f67412f149682a2 at /rustc/0288f2e1955b154262e0669ec5f7bb9a4c6cf5aa/library/std/src/sys_common/backtrace.rs:34:9 9: 0x7f0b99d66f43 - std::panicking::default_hook::{{closure}}::h0b1ce8078274efb2 at /rustc/0288f2e1955b154262e0669ec5f7bb9a4c6cf5aa/library/std/src/panicking.rs:272:22 10: 0x7f0b99d66c64 - std::panicking::default_hook::h730577ca09276893 at /rustc/0288f2e1955b154262e0669ec5f7bb9a4c6cf5aa/library/std/src/panicking.rs:292:9 11: 0x7f0b9ceeaeef - std[c0c5954477cb1558]::panicking::update_hook::>::{closure#0} 12: 0x7f0b99d67771 - as core::ops::function::Fn>::call::hd44a804e253f6339 at /rustc/0288f2e1955b154262e0669ec5f7bb9a4c6cf5aa/library/alloc/src/boxed.rs:2021:9 13: 0x7f0b99d67771 - std::panicking::rust_panic_with_hook::h1935709438ad84cd at /rustc/0288f2e1955b154262e0669ec5f7bb9a4c6cf5aa/library/std/src/panicking.rs:735:13 14: 0x7f0b9d440b74 - std[c0c5954477cb1558]::panicking::begin_panic::::{closure#0} 15: 0x7f0b9d43ee36 - std[c0c5954477cb1558]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> 16: 0x7f0b9d493946 - std[c0c5954477cb1558]::panicking::begin_panic:: 17: 0x7f0b9d3bf864 - ::bug:: 18: 0x7f0b9d3bf716 - ::bug:: 19: 0x7f0b9d4ab91c - rustc_middle[7958b76fb19d6f0b]::util::bug::opt_span_bug_fmt::::{closure#0} 20: 0x7f0b9d4a893a - rustc_middle[7958b76fb19d6f0b]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} 21: 0x7f0b9d4a8908 - rustc_middle[7958b76fb19d6f0b]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> 22: 0x7f0b9bb0daa0 - rustc_middle[7958b76fb19d6f0b]::util::bug::bug_fmt 23: 0x7f0b9bae0264 - ::prefix_slice_suffix 24: 0x7f0b9badada4 - ::match_candidates 25: 0x7f0b9b536837 - ::lower_match_tree 26: 0x7f0b9b519daf - ::expr_into_dest 27: 0x7f0b9b51a81e - ::expr_into_dest 28: 0x7f0b9b5464fb - ::ast_block_stmts 29: 0x7f0b9b537068 - ::ast_block 30: 0x7f0b9b518994 - ::expr_into_dest 31: 0x7f0b9b51a81e - ::expr_into_dest 32: 0x7f0b9b51a81e - ::expr_into_dest 33: 0x7f0b9bdbb652 - rustc_mir_build[88908c2204838440]::build::mir_built 34: 0x7f0b9b03b6dc - rustc_query_impl[2e6f533721484891]::plumbing::__rust_begin_short_backtrace::> 35: 0x7f0b9b03b6be - >::call_once 36: 0x7f0b9b11d088 - rustc_query_system[d166d5e4d4b6d975]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[2e6f533721484891]::plumbing::QueryCtxt, false> 37: 0x7f0b9c855201 - rustc_query_impl[2e6f533721484891]::query_impl::mir_built::get_query_non_incr::__rust_end_short_backtrace 38: 0x7f0b9c0e16b9 - rustc_mir_transform[69f845bc3665250d]::check_unsafety::unsafety_check_result 39: 0x7f0b9b03b71c - rustc_query_impl[2e6f533721484891]::plumbing::__rust_begin_short_backtrace::> 40: 0x7f0b9b03b6fe - >::call_once 41: 0x7f0b9b11d088 - rustc_query_system[d166d5e4d4b6d975]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[2e6f533721484891]::plumbing::QueryCtxt, false> 42: 0x7f0b9c85bce1 - rustc_query_impl[2e6f533721484891]::query_impl::unsafety_check_result::get_query_non_incr::__rust_end_short_backtrace 43: 0x7f0b9c0e4afd - rustc_mir_transform[69f845bc3665250d]::check_unsafety::unsafety_check_result 44: 0x7f0b9b03b71c - rustc_query_impl[2e6f533721484891]::plumbing::__rust_begin_short_backtrace::> 45: 0x7f0b9b03b6fe - >::call_once 46: 0x7f0b9b11d088 - rustc_query_system[d166d5e4d4b6d975]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[2e6f533721484891]::plumbing::QueryCtxt, false> 47: 0x7f0b9c85bce1 - rustc_query_impl[2e6f533721484891]::query_impl::unsafety_check_result::get_query_non_incr::__rust_end_short_backtrace 48: 0x7f0b9c0e4afd - rustc_mir_transform[69f845bc3665250d]::check_unsafety::unsafety_check_result 49: 0x7f0b9b03b71c - rustc_query_impl[2e6f533721484891]::plumbing::__rust_begin_short_backtrace::> 50: 0x7f0b9b03b6fe - >::call_once 51: 0x7f0b9b11d088 - rustc_query_system[d166d5e4d4b6d975]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[2e6f533721484891]::plumbing::QueryCtxt, false> 52: 0x7f0b9c85bce1 - rustc_query_impl[2e6f533721484891]::query_impl::unsafety_check_result::get_query_non_incr::__rust_end_short_backtrace 53: 0x7f0b9c29603b - rustc_mir_transform[69f845bc3665250d]::mir_const 54: 0x7f0b9b05001e - rustc_query_impl[2e6f533721484891]::plumbing::__rust_begin_short_backtrace::> 55: 0x7f0b9b04ffee - >::call_once 56: 0x7f0b9b11d088 - rustc_query_system[d166d5e4d4b6d975]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[2e6f533721484891]::plumbing::QueryCtxt, false> 57: 0x7f0b9c855571 - rustc_query_impl[2e6f533721484891]::query_impl::mir_const::get_query_non_incr::__rust_end_short_backtrace 58: 0x7f0b9bc4d7d6 - rustc_mir_transform[69f845bc3665250d]::mir_promoted 59: 0x7f0b9b018baf - rustc_query_impl[2e6f533721484891]::plumbing::__rust_begin_short_backtrace::> 60: 0x7f0b9b61e5c8 - rustc_query_system[d166d5e4d4b6d975]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[2e6f533721484891]::plumbing::QueryCtxt, false> 61: 0x7f0b9c856174 - rustc_query_impl[2e6f533721484891]::query_impl::mir_promoted::get_query_non_incr::__rust_end_short_backtrace 62: 0x7f0b9b793cf3 - rustc_borrowck[22ac151c06a46a93]::mir_borrowck 63: 0x7f0b9b04ffbe - rustc_query_impl[2e6f533721484891]::plumbing::__rust_begin_short_backtrace::> 64: 0x7f0b9b04ff8e - >::call_once 65: 0x7f0b9b11d088 - rustc_query_system[d166d5e4d4b6d975]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[2e6f533721484891]::plumbing::QueryCtxt, false> 66: 0x7f0b9c85f991 - rustc_query_impl[2e6f533721484891]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace 67: 0x7f0b9c68cfce - rustc_hir_analysis[b22507afc81669fd]::collect::type_of::opaque::find_opaque_ty_constraints_for_rpit 68: 0x7f0b9c537c41 - rustc_query_impl[2e6f533721484891]::plumbing::__rust_begin_short_backtrace::> 69: 0x7f0b9c537c21 - >::call_once 70: 0x7f0b9b046e60 - rustc_query_system[d166d5e4d4b6d975]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[2e6f533721484891]::plumbing::QueryCtxt, false> 71: 0x7f0b9c852862 - rustc_query_impl[2e6f533721484891]::query_impl::type_of_opaque::get_query_non_incr::__rust_end_short_backtrace 72: 0x7f0b9b950983 - rustc_hir_analysis[b22507afc81669fd]::collect::type_of::type_of 73: 0x7f0b9b29964c - rustc_query_impl[2e6f533721484891]::plumbing::__rust_begin_short_backtrace::> 74: 0x7f0b9b299610 - >::call_once 75: 0x7f0b9b046e60 - rustc_query_system[d166d5e4d4b6d975]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[2e6f533721484891]::plumbing::QueryCtxt, false> 76: 0x7f0b9c8524d1 - rustc_query_impl[2e6f533721484891]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace 77: 0x7f0b9beab436 - rustc_middle[7958b76fb19d6f0b]::query::plumbing::query_get_at::>> 78: 0x7f0b9bea4022 - rustc_hir_analysis[b22507afc81669fd]::check::check::check_mod_item_types 79: 0x7f0b9bd3f1dc - rustc_query_impl[2e6f533721484891]::plumbing::__rust_begin_short_backtrace::> 80: 0x7f0b9bd3f1be - >::call_once 81: 0x7f0b9be8a5c8 - rustc_query_system[d166d5e4d4b6d975]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[2e6f533721484891]::plumbing::QueryCtxt, false> 82: 0x7f0b9c85d994 - rustc_query_impl[2e6f533721484891]::query_impl::check_mod_item_types::get_query_non_incr::__rust_end_short_backtrace 83: 0x7f0b9c45022b - ::time::<(), rustc_hir_analysis[b22507afc81669fd]::check_crate::{closure#6}> 84: 0x7f0b9c44f9f3 - rustc_hir_analysis[b22507afc81669fd]::check_crate 85: 0x7f0b9c44ebd2 - rustc_interface[1634da5f506e2d26]::passes::analysis 86: 0x7f0b9c3e75ba - rustc_query_impl[2e6f533721484891]::plumbing::__rust_begin_short_backtrace::> 87: 0x7f0b9c3e75a9 - >::call_once 88: 0x7f0b9c60d4a4 - rustc_query_system[d166d5e4d4b6d975]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[2e6f533721484891]::plumbing::QueryCtxt, false> 89: 0x7f0b9c60d219 - rustc_query_impl[2e6f533721484891]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace 90: 0x7f0b9c0f53c2 - ::enter::> 91: 0x7f0b9c0f3e41 - rustc_span[68f8f0eb89050f8d]::set_source_map::, rustc_interface[1634da5f506e2d26]::interface::run_compiler, rustc_driver_impl[e02b405ddf0b953d]::run_compiler::{closure#1}>::{closure#0}::{closure#0}> 92: 0x7f0b9c0f2b20 - std[c0c5954477cb1558]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[e02b405ddf0b953d]::run_compiler::{closure#1}>::{closure#0}, core[bfabaa7acdfc93fd]::result::Result<(), rustc_span[68f8f0eb89050f8d]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[bfabaa7acdfc93fd]::result::Result<(), rustc_span[68f8f0eb89050f8d]::ErrorGuaranteed>> 93: 0x7f0b9c7514ae - <::spawn_unchecked_, rustc_driver_impl[e02b405ddf0b953d]::run_compiler::{closure#1}>::{closure#0}, core[bfabaa7acdfc93fd]::result::Result<(), rustc_span[68f8f0eb89050f8d]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[bfabaa7acdfc93fd]::result::Result<(), rustc_span[68f8f0eb89050f8d]::ErrorGuaranteed>>::{closure#1} as core[bfabaa7acdfc93fd]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 94: 0x7f0b99d722d5 - as core::ops::function::FnOnce>::call_once::hade28bf3e4e4dec9 at /rustc/0288f2e1955b154262e0669ec5f7bb9a4c6cf5aa/library/alloc/src/boxed.rs:2007:9 95: 0x7f0b99d722d5 - as core::ops::function::FnOnce>::call_once::h4aba02607116b2de at /rustc/0288f2e1955b154262e0669ec5f7bb9a4c6cf5aa/library/alloc/src/boxed.rs:2007:9 96: 0x7f0b99d722d5 - std::sys::unix::thread::Thread::new::thread_start::hd1c1d3c8b2ad27b1 at /rustc/0288f2e1955b154262e0669ec5f7bb9a4c6cf5aa/library/std/src/sys/unix/thread.rs:108:17 97: 0x7f0b99a8c9eb - 98: 0x7f0b99b10dfc - 99: 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 attach the file at `/tmp/im/rustc-ice-2023-09-26T21:59:40.713655144Z-264566.txt` to your bug report query stack during panic: #0 [mir_built] building MIR for `something::{closure#0}::{closure#0}` #1 [unsafety_check_result] unsafety-checking `something::{closure#0}::{closure#0}` #2 [unsafety_check_result] unsafety-checking `something::{closure#0}` #3 [unsafety_check_result] unsafety-checking `something` #4 [mir_const] preparing `something` for borrow checking #5 [mir_promoted] promoting constants in MIR for `something` #6 [mir_borrowck] borrow-checking `something` #7 [type_of_opaque] computing type of opaque `something::{opaque#0}` #8 [type_of] computing type of `something::{opaque#0}` #9 [check_mod_item_types] checking item types in top-level module #10 [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. For more information about an error, try `rustc --explain E0425`. ```

matthiaskrgr commented 1 year ago

Regression in nightly-2021-09-01

found 9 bors merge commits in the specified range commit[0] 2021-08-30: Auto merge of #88466 - sexxi-goose:issue-88372, r=nikomatsakis commit[1] 2021-08-30: Auto merge of #88369 - lcnr:cec-rename, r=oli-obk commit[2] 2021-08-31: Auto merge of #88100 - HTG-YT:edition2021-compopt-stabilization, r=m-ou-se commit[3] 2021-08-31: Auto merge of #88414 - Aaron1011:guess-foreign-head-span, r=estebank commit[4] 2021-08-31: Auto merge of #88467 - sexxi-goose:issue-88431, r=nikomatsakis commit[5] 2021-08-31: Auto merge of #88491 - RalfJung:miri, r=RalfJung commit[6] 2021-08-31: Auto merge of #88527 - m-ou-se:rollup-az6xtc5, r=m-ou-se commit[7] 2021-08-31: Auto merge of #88535 - m-ou-se:rollup-jeusxbo, r=m-ou-se commit[8] 2021-08-31: Auto merge of #88506 - Mark-Simulacrum:fix-rlibs, r=ehuss