Skip to content

ICE: -Zno-codegen: ABI computation failure should lead to compilation failure #149156

@matthiaskrgr

Description

@matthiaskrgr

Code

//@ compile-flags: -Zno-codegen
#![crate_type = "lib"]
struct Struct([u8; 0xffff_ffff_ffff_ffff]);
pub fn function(value : Struct) -> u8 { value.0 [0] }

Meta

rustc --version --verbose:

rustc 1.93.0-nightly (07bdbaedc 2025-11-19)
binary: rustc
commit-hash: 07bdbaedc63094281483c40a88a1a8f2f8ffadc5
commit-date: 2025-11-19
host: x86_64-unknown-linux-gnu
release: 1.93.0-nightly
LLVM version: 21.1.5

Error output

<output>
Backtrace

warning: type `Struct` is more private than the item `function`
 --> code.rs:3:1
  |
3 | pub fn function(value : Struct) -> u8 { value.0 [0] }
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `function` is reachable at visibility `pub`
  |
note: but type `Struct` is only usable at visibility `pub(crate)`
 --> code.rs:2:1
  |
2 | struct Struct([u8; 0xffff_ffff_ffff_ffff]);
  | ^^^^^^^^^^^^^
  = note: `#[warn(private_interfaces)]` on by default

warning: 1 warning 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: ABI computation failure should lead to compilation failure
  |
  = note: delayed at compiler/rustc_monomorphize/src/mono_checks/abi_check.rs:118:19
             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>::delayed_bug::<&str>
             4: rustc_monomorphize::mono_checks::check_mono_item
             5: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_mono_item::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
             6: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_middle::ty::instance::Instance, rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
             7: rustc_query_impl::query_impl::check_mono_item::get_query_non_incr::__rust_end_short_backtrace
             8: rustc_monomorphize::collector::items_of_instance
             9: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::items_of_instance::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 32]>>
            10: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<(rustc_middle::ty::instance::Instance, rustc_middle::mir::mono::CollectionMode), rustc_middle::query::erase::Erased<[u8; 32]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            11: rustc_query_impl::query_impl::items_of_instance::get_query_non_incr::__rust_end_short_backtrace
            12: rustc_monomorphize::collector::collect_items_rec
            13: rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}::{closure#0}
            14: rustc_monomorphize::partitioning::collect_and_partition_mono_items
            15: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 24]>>
            16: <rustc_query_impl::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, ())>>::call_once
            17: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 24]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            18: rustc_query_impl::query_impl::collect_and_partition_mono_items::get_query_non_incr::__rust_end_short_backtrace
            19: rustc_codegen_ssa::back::symbol_export::exported_generic_symbols_provider_local
            20: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::exported_generic_symbols::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 16]>>
            21: <rustc_query_impl::query_impl::exported_generic_symbols::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::CrateNum)>>::call_once
            22: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::CrateNum, rustc_middle::query::erase::Erased<[u8; 16]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            23: rustc_query_impl::query_impl::exported_generic_symbols::get_query_non_incr::__rust_end_short_backtrace
            24: <rustc_metadata::rmeta::encoder::EncodeContext>::encode_crate_root
            25: <rustc_metadata::rmeta::encoder::encode_metadata::{closure#3} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, &std::path::Path)>>::call_once
            26: rustc_metadata::rmeta::encoder::encode_metadata
            27: rustc_metadata::fs::encode_and_write_metadata
            28: <rustc_interface::queries::Linker>::codegen_and_build_linker
            29: <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}
            30: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
            31: 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}, ()>
            32: <<std::thread::Builder>::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}
            33: std::sys::thread::unix::Thread::new::thread_start
            34: <unknown>
            35: <unknown>


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/matthias/vcs/github/CRED/rustc-ice-2025-11-20T18_07_08-975387.txt` to your bug report

note: compiler flags: -Z no-codegen

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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions