ICE: `assertion failed: self.is_struct() || self.is_union()`
Opened this issue · 2 comments
cushionbadak commented
Code
#![feature(repr_simd)]
use std::arch::asm;
#[repr(simd)]
enum Es {}
static CLs: Es;
pub fn main() {
let mut b = 4i32;
unsafe {
asm!("{}", out(reg) CLs);
}
}A mutant of tests/pretty/asm.rs
Meta
rustc --version --verbose:
rustc 1.93.0-nightly (c90bcb957 2025-11-06)
binary: rustc
commit-hash: c90bcb9571b7aab0d8beaa2ce8a998ffaf079d38
commit-date: 2025-11-06
host: x86_64-apple-darwin
release: 1.93.0-nightly
LLVM version: 21.1.3
Error output
Command: rustc
error: free static item without body
--> 14.rs:7:1
|
7 | static CLs: Es;
| ^^^^^^^^^^^^^^-
| |
| help: provide a definition for the static: `= <expr>;`
error[E0517]: attribute should be applied to a struct
--> 14.rs:5:8
|
5 | #[repr(simd)]
| ^^^^
6 | enum Es {}
| ---------- not a struct
error[E0084]: unsupported representation for zero-variant enum
--> 14.rs:5:8
|
5 | #[repr(simd)]
| ^^^^
6 | enum Es {}
| ------- zero-variant enum
thread 'rustc' (6698172) panicked at compiler/rustc_middle/src/ty/adt.rs:462:9:
assertion failed: self.is_struct() || self.is_union()
Backtrace
thread 'rustc' (6698172) panicked at compiler/rustc_middle/src/ty/adt.rs:462:9:
assertion failed: self.is_struct() || self.is_union()
stack backtrace:
0: __rustc::rust_begin_unwind
1: core::panicking::panic_fmt
2: core::panicking::panic
3: <rustc_hir_typeck::inline_asm::InlineAsmCtxt>::check_asm_operand_type
4: rustc_hir_typeck::typeck_with_inspect::{closure#0}
5: rustc_hir_typeck::typeck
[... omitted 1 frame ...]
6: <rustc_middle::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis::check_crate::{closure#2}>::{closure#0}
7: rustc_hir_analysis::check_crate
8: rustc_interface::passes::analysis
[... omitted 1 frame ...]
9: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
10: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
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 `/Users/jb/Library/CloudStorage/Dropbox/Desk/2503_rustc_ice/20251106 ice 보고용/rustc-ice-2025-11-07T07_18_16-4837.txt` to your bug report
query stack during panic:
#0 [typeck] type-checking `main`
#1 [analysis] running analysis passes on crate `14`
end of query stack
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0084, E0517.
For more information about an error, try `rustc --explain E0084`.
Notes
-
ICE location:
compiler/rustc_middle/src/ty/adt.rs Line-462
rust/compiler/rustc_middle/src/ty/adt.rs
Lines 460 to 464 in c90bcb9
- In my guess, the
non_enum_variantcall comes from here:
rust/compiler/rustc_hir_typeck/src/inline_asm.rs
Lines 168 to 189 in c90bcb9
- In my guess, the
-
Duplication Check
- I searched "self.is_struct()" ICE (Github issue page with query), and there are no opened issues there.
cyrgani commented
use std::arch::asm;
#[repr(simd)]
enum Es {
T,
}
fn main() {
unsafe {
asm!("{}", out(reg) Es::T);
}
}cushionbadak commented
cargo-bisect-rustc --start=2022-01-01 --end=2025-11-07 --regress ice --preserve --script rustc -- 148634.rs
********************************************************************************
Regression in nightly-2022-05-28
********************************************************************************
fetching https://static.rust-lang.org/dist/2022-05-27/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2022-05-27: 40 B / 40 B [==================================================================================================================================================] 100.00 % 1.03 MB/s converted 2022-05-27 to 490324f7b29d5f1a1e063a563045d790091ed639
fetching https://static.rust-lang.org/dist/2022-05-28/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2022-05-28: 40 B / 40 B [==================================================================================================================================================] 100.00 % 1.02 MB/s converted 2022-05-28 to ebbcbfc236ced21d5e6a92269edb704692ff26b8
looking for regression commit between 2022-05-27 and 2022-05-28
fetching (via remote github) commits from max(490324f7b29d5f1a1e063a563045d790091ed639, 2022-05-25) to ebbcbfc236ced21d5e6a92269edb704692ff26b8
ending github query because we found starting sha: 490324f7b29d5f1a1e063a563045d790091ed639
get_commits_between returning commits, len: 8
commit[0] 2022-05-26: Auto merge of #97434 - matthiaskrgr:rollup-7j3y16l, r=matthiaskrgr
commit[1] 2022-05-26: Auto merge of #97386 - nnethercote:optimize-pos-adjustments, r=bjorn3
commit[2] 2022-05-27: Auto merge of #96298 - petrochenkov:fromgen, r=estebank
commit[3] 2022-05-27: Auto merge of #97444 - compiler-errors:rollup-2gvdav6, r=compiler-errors
commit[4] 2022-05-27: Auto merge of #97004 - nnethercote:proc-macro-tweaks, r=eddyb
commit[5] 2022-05-27: Auto merge of #97442 - hafeoz:master, r=GuillaumeGomez
commit[6] 2022-05-27: Auto merge of #96046 - oli-obk:const_typeck, r=cjgillot
commit[7] 2022-05-27: Auto merge of #96790 - lqd:update_jemalloc, r=Mark-Simulacrum
ERROR: no CI builds available between 490324f7b29d5f1a1e063a563045d790091ed639 and ebbcbfc236ced21d5e6a92269edb704692ff26b8 within last 167 days