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

Compiler panicked at 'is_signed on non-scalar ABI' during const evaluation on windows-sys crate #138971

Open
AqourSoro opened this issue Mar 26, 2025 · 3 comments
Labels
A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) 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.

Comments

@AqourSoro
Copy link

Code

The Internal Compiler Error (ICE) was triggered during compilation of the crate windows-sys version 0.59.0, as a dependency of evcxr_jupyter. Minimal reproduction command:

cargo install --locked evcxr_jupyter

Currently, this is the smallest reliable reproduction step found.

Meta

Output of rustc --version --verbose:

rustc 1.85.1 (4eb161250 2025-03-15)
binary: rustc
commit-hash: 4eb161250e340c8f48f66e2b929ef4a5bed7c181
commit-date: 2025-03-15
host: x86_64-pc-windows-msvc
release: 1.85.1
LLVM version: 18.1.3

Error output

thread 'rustc' panicked at /rustc/4eb161250e340c8f48f66e2b929ef4a5bed7c181\compiler\rustc_abi\src\lib.rs:1446:18:
`is_signed` on non-scalar ABI ScalarPair(Union { value: Int(I8, false) }, Initialized { value: Int(I8, false), valid_range: 21301445860939404079836335616267649024..=105358827881679071900638810302764611136 })

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.85.1 (4eb161250 2025-03-15) running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no -C strip=debuginfo

query stack during panic:
#0 [eval_to_allocation_raw] const-evaluating + checking `Win32::Foundation::ERROR_FLT_NO_HANDLER_DEFINED`
#1 [eval_to_const_value_raw] simplifying constant for the type system `Win32::Foundation::ERROR_FLT_NO_HANDLER_DEFINED`
end of query stack

error: could not compile `windows-sys` (lib)

Caused by:
  process didn't exit successfully: `rustc.exe --crate-name windows_sys --edition=2021 windows-sys-0.59.0\src\lib.rs --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --warn=rust_2018_idioms --warn=unexpected_cfgs --warn=missing_docs` (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)

error: failed to compile `evcxr_jupyter v0.19.0`, intermediate artifacts can be found at `C:\Users\97175\AppData\Local\Temp\cargo-installLYwVOH`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
Backtrace

stack backtrace:
0: std::backtrace_rs::backtrace::dbghelp64::trace
1: std::backtrace_rs::backtrace::trace_unsynchronized
2: std::sys::backtrace::_print_fmt
3: std::sys::backtrace::impl$0::print::impl$0::fmt
4: core::fmt::rt::Argument::fmt
5: core::fmt::write
6: std::io::Write::write_fmt
7: std::sys::backtrace::BacktraceLock::print
8: std::panicking::default_hook::closure$1
9: std::panicking::default_hook
10: core::slice::sort::unstable::heapsort::heapsort
11: alloc::boxed::impl$30::call
12: std::panicking::rust_panic_with_hook
13: std::panicking::begin_panic_handler::closure$0
14: std::sys::backtrace::__rust_end_short_backtrace
15: std::panicking::begin_panic_handler
16: core::panicking::panic_fmt
17: rustc_const_eval::interpret::eval_context::InterpCx<_>::storage_live_dyn::is_very_trivially_sized
18: rustc_const_eval::const_eval::eval_queries::eval_to_allocation_raw_provider
19: rustc_query_impl::plumbing::query_key_hash_verify_all
20: rustc_query_system::query::plumbing::try_execute_query
21: rustc_query_impl::plumbing::query_key_hash_verify_all
22: rustc_const_eval::const_eval::eval_queries::eval_to_const_value_raw_provider
23: rustc_query_impl::plumbing::query_key_hash_verify_all
24: rustc_query_system::query::plumbing::try_execute_query
25: rustc_query_impl::plumbing::query_key_hash_verify_all
26: hashbrown::raw::RawTable::reserve_rehash
27: rustc_hir_analysis::check_crate
28: rustc_interface::passes::resolver_for_lowering_raw
29: rustc_interface::passes::analysis
30: alloc::sync::Arc<rustc_session::config::OutputFilenames>::drop_slow
31: rustc_query_system::query::plumbing::try_execute_query
32: rustc_query_impl::query_system
33: rustc_interface::util::run_in_thread_with_globals
34: rustc_interface::util::run_in_thread_pool_with_globals
35: rustc_interface::interface::run_compiler
36: alloc::boxed::impl$28::call_once
37: std::sys::pal::windows::thread::impl$0::new::thread_start
38: BaseThreadInitThunk
39: RtlUserThreadStart


This issue was found while attempting to compile the evcxr_jupyter crate on Windows (x86_64-pc-windows-msvc) environment. It seems specifically related to compiling the windows-sys crate, version 0.59.0, using Rust 1.85.1. The error consistently reproduces with optimization flags enabled (-C opt-level=3) and causes the compiler to panic due to an internal error in const evaluation.

A minimized version was not yet produced given the complexity, but the reproduction above is reliable and clear.

Please let me know if any additional information or testing is required.

@AqourSoro AqourSoro 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 Mar 26, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 26, 2025
@moxian
Copy link
Contributor

moxian commented Mar 27, 2025

I am unable to reproduce this with rustc 1.85.1 (4eb161250 2025-03-15) on Win 10 22H2 19045.5608 (neither via cargo install --locked nor via grabbing the evcxr_jupyter crate manually and running cargo build --release)

What is your OS version?

Does it work on an older rustc? If so, can you try bisecting rust version that introduced it (https://github.com/rust-lang/cargo-bisect-rustc)?

@rustbot label: +A-const-eval

@rustbot rustbot added the A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) label Mar 27, 2025
@AqourSoro
Copy link
Author

My OS is Windows 11 Version 24H2 (OS Build 26100.3476).

I attempted to downgrade to rustc 1.84.1 (e71f9a9a9 2025-01-27) to bisect the regression, but evcxr_jupyter (or one of its dependencies) requires edition2024, which is not supported on 1.84.1. Thus, I cannot build the crate on older toolchains.

I've tested rustc 1.85.0 (4d91de4e4 2025-02-17) and rustc 1.85.1 (4eb161250 2025-03-15), and both produce the same error.

I've also tried this on another computer with Windows 11 Version 24H2 (OS Build 26100.3194) and rustc 1.85.1 (4eb161250 2025-03-15), it works just fine, seems like an issue related to windows system update.

@moxian
Copy link
Contributor

moxian commented Mar 27, 2025

As a minimization attempt, can you try building an empty project with this Cargo.toml? (I obtained the list of features from $env:RUSTC_BOOTSTRAP=1; cargo build -Zunstable-options --unit-graph on my machine, I would hope(?) they are the same for you)

[package]
name = "mycrate"
version = "0.1.0"
edition = "2018"

[dependencies]
version = "=0.59.0"
features = [
    "Win32",
    "Win32_Foundation",
    "Win32_Security",
    "Win32_Storage",
    "Win32_Storage_FileSystem",
    "Win32_System",
    "Win32_System_Console",
    "Win32_System_IO",
    "Win32_System_ProcessStatus",
    "Win32_System_SystemInformation",
    "Win32_System_Threading",
    "Win32_System_WindowsProgramming",
    "default",
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) 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.
Projects
None yet
Development

No branches or pull requests

3 participants