Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE when using a generic const expression in a where clause #134978

Open
jullanggit opened this issue Dec 31, 2024 · 0 comments
Open

ICE when using a generic const expression in a where clause #134978

jullanggit opened this issue Dec 31, 2024 · 0 comments
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-compiler-parallel Working group: Parallelizing the compiler

Comments

@jullanggit
Copy link

Disclaimer

I know the feature generic_const_exprs is incomplete, and don't expect it to fully work. This is just in case this is a new issue and could be helpful.

Code

#![feature(generic_const_exprs)]

pub struct Struct<const N: usize>;

impl<const N: usize> Struct<N> {
    pub const OK: usize = 0;
}

fn main() {
    function::<0>();
}

fn function<const NUM_CARDS: usize>()
where
    [(); Struct::<{ NUM_CARDS + 0 }>::OK]:,
{
}

Meta

rustc --version --verbose:

rustc 1.85.0-nightly (7f75bfa1a 2024-12-30)
binary: rustc
commit-hash: 7f75bfa1ad4e9a9d33a179a90603001515e91991
commit-date: 2024-12-30
host: x86_64-unknown-linux-gnu
release: 1.85.0-nightly
LLVM version: 19.1.6

Error output

thread 'rustc query cycle handler' panicked at compiler/rustc_query_system/src/query/job.rs:504:9:
deadlock detected as we're unable to find a query cycle to break
Backtrace

❯ RUST_BACKTRACE=full cargo run
   Compiling ice v0.1.0 (/home/user/.config/rebos/files/common/home/user/Code/rust/ice)
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
 --> src/main.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

thread 'rustc query cycle handler' panicked at compiler/rustc_query_system/src/query/job.rs:504:9:
deadlock detected as we're unable to find a query cycle to break
current query map:
{"reason":"compiler-message","package_id":"path+file:///home/user/.config/rebos/files/common/home/user/Code/rust/ice#0.1.0","manifest_path":"/home/user/.config/rebos/files/common/home/user/Code/rust/ice/Cargo.toml","target":{"kind":["bin"],"crate_types":["bin"],"name":"ice","src_path":"/home/user/.config/rebos/files/common/home/user/Code/rust/ice/src/main.rs","edition":"2024","doc":true,"doctest":false,"test":true},"message":{}}
stack backtrace:
   0:     0x767883ccccea - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hfeb90fd9b5398c4f
   1:     0x767884413466 - core::fmt::write::hd020802d4198e71b
   2:     0x76788531abd1 - std::io::Write::write_fmt::h7e2e8e4cf92a8d65
   3:     0x767883cccb42 - std::sys::backtrace::BacktraceLock::print::h66b4c03e5039d072
   4:     0x767883ccf049 - std::panicking::default_hook::{{closure}}::hcc157a01562efcba
   5:     0x767883ccee92 - std::panicking::default_hook::h21db3d7d04627650
   6:     0x767882e3a688 - std[cb5a7f0ea0430aa5]::panicking::update_hook::<alloc[dd9cf49c51639ce8]::boxed::Box<rustc_driver_impl[a708e1f659847ef0]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x767883ccf803 - std::panicking::rust_panic_with_hook::h6f76ca5eeec77396
   8:     0x767883ccf4fa - std::panicking::begin_panic_handler::{{closure}}::hf108fef1bd19d641
   9:     0x767883ccd199 - std::sys::backtrace::__rust_end_short_backtrace::heff692e62eddffc0
  10:     0x767883ccf1bd - rust_begin_unwind
  11:     0x76788099d390 - core::panicking::panic_fmt::h98a3fbf157fea8f4
  12:     0x7678838790da - rustc_query_system[7637a88347177bdb]::query::job::break_query_cycles
  13:     0x767882e30f3c - std[cb5a7f0ea0430aa5]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[5a45d25d69207022]::util::run_in_thread_pool_with_globals<rustc_interface[5a45d25d69207022]::interface::run_compiler<(), rustc_driver_impl[a708e1f659847ef0]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#2}::{closure#1}, ()>
  14:     0x767882e3f744 - <<std[cb5a7f0ea0430aa5]::thread::Builder>::spawn_unchecked_<rustc_interface[5a45d25d69207022]::util::run_in_thread_pool_with_globals<rustc_interface[5a45d25d69207022]::interface::run_compiler<(), rustc_driver_impl[a708e1f659847ef0]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#2}::{closure#1}, ()>::{closure#1} as core[2b031b7237be44de]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  15:     0x767885259381 - std::sys::pal::unix::thread::Thread::new::thread_start::h0f9dd4118f064405
  16:     0x76787f6a0386 - <unknown>
  17:     0x76787f721b0c - <unknown>
  18:                0x0 - <unknown>

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 make sure that you have updated to the latest nightly

note: please attach the file at `/home/user/.config/rebos/files/common/home/user/Code/rust/ice/rustc-ice-2024-12-31T17_57_52-210002.txt` to your bug report

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED] -Z threads=12 -Z macro-backtrace -C target-cpu=native -C linker=clang -C link-arg=-fuse-ld=/usr/bin/mold -Z threads=12 -Z macro-backtrace -C target-cpu=native -C linker=clang -C link-arg=-fuse-ld=/usr/bin/mold

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
query cycle handler thread panicked, aborting process
warning: `ice` (bin "ice") generated 1 warning
error: could not compile `ice` (bin "ice"); 1 warning emitted

Caused by:
  process didn't exit successfully: `/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name ice --edition=2024 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=111 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=d5f9e422892f9ee1 -C extra-filename=-cd55e940cca72f2d --out-dir /home/user/.config/rebos/files/common/home/user/Code/rust/ice/target/debug/deps -C incremental=/home/user/.config/rebos/files/common/home/user/Code/rust/ice/target/debug/incremental -L dependency=/home/user/.config/rebos/files/common/home/user/Code/rust/ice/target/debug/deps -Zthreads=12 -Zmacro-backtrace -Ctarget-cpu=native -Clinker=clang -Clink-arg=-fuse-ld=/usr/bin/mold -Zthreads=12 -Zmacro-backtrace -Ctarget-cpu=native -Clinker=clang -Clink-arg=-fuse-ld=/usr/bin/mold` (signal: 6, SIGABRT: process abort signal)

@jullanggit jullanggit added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 31, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 31, 2024
@matthiaskrgr matthiaskrgr added the WG-compiler-parallel Working group: Parallelizing the compiler label Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-compiler-parallel Working group: Parallelizing the compiler
Projects
None yet
Development

No branches or pull requests

3 participants