rust-lang / rust-lang/rust

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

Open
#149,156 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug I-ICE T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the example with rustc using the -Zno-codegen flag, then start at compiler/rustc_monomorphize/src/mono_checks/abi_check.rs:118:19 from the reported trace. Determine why the ABI computation failure is delayed as an internal compiler error; done means the example produces a compilation failure rather than the reported ICE.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.