Open iamanonymouscs opened 1 year ago
This should be made to error instead of ICE after #115486.
This should be made to error instead of ICE after #115486.
Thank you for your response. I hadn't noticed this issue before🤣~it would be more appropriate to have a proper error message instead of triggering an ICE in this scenario.
Looks like a duplicate of https://github.com/rust-lang/rust/issues/83993
Looks like a duplicate of #83993
Wonderful! The code mentioned in #83993 cannot trigger ICE, but the query stack looks similar after modifying #![feature(const_generics)]
into #![feature(generic_const_exprs)]
.
Yes, if you update it you get basically same ice msg and same query stack
Code
When compiling the following Rust code without enabling the
generic_const_exprs feature
flag, it doesn't trigger an ICE :The provided Rust code triggers an ICE (Internal Compiler Error) during the type-checking of a generic constant expression. The error message indicates a query stack overflow, which occurs when the compiler's query mechanism encounters a recursion or excessive depth.
Meta
rustc --version --verbose
:what's more, The above code also triggers an ICE error on rustc stable 1.72.
Error output
Backtrace
``` thread 'rustc' panicked at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:480:13: `WellFormed(&'a ())` has escaping bound vars, so it cannot be wrapped in a dummy binder. stack backtrace: 0: 0x7f493d5cabec - std::backtrace_rs::backtrace::libunwind::trace::hbfb1354a0607bd0b at /rustc/ec08a0337f3556212525dbf1d3b41e19bdf27621/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5 1: 0x7f493d5cabec - std::backtrace_rs::backtrace::trace_unsynchronized::h0d86af43cec18792 at /rustc/ec08a0337f3556212525dbf1d3b41e19bdf27621/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7f493d5cabec - std::sys_common::backtrace::_print_fmt::h1a9ad677b5782f05 at /rustc/ec08a0337f3556212525dbf1d3b41e19bdf27621/library/std/src/sys_common/backtrace.rs:67:5 3: 0x7f493d5cabec -::fmt::h6f7239a9a00dd18b
at /rustc/ec08a0337f3556212525dbf1d3b41e19bdf27621/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7f493d630dfc - core::fmt::rt::Argument::fmt::had320c4aae37cefe
at /rustc/ec08a0337f3556212525dbf1d3b41e19bdf27621/library/core/src/fmt/rt.rs:138:9
5: 0x7f493d630dfc - core::fmt::write::hcb58283862b95e8f
at /rustc/ec08a0337f3556212525dbf1d3b41e19bdf27621/library/core/src/fmt/mod.rs:1094:21
6: 0x7f493d5bd62e - std::io::Write::write_fmt::h4981a40f92225957
at /rustc/ec08a0337f3556212525dbf1d3b41e19bdf27621/library/std/src/io/mod.rs:1714:15
7: 0x7f493d5ca9d4 - std::sys_common::backtrace::_print::h4bd0ac2934ee7fe5
at /rustc/ec08a0337f3556212525dbf1d3b41e19bdf27621/library/std/src/sys_common/backtrace.rs:47:5
8: 0x7f493d5ca9d4 - std::sys_common::backtrace::print::h2f959f92d1015729
at /rustc/ec08a0337f3556212525dbf1d3b41e19bdf27621/library/std/src/sys_common/backtrace.rs:34:9
9: 0x7f493d5cdaca - std::panicking::panic_hook_with_disk_dump::{{closure}}::hd394741097a335b6
at /rustc/ec08a0337f3556212525dbf1d3b41e19bdf27621/library/std/src/panicking.rs:280:22
10: 0x7f493d5cd7c5 - std::panicking::panic_hook_with_disk_dump::he0c37b922f0af64d
at /rustc/ec08a0337f3556212525dbf1d3b41e19bdf27621/library/std/src/panicking.rs:314:9
11: 0x7f4940775309 - >::call_once::{shim:vtable#0}
12: 0x7f493d5ce383 - as core::ops::function::Fn>::call::h716fa69b5a80630f
at /rustc/ec08a0337f3556212525dbf1d3b41e19bdf27621/library/alloc/src/boxed.rs:2021:9
13: 0x7f493d5ce383 - std::panicking::rust_panic_with_hook::hba72365e18906222
at /rustc/ec08a0337f3556212525dbf1d3b41e19bdf27621/library/std/src/panicking.rs:757:13
14: 0x7f493d5ce101 - std::panicking::begin_panic_handler::{{closure}}::h787568b8d16a1978
at /rustc/ec08a0337f3556212525dbf1d3b41e19bdf27621/library/std/src/panicking.rs:631:13
15: 0x7f493d5cb116 - std::sys_common::backtrace::__rust_end_short_backtrace::h479917b180d73d24
at /rustc/ec08a0337f3556212525dbf1d3b41e19bdf27621/library/std/src/sys_common/backtrace.rs:170:18
16: 0x7f493d5cde42 - rust_begin_unwind
at /rustc/ec08a0337f3556212525dbf1d3b41e19bdf27621/library/std/src/panicking.rs:619:5
17: 0x7f493d62d1a5 - core::panicking::panic_fmt::h549e4fe39f7e4186
at /rustc/ec08a0337f3556212525dbf1d3b41e19bdf27621/library/core/src/panicking.rs:72:14
18: 0x7f493ea09b84 - ::register_wf_obligation
19: 0x7f493ea09905 - ::to_ty
20: 0x7f493e99355d - ::visit_local
21: 0x7f493e991c9e - ::visit_expr
22: 0x7f493f8d6f5e - rustc_hir_typeck[381cd940586e0de2]::typeck
23: 0x7f493e8a5ade - rustc_query_impl[771e3cb305a0dac9]::plumbing::__rust_begin_short_backtrace::>
24: 0x7f493e8a5aae - >::call_once
25: 0x7f493e98dd38 - rustc_query_system[6395160b0cddfe06]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[771e3cb305a0dac9]::plumbing::QueryCtxt, false>
26: 0x7f4940107371 - rustc_query_impl[771e3cb305a0dac9]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
27: 0x7f493f19edaa - rustc_mir_build[5d9174c4e6dc5447]::thir::cx::thir_body
28: 0x7f493e88bc31 - rustc_query_impl[771e3cb305a0dac9]::plumbing::__rust_begin_short_backtrace::>
29: 0x7f493ee2eea2 - rustc_query_system[6395160b0cddfe06]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[771e3cb305a0dac9]::plumbing::QueryCtxt, false>
30: 0x7f49400fcd24 - rustc_query_impl[771e3cb305a0dac9]::query_impl::thir_body::get_query_non_incr::__rust_end_short_backtrace
31: 0x7f493eb6b78f - rustc_query_impl[771e3cb305a0dac9]::plumbing::__rust_begin_short_backtrace::>
32: 0x7f493eb6b675 - >::call_once
33: 0x7f493e8f9095 - rustc_query_system[6395160b0cddfe06]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[771e3cb305a0dac9]::plumbing::QueryCtxt, false>
34: 0x7f49400fd8c5 - rustc_query_impl[771e3cb305a0dac9]::query_impl::thir_abstract_const::get_query_non_incr::__rust_end_short_backtrace
35: 0x7f493e8f820d - rustc_middle[6c892fc15eeb424e]::query::plumbing::query_get_at::>>
36: 0x7f493e8f4255 - <::expand_abstract_consts::Expander as rustc_type_ir[946165c0ef8d5474]::fold::TypeFolder>::fold_const
37: 0x7f493eae03c7 - rustc_trait_selection[1e6526734a7ec9ab]::traits::const_evaluatable::is_const_evaluatable
38: 0x7f493ea885a8 - ::process_obligation
39: 0x7f493ea7e444 - >::process_obligations::
40: 0x7f493f08bb45 - ::assumed_wf_types_and_report_errors
41: 0x7f493f0832cd - rustc_hir_analysis[3e296a520ebedb8b]::check::wfcheck::check_item_fn
42: 0x7f493f07c6d1 - rustc_hir_analysis[3e296a520ebedb8b]::check::wfcheck::check_well_formed
43: 0x7f493e8650ac - rustc_query_impl[771e3cb305a0dac9]::plumbing::__rust_begin_short_backtrace::>
44: 0x7f493f0ec49b - rustc_query_system[6395160b0cddfe06]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[771e3cb305a0dac9]::plumbing::QueryCtxt, false>
45: 0x7f493f0ec1a4 - rustc_query_impl[771e3cb305a0dac9]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
46: 0x7f493faf5b42 - ::par_items::
47: 0x7f493faf575d - rustc_hir_analysis[3e296a520ebedb8b]::check::wfcheck::check_mod_type_wf
48: 0x7f493f457c5c - rustc_query_impl[771e3cb305a0dac9]::plumbing::__rust_begin_short_backtrace::>
49: 0x7f493f457c3e - >::call_once
50: 0x7f493f7adbe8 - rustc_query_system[6395160b0cddfe06]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[771e3cb305a0dac9]::plumbing::QueryCtxt, false>
51: 0x7f4940106cf4 - rustc_query_impl[771e3cb305a0dac9]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
52: 0x7f493fbef33e - rustc_data_structures[5c4fe5736e6441b2]::sync::par_for_each_in::<&[rustc_hir[83ffa566f3d26d1]::hir_id::OwnerId], ::par_for_each_module::{closure#0}>
53: 0x7f493fbee3ea - rustc_hir_analysis[3e296a520ebedb8b]::check_crate
54: 0x7f493fbe7712 - rustc_interface[8114ca1f21f3221d]::passes::analysis
55: 0x7f493fc068aa - rustc_query_impl[771e3cb305a0dac9]::plumbing::__rust_begin_short_backtrace::>
56: 0x7f493fc06899 - >::call_once
57: 0x7f493fec0c74 - rustc_query_system[6395160b0cddfe06]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[771e3cb305a0dac9]::plumbing::QueryCtxt, false>
58: 0x7f493fec09e9 - rustc_query_impl[771e3cb305a0dac9]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
59: 0x7f493fdb0323 - ::enter::>
60: 0x7f493fcb919c - ::enter::, rustc_span[3392f19fbbd364f8]::ErrorGuaranteed>>
61: 0x7f493fcb0038 - std[4630b4a01c2a899b]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[a3bf754034e95f9f]::run_compiler::{closure#1}>::{closure#0}, core[ca4201306d049fa9]::result::Result<(), rustc_span[3392f19fbbd364f8]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ca4201306d049fa9]::result::Result<(), rustc_span[3392f19fbbd364f8]::ErrorGuaranteed>>
62: 0x7f493fcaf7ae - <::spawn_unchecked_, rustc_driver_impl[a3bf754034e95f9f]::run_compiler::{closure#1}>::{closure#0}, core[ca4201306d049fa9]::result::Result<(), rustc_span[3392f19fbbd364f8]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ca4201306d049fa9]::result::Result<(), rustc_span[3392f19fbbd364f8]::ErrorGuaranteed>>::{closure#1} as core[ca4201306d049fa9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
63: 0x7f493d5d8d35 - as core::ops::function::FnOnce>::call_once::h183bb945d1c40ecd
at /rustc/ec08a0337f3556212525dbf1d3b41e19bdf27621/library/alloc/src/boxed.rs:2007:9
64: 0x7f493d5d8d35 - as core::ops::function::FnOnce>::call_once::h791fe323d569b2e6
at /rustc/ec08a0337f3556212525dbf1d3b41e19bdf27621/library/alloc/src/boxed.rs:2007:9
65: 0x7f493d5d8d35 - std::sys::unix::thread::Thread::new::thread_start::hf784ac242542a57b
at /rustc/ec08a0337f3556212525dbf1d3b41e19bdf27621/library/std/src/sys/unix/thread.rs:108:17
66: 0x7f493d49e609 - start_thread
67: 0x7f493d3c1133 - clone
68: 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: please attach the file at `/playground/rustc-ice-2023-09-05T06:55:14.334764402Z-18.txt` to your bug report
note: compiler flags: --crate-type lib -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [typeck] type-checking `foo::{constant#1}`
#1 [thir_body] building THIR for `foo::{constant#1}`
#2 [thir_abstract_const] building an abstract representation for `foo::{constant#1}`
#3 [check_well_formed] checking that `foo` is well-formed
#4 [check_mod_type_wf] checking that types are well-formed in top-level module
#5 [analysis] running analysis passes on this crate
end of query stack
warning: `playground` (lib) generated 1 warning
error: could not compile `playground` (lib) due to previous error; 1 warning emitted
```