Skip to content

[ICE]: SIGILL on tuples with infers in generic arguments #158289

Description

@khyperia

Code

#![feature(min_adt_const_params)]
#![feature(min_generic_const_args)]

struct S<const X: (u32, u32)>;

fn main() {
    let _: S<{ (1, _) }> = S;
}

Meta

rustc --version --verbose:

rustc 1.98.0-nightly (4429659e4 2026-06-22)
binary: rustc
commit-hash: 4429659e4745016bd3f26a4a421843edc7fbc422
commit-date: 2026-06-22
host: x86_64-unknown-linux-gnu
release: 1.98.0-nightly
LLVM version: 22.1.7

Error output

warning: the feature `min_generic_const_args` is incomplete and may not be safe to use and/or cause compiler crashes
 --> src/main.rs:2:12
  |
2 | #![feature(min_generic_const_args)]
  |            ^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #132980 <https://github.com/rust-lang/rust/issues/132980> for more information
  = note: `#[warn(incomplete_features)]` on by default

error: rustc interrupted by SIGILL, printing backtrace

/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(+0x3a7615c) [0x7f0f6d87615c]
/usr/lib/libc.so.6(+0x3e8f0) [0x7f0f69a3e8f0]
/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(+0x6ab9e3b) [0x7f0f708b9e3b]
/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(_RNvXs_NtCs7P73JT6jVFJ_18rustc_ast_lowering5indexNtB4_13NodeCollectorNtNtCs6vKSrT0fj8o_9rustc_hir10intravisit7Visitor15visit_const_arg+0x38) [0x7f0f6d41c148]
/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(+0x6ab9e2d) [0x7f0f708b9e2d]
/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(_RNvXs_NtCs7P73JT6jVFJ_18rustc_ast_lowering5indexNtB4_13NodeCollectorNtNtCs6vKSrT0fj8o_9rustc_hir10intravisit7Visitor8visit_ty+0x2dc) [0x7f0f6f47ed1c]
/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(+0x5680003) [0x7f0f6f480003]
/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(+0x567f20d) [0x7f0f6f47f20d]
/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(_RNvXs_NtCs7P73JT6jVFJ_18rustc_ast_lowering5indexNtB4_13NodeCollectorNtNtCs6vKSrT0fj8o_9rustc_hir10intravisit7Visitor10visit_item+0x1bd) [0x7f0f6f47e1db]
/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(+0x567ad7e) [0x7f0f6f47ad7e]
/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(_RNvCs7P73JT6jVFJ_18rustc_ast_lowering12lower_to_hir+0x1801) [0x7f0f6f46f141]
/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(+0x566d911) [0x7f0f6f46d911]
/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(+0x566bf8a) [0x7f0f6f46bf8a]
/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(+0x566bcc5) [0x7f0f6f46bcc5]
/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(+0x566b7ae) [0x7f0f6f46b7ae]
/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(+0x566ac12) [0x7f0f6f46ac12]
/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(+0x566a948) [0x7f0f6f46a948]
/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(+0x5f243ac) [0x7f0f6fd243ac]
/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(_RNvNtNtCshQW7WgHXfu6_12rustc_middle3hir3map15hir_crate_items+0x117) [0x7f0f6fd21fe5]
/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(+0x610b019) [0x7f0f6ff0b019]
/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(+0x610745a) [0x7f0f6ff0745a]
/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(+0x610658f) [0x7f0f6ff0658f]
/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(_RNvNtCs4iS3EM8oH2V_15rustc_interface6passes8analysis+0x58) [0x7f0f6f2c8098]
/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(+0x6106b07) [0x7f0f6ff06b07]
/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(+0x6106769) [0x7f0f6ff06769]
/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(+0x615d13d) [0x7f0f6ff5d13d]
/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(+0x6118b7a) [0x7f0f6ff18b7a]
/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(+0x611892d) [0x7f0f6ff1892d]
/home/khyperia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-e61e75993036bf19.so(+0x611cc92) [0x7f0f6ff1cc92]
/usr/lib/libc.so.6(+0x981b9) [0x7f0f69a981b9]
/usr/lib/libc.so.6(+0x11d21c) [0x7f0f69b1d21c]

note: we would appreciate a report at https://github.com/rust-lang/rust
note: backtrace dumped due to SIGILL! resuming signal
fish: Job 1, 'rustc +nightly src/main.rs' terminated by signal SIGILL (Ogiltig instruktion)

this SAFETY comment is incorrect:

// SAFETY: `ConstArg` is `repr(C)` and `ConstArgKind` is marked `repr(u8)` so that the layout is
// the same across different ZST type arguments. We also asserted that the `self` is
// not a `ConstArgKind::Infer` so there is no risk of transmuting a `()` to `AmbigArg`.
let ptr = self as *const ConstArg<'hir> as *const ConstArg<'hir, AmbigArg>;
Some(unsafe { &*ptr })

it checks for ConstArgKind::Infer(()), but it does not check for things like ConstArgKind::Tup(&[ConstArg { kind: ConstArgKind::Infer(()), .. }])

this issue was likely introduced in af76a24 (part of #150675 ) which added the ConstArgKind::Tup variant but did not update the unsafe guard logic

FYI to @mu001999 who wrote the above PR, and to @BoxyUwU who wrote the original unsafe code and also reviewed the above PR

this issue was discovered when I was browsing the rustc source and was like "uuuh wait a minute", didn't actually hit this in real world code (invented the above test case after seeing the code), so, no worries, thanks for the fun lil SIGILL ❤️

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.F-min_generic_const_args`#![feature(min_generic_const_args)]`I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions