rust-lang / rust

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

generic_const_exprs: internal compiler error #121575

Open danielhuang opened 6 months ago

danielhuang commented 6 months ago

Code

https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=658b83919fb776f6e07570c3bec26cb7

Implementation of primitive recursive functions using generic_const_exprs.

Removing lines 102 to 104 makes the code compile successfully.

Error output

Backtrace

``` thread 'rustc' panicked at /rustc/397937d812852f9bbeb671005cb399dbcb357cde/compiler/rustc_middle/src/util/bug.rs:34:50: Box stack backtrace: 0: 0x7f6197d7daf6 - std::backtrace_rs::backtrace::libunwind::trace::hd6c95564158d2ad1 at /rustc/397937d812852f9bbeb671005cb399dbcb357cde/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5 1: 0x7f6197d7daf6 - std::backtrace_rs::backtrace::trace_unsynchronized::h1e73453937ee07b8 at /rustc/397937d812852f9bbeb671005cb399dbcb357cde/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7f6197d7daf6 - std::sys_common::backtrace::_print_fmt::ha4e1fd706ce229f6 at /rustc/397937d812852f9bbeb671005cb399dbcb357cde/library/std/src/sys_common/backtrace.rs:68:5 3: 0x7f6197d7daf6 - ::fmt::h39795cad8f90e005 at /rustc/397937d812852f9bbeb671005cb399dbcb357cde/library/std/src/sys_common/backtrace.rs:44:22 4: 0x7f6197dcea7c - core::fmt::rt::Argument::fmt::h3960dd13bbb5335d at /rustc/397937d812852f9bbeb671005cb399dbcb357cde/library/core/src/fmt/rt.rs:142:9 5: 0x7f6197dcea7c - core::fmt::write::h2b281d9025b7c47b at /rustc/397937d812852f9bbeb671005cb399dbcb357cde/library/core/src/fmt/mod.rs:1120:17 6: 0x7f6197d7242f - std::io::Write::write_fmt::h18044c54acec8470 at /rustc/397937d812852f9bbeb671005cb399dbcb357cde/library/std/src/io/mod.rs:1846:15 7: 0x7f6197d7d8a4 - std::sys_common::backtrace::_print::h7a96956925b1db50 at /rustc/397937d812852f9bbeb671005cb399dbcb357cde/library/std/src/sys_common/backtrace.rs:47:5 8: 0x7f6197d7d8a4 - std::sys_common::backtrace::print::h154e885ac7142937 at /rustc/397937d812852f9bbeb671005cb399dbcb357cde/library/std/src/sys_common/backtrace.rs:34:9 9: 0x7f6197d805eb - std::panicking::default_hook::{{closure}}::hcfb38eaaff34d735 10: 0x7f6197d80339 - std::panicking::default_hook::h9d19a71b480c31c0 at /rustc/397937d812852f9bbeb671005cb399dbcb357cde/library/std/src/panicking.rs:292:9 11: 0x7f619ac64eec - std[779ce620e254aa3a]::panicking::update_hook::>::{closure#0} 12: 0x7f6197d80d50 - as core::ops::function::Fn>::call::hc19b64bae054e43a at /rustc/397937d812852f9bbeb671005cb399dbcb357cde/library/alloc/src/boxed.rs:2030:9 13: 0x7f6197d80d50 - std::panicking::rust_panic_with_hook::hb2c8227f8d32aff4 at /rustc/397937d812852f9bbeb671005cb399dbcb357cde/library/std/src/panicking.rs:786:13 14: 0x7f619ac91594 - std[779ce620e254aa3a]::panicking::begin_panic::::{closure#0} 15: 0x7f619ac8e1e6 - std[779ce620e254aa3a]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> 16: 0x7f619ac899a6 - std[779ce620e254aa3a]::panicking::begin_panic:: 17: 0x7f61995fd9a1 - ::emit_producing_guarantee 18: 0x7f619b2cec8d - rustc_middle[34d56ef0224e11c8]::util::bug::opt_span_bug_fmt::::{closure#0} 19: 0x7f619b2cedea - rustc_middle[34d56ef0224e11c8]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0} 20: 0x7f619b2ca8d8 - rustc_middle[34d56ef0224e11c8]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !> 21: 0x7f619b2c8354 - rustc_middle[34d56ef0224e11c8]::util::bug::span_bug_fmt:: 22: 0x7f619c230acd - ::visit_operand 23: 0x7f6199d7b0a9 - rustc_monomorphize[5b7faaf956a6659]::collector::collect_items_rec::{closure#0} 24: 0x7f619c92db62 - rustc_monomorphize[5b7faaf956a6659]::collector::collect_items_rec 25: 0x7f619c92e42d - rustc_monomorphize[5b7faaf956a6659]::collector::collect_items_rec 26: 0x7f619c92e42d - rustc_monomorphize[5b7faaf956a6659]::collector::collect_items_rec 27: 0x7f619c92e42d - rustc_monomorphize[5b7faaf956a6659]::collector::collect_items_rec 28: 0x7f619c92e42d - rustc_monomorphize[5b7faaf956a6659]::collector::collect_items_rec 29: 0x7f619c92e42d - rustc_monomorphize[5b7faaf956a6659]::collector::collect_items_rec 30: 0x7f619c928ef6 - rustc_monomorphize[5b7faaf956a6659]::partitioning::collect_and_partition_mono_items 31: 0x7f619c928570 - rustc_query_impl[37c0345f91b53f73]::plumbing::__rust_begin_short_backtrace::> 32: 0x7f619c928555 - >::call_once 33: 0x7f619cf964e2 - rustc_query_system[af6e3207d51907f7]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[37c0345f91b53f73]::plumbing::QueryCtxt, false> 34: 0x7f619cf961d9 - rustc_query_impl[37c0345f91b53f73]::query_impl::collect_and_partition_mono_items::get_query_non_incr::__rust_end_short_backtrace 35: 0x7f619cf39196 - rustc_codegen_ssa[8b5438e7ea0b7061]::base::codegen_crate:: 36: 0x7f619cf38e4d - ::codegen_crate 37: 0x7f619cfcc505 - rustc_interface[55bee3044f76fef8]::passes::start_codegen 38: 0x7f619cfcbcd5 - ::codegen_and_build_linker 39: 0x7f619ccfccea - rustc_interface[55bee3044f76fef8]::interface::run_compiler::, rustc_driver_impl[8762b83a1cb30330]::run_compiler::{closure#0}>::{closure#0} 40: 0x7f619cfada85 - std[779ce620e254aa3a]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[8762b83a1cb30330]::run_compiler::{closure#0}>::{closure#0}, core[bdf7c173800a34bb]::result::Result<(), rustc_span[c4517cadf0848d66]::ErrorGuaranteed>>::{closure#0}, core[bdf7c173800a34bb]::result::Result<(), rustc_span[c4517cadf0848d66]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[bdf7c173800a34bb]::result::Result<(), rustc_span[c4517cadf0848d66]::ErrorGuaranteed>> 41: 0x7f619cfad8b2 - <::spawn_unchecked_, rustc_driver_impl[8762b83a1cb30330]::run_compiler::{closure#0}>::{closure#0}, core[bdf7c173800a34bb]::result::Result<(), rustc_span[c4517cadf0848d66]::ErrorGuaranteed>>::{closure#0}, core[bdf7c173800a34bb]::result::Result<(), rustc_span[c4517cadf0848d66]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[bdf7c173800a34bb]::result::Result<(), rustc_span[c4517cadf0848d66]::ErrorGuaranteed>>::{closure#1} as core[bdf7c173800a34bb]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 42: 0x7f6197d8a725 - as core::ops::function::FnOnce>::call_once::h87bc13705e796148 at /rustc/397937d812852f9bbeb671005cb399dbcb357cde/library/alloc/src/boxed.rs:2016:9 43: 0x7f6197d8a725 - as core::ops::function::FnOnce>::call_once::ha41c2c60d398a7ae at /rustc/397937d812852f9bbeb671005cb399dbcb357cde/library/alloc/src/boxed.rs:2016:9 44: 0x7f6197d8a725 - std::sys::pal::unix::thread::Thread::new::thread_start::h32fa493a81385954 at /rustc/397937d812852f9bbeb671005cb399dbcb357cde/library/std/src/sys/pal/unix/thread.rs:108:17 45: 0x7f6197c99609 - start_thread 46: 0x7f6197bbc353 - clone 47: 0x0 - ```

cushionbadak commented 4 months ago

bisects at 2023-01-10

Log

2023-01-01 ~ 2024-04-30 Log

``` cargo bisect-rustc --script rustc --start 2023-01-01 --end 2024-04-30 --preserve --regress ice -- ../rust/tests/crashes/121575.rs checking the start range to find a passing nightly installing nightly-2023-01-01 testing... RESULT: nightly-2023-01-01, ===> No checking the end range to verify it does not pass installing nightly-2024-04-30 testing... RESULT: nightly-2024-04-30, ===> Yes 243 versions remaining to test after this (roughly 8 steps) installing nightly-2023-08-31 testing... RESULT: nightly-2023-08-31, ===> Yes 121 versions remaining to test after this (roughly 7 steps) installing nightly-2023-05-02 testing... RESULT: nightly-2023-05-02, ===> Yes 61 versions remaining to test after this (roughly 6 steps) installing nightly-2023-03-02 testing... RESULT: nightly-2023-03-02, ===> Yes 30 versions remaining to test after this (roughly 5 steps) installing nightly-2023-01-31 testing... RESULT: nightly-2023-01-31, ===> Yes 15 versions remaining to test after this (roughly 4 steps) installing nightly-2023-01-16 testing... RESULT: nightly-2023-01-16, ===> Yes 8 versions remaining to test after this (roughly 4 steps) installing nightly-2023-01-08 testing... RESULT: nightly-2023-01-08, ===> No 4 versions remaining to test after this (roughly 3 steps) installing nightly-2023-01-12 testing... RESULT: nightly-2023-01-12, ===> Yes 2 versions remaining to test after this (roughly 2 steps) installing nightly-2023-01-10 testing... RESULT: nightly-2023-01-10, ===> Yes 1 versions remaining to test after this (roughly 1 steps) installing nightly-2023-01-09 testing... RESULT: nightly-2023-01-09, ===> No searched toolchains nightly-2023-01-01 through nightly-2024-04-30 ******************************************************************************** Regression in nightly-2023-01-10 ******************************************************************************** fetching https://static.rust-lang.org/dist/2023-01-09/channel-rust-nightly-git-commit-hash.txt nightly manifest 2023-01-09: 40 B / 40 B [=========================================================] 100.00 % 1.26 MB/s converted 2023-01-09 to cc47b069983292e4ee8982d5dabe6301452c5f25 fetching https://static.rust-lang.org/dist/2023-01-10/channel-rust-nightly-git-commit-hash.txt nightly manifest 2023-01-10: 40 B / 40 B [=========================================================] 100.00 % 1.35 MB/s converted 2023-01-10 to 3020239de947ec52677e9b4e853a6a9fc073d1f9 looking for regression commit between 2023-01-09 and 2023-01-10 fetching (via remote github) commits from max(cc47b069983292e4ee8982d5dabe6301452c5f25, 2023-01-07) to 3020239de947ec52677e9b4e853a6a9fc073d1f9 ending github query because we found starting sha: cc47b069983292e4ee8982d5dabe6301452c5f25 get_commits_between returning commits, len: 7 commit[0] 2023-01-08: Auto merge of #106449 - GuillaumeGomez:rustdoc-gui-retry-mechanism, r=Mark-Simulacrum commit[1] 2023-01-08: Auto merge of #90291 - geeklint:loosen_weak_debug_bound, r=dtolnay commit[2] 2023-01-09: Auto merge of #106616 - compiler-errors:rollup-emcj0o3, r=compiler-errors commit[3] 2023-01-09: Auto merge of #106582 - compiler-errors:better-spans-on-bad-tys, r=lcnr commit[4] 2023-01-09: Auto merge of #106340 - saethlin:propagate-operands, r=oli-obk commit[5] 2023-01-09: Auto merge of #101947 - aliemjay:astconv-normalize, r=lcnr commit[6] 2023-01-09: Auto merge of #106637 - fee1-dead-contrib:rollup-ticvmsd, r=fee1-dead ERROR: no CI builds available between cc47b069983292e4ee8982d5dabe6301452c5f25 and 3020239de947ec52677e9b4e853a6a9fc073d1f9 within last 167 days ```

Meta

cargo bisect-rustc --version

cargo-bisect-rustc-bisect-rustc 0.6.8

cargo -Vv

cargo 1.79.0-nightly (b60a15551 2024-04-26)
release: 1.79.0-nightly
commit-hash: b60a1555155111e962018007a6d0ef85207db463
commit-date: 2024-04-26
host: x86_64-unknown-linux-gnu
libgit2: 1.7.2 (sys:0.18.3 vendored)
libcurl: 8.6.0-DEV (sys:0.4.72+curl-8.6.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Ubuntu 22.4.0 (jammy) [64-bit]