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: generic_const_exprs: ´assertion failed: self.errors_reported` #109141

Closed matthiaskrgr closed 1 year ago

matthiaskrgr commented 1 year ago

Code

#![feature(generic_const_exprs)]
pub fn main() {}

impl EntriesBuffer {
    fn a(&self) -> impl Iterator {
        self.0.iter_mut()
    }
}

struct EntriesBuffer(Box<[[u8; HashesEntryLEN]; 5]>);

Meta

rustc --version --verbose:

rustc 1.70.0-nightly (22f247c6f 2023-03-13)
binary: rustc
commit-hash: 22f247c6f3ed388cb702d01c2ff27da658a8b353
commit-date: 2023-03-13
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 15.0.7

Error output

error[E0425]: cannot find value `HashesEntryLEN` in this scope
  --> treereduce.out:10:32
   |
10 | struct EntriesBuffer(Box<[[u8; HashesEntryLEN]; 5]>);
   |                                ^^^^^^^^^^^^^^ not found in this scope
Backtrace

``` thread 'rustc' panicked at 'assertion failed: self.errors_reported', compiler/rustc_borrowck/src/type_check/mod.rs:533:21 stack backtrace: 0: 0x7f389356651a - std::backtrace_rs::backtrace::libunwind::trace::h1ac6254167c780d9 at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5 1: 0x7f389356651a - std::backtrace_rs::backtrace::trace_unsynchronized::hec2af85915e24f36 at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7f389356651a - std::sys_common::backtrace::_print_fmt::h58a4e3535fcce206 at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/sys_common/backtrace.rs:65:5 3: 0x7f389356651a - ::fmt::h5107e13758b8321c at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/sys_common/backtrace.rs:44:22 4: 0x7f38935c9c5e - core::fmt::write::h2e851dc027730d81 at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/core/src/fmt/mod.rs:1232:17 5: 0x7f3893559375 - std::io::Write::write_fmt::hca00074de9f85084 at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/io/mod.rs:1684:15 6: 0x7f38935662e5 - std::sys_common::backtrace::_print::h870053c845cddf24 at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/sys_common/backtrace.rs:47:5 7: 0x7f38935662e5 - std::sys_common::backtrace::print::hb56add862f96c5fd at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/sys_common/backtrace.rs:34:9 8: 0x7f389356905f - std::panicking::default_hook::{{closure}}::h636d4ba3ff8fdc46 at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/panicking.rs:271:22 9: 0x7f3893568d9b - std::panicking::default_hook::hf29b58145ee6e43c at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/panicking.rs:290:9 10: 0x7f38968580c5 - >::call_once::{shim:vtable#0} 11: 0x7f389356989d - as core::ops::function::Fn>::call::h7342d57f33f6634f at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/alloc/src/boxed.rs:2002:9 12: 0x7f389356989d - std::panicking::rust_panic_with_hook::hbf9ef936d990c16f at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/panicking.rs:696:13 13: 0x7f38935695d2 - std::panicking::begin_panic_handler::{{closure}}::h6be6433dcb901f4b at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/panicking.rs:581:13 14: 0x7f3893566986 - std::sys_common::backtrace::__rust_end_short_backtrace::h802b6104a4d80829 at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/sys_common/backtrace.rs:150:18 15: 0x7f3893569322 - rust_begin_unwind at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/panicking.rs:579:5 16: 0x7f38935c5fb3 - core::panicking::panic_fmt::hf7a8a88b9669732e at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/core/src/panicking.rs:64:14 17: 0x7f38935c604d - core::panicking::panic::h23010f9a5cb8b3d2 at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/core/src/panicking.rs:114:5 18: 0x7f38957ed586 - ::visit_place 19: 0x7f38957d1bcd - ::visit_body 20: 0x7f389577ceab - rustc_borrowck[a500f257ebd25aaf]::nll::compute_regions 21: 0x7f389574d7c8 - rustc_borrowck[a500f257ebd25aaf]::do_mir_borrowck 22: 0x7f3895746b4e - rustc_borrowck[a500f257ebd25aaf]::mir_borrowck 23: 0x7f38959d3ac6 - rustc_query_system[f881c7f40ee7dcf0]::query::plumbing::try_execute_query:: 24: 0x7f38959d36a3 - ::mir_borrowck 25: 0x7f3895e1c6fb - rustc_hir_analysis[80836a89449caedf]::collect::type_of::type_of 26: 0x7f389519dc35 - rustc_query_system[f881c7f40ee7dcf0]::query::plumbing::try_execute_query:: 27: 0x7f389519c55d - ::type_of 28: 0x7f389490da3e - rustc_hir_analysis[80836a89449caedf]::check::check::check_mod_item_types 29: 0x7f3895e9be9e - rustc_query_system[f881c7f40ee7dcf0]::query::plumbing::try_execute_query:: 30: 0x7f3895e9ba23 - ::check_mod_item_types 31: 0x7f3894c482c4 - ::time::<(), rustc_hir_analysis[80836a89449caedf]::check_crate::{closure#6}> 32: 0x7f3894c45208 - rustc_hir_analysis[80836a89449caedf]::check_crate 33: 0x7f3894c3b1b2 - rustc_interface[ceda1fd77ec39e1b]::passes::analysis 34: 0x7f3896076a4c - rustc_query_system[f881c7f40ee7dcf0]::query::plumbing::try_execute_query:: 35: 0x7f3896076740 - ::analysis 36: 0x7f3895e9f789 - ::enter::> 37: 0x7f3895a8ef08 - rustc_span[18b84908941c7cdf]::with_source_map::, rustc_interface[ceda1fd77ec39e1b]::interface::run_compiler, rustc_driver_impl[74350ec99973fded]::run_compiler::{closure#1}>::{closure#0}::{closure#0}> 38: 0x7f3895a8616c - std[1337fb43929788f1]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[74350ec99973fded]::run_compiler::{closure#1}>::{closure#0}, core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>> 39: 0x7f3895a85b9a - <::spawn_unchecked_, rustc_driver_impl[74350ec99973fded]::run_compiler::{closure#1}>::{closure#0}, core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2011dc7817943e09]::result::Result<(), rustc_span[18b84908941c7cdf]::ErrorGuaranteed>>::{closure#1} as core[2011dc7817943e09]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 40: 0x7f3893573793 - as core::ops::function::FnOnce>::call_once::h7e0474dd3b8659fa at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/alloc/src/boxed.rs:1988:9 41: 0x7f3893573793 - as core::ops::function::FnOnce>::call_once::heb8c41cf543a5c11 at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/alloc/src/boxed.rs:1988:9 42: 0x7f3893573793 - std::sys::unix::thread::Thread::new::thread_start::hc791abe67253fe06 at /rustc/22f247c6f3ed388cb702d01c2ff27da658a8b353/library/std/src/sys/unix/thread.rs:108:17 43: 0x7f3893305bb5 - 44: 0x7f3893387d90 - 45: 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: rustc 1.70.0-nightly (22f247c6f 2023-03-13) running on x86_64-unknown-linux-gnu query stack during panic: #0 [mir_borrowck] borrow-checking `::a` #1 [type_of] computing type of `::a::{opaque#0}` #2 [check_mod_item_types] checking item types in top-level module #3 [analysis] running analysis passes on this crate end of query stack error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0425`. ```

matthiaskrgr commented 1 year ago

searched toolchains 01fbc5ae789fc0c7a2da71d3cd908451f175e4eb through 7632db0e87d8adccc9a83a47795c9411b1455855


Regression in f5418b09e84883c4de2e652a147ab9faff4eee29


JohnTitor commented 1 year ago

Triage: Fixed on the latest nightly, @rustbot labels: +E-needs-test