Skip to content

ICE: internal compiler error: Unknown(Foo) #150750

@bushilushan

Description

@bushilushan

I searched using "internal compiler error: Unknown" as the key term and didn't seem to find any similar issues. Is this a new one?

Code

#![feature(repr_simd)]

const C: usize = 16;

#[repr(simd)]
pub struct Foo([u8; C]);

unsafe extern "C" {
    static VAR: Foo;
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.94.0-nightly (4fa80a5e7 2026-01-05)
binary: rustc
commit-hash: 4fa80a5e733e2202d7ca4c203c2fdfda41cfe7dc
commit-date: 2026-01-05
host: x86_64-unknown-linux-gnu
release: 1.94.0-nightly
LLVM version: 21.1.8
Program Output

warning: static `VAR` is never used
 --> <source>:9:12
  |
9 |     static VAR: Foo;
  |            ^^^
  |
  = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

warning: `extern` block uses type `Foo`, which is not FFI-safe
 --> <source>:9:17
  |
9 |     static VAR: Foo;
  |                 ^^^ not FFI-safe
  |
  = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct
  = note: this struct has unspecified layout
note: the type is defined here
 --> <source>:6:1
  |
6 | pub struct Foo([u8; C]);
  | ^^^^^^^^^^^^^^
  = note: `#[warn(improper_ctypes)]` on by default

warning: 2 warnings emitted

note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error: Unknown(Foo)
 --> <source>:9:5
  |
9 |     static VAR: Foo;
  |     ^^^^^^^^^^^^^^^
  |
note: delayed at /rustc-dev/4fa80a5e733e2202d7ca4c203c2fdfda41cfe7dc/compiler/rustc_hir_analysis/src/check/check.rs:197:23
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
         3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, alloc::string::String>
         4: rustc_hir_analysis::check::check::check_item_type
         5: rustc_hir_analysis::check::wfcheck::check_well_formed
         6: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
         7: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 1]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
         8: rustc_query_impl::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
         9: rustc_hir_analysis::check::wfcheck::check_type_wf
        10: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
        11: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        12: rustc_query_impl::query_impl::check_type_wf::get_query_non_incr::__rust_end_short_backtrace
        13: rustc_hir_analysis::check_crate
        14: rustc_interface::passes::analysis
        15: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
        16: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        17: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        18: <rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core::ops::function::FnOnce<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
        19: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        20: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
        21: <std::thread::lifecycle::spawn_unchecked<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        22: <std::sys::thread::unix::Thread>::new::thread_start
        23: <unknown>
        24: <unknown>
      
 --> <source>:9:5
  |
9 |     static VAR: Foo;
  |     ^^^^^^^^^^^^^^^

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 `/app/rustc-ice-2026-01-07T06_31_49-1.txt` to your bug report

note: rustc 1.94.0-nightly (4fa80a5e7 2026-01-05) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 --crate-type bin -C linker=/opt/compiler-explorer/gcc-15.2.0/bin/gcc

query stack during panic:
end of query stack

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions