Skip to content

panic: autoharness: Failed to get ABI for OfInstance #4842

Open

Description

@matthiaskrgr

I tried this code:

#[allow(unused)]
async fn foo<'a>() {
    let _data = &mut [0u8; { !0usize / 8 }];
    bar().await
}

async fn bar() {}

fn main() {}

using the following command line invocation:

RUSTFLAGS="--edition=2021" RUST_BACKTRACE=full kani  autoharness -Zautoharness     code.rs

with Kani version:

I expected to see this happen: explanation

Instead, this happened: explanation

Kani Rust Verifier 0.68.0 (standalone)
CBMC 6.11.0
warning: function `main` is never used
 --> code.rs:9:4
  |
9 | fn main() {}
  |    ^^^^
  |
  = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

warning: use of an unstable feature
 --> <crate attribute>:1:12
  |
1 | #![feature(register_tool)]
  |            ^^^^^^^^^^^^^
  |
  = note: requested on the command line with `--force-warn unstable-features`


thread 'rustc' (1858681) panicked at kani-compiler/src/codegen_cprover_gotoc/codegen/typ.rs:1647:40:
called `Result::unwrap()` on an `Err` value: Error("Failed to get ABI for `OfInstance { instance: Instance { def: Item(DefId(0:4 ~ code[fd51]::foo)), args: ['{erased}] }, extra_args: [] }`: Layout(SizeOverflow(Coroutine(DefId(0:7 ~ code[fd51]::foo::{closure#0}), ['{erased}, (), std::future::ResumeTy, (), (), ()])))")
stack backtrace:
   0:     0x7f02c0ec53f6 - <<std[b8564071bfb80320]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[b218925afaf52552]::fmt::Display>::fmt
   1:     0x7f02c160aca3 - core[b218925afaf52552]::fmt::write
   2:     0x7f02c0edaa1c - <std[b8564071bfb80320]::sys::stdio::unix::Stderr as core[b218925afaf52552]::io::write::Write>::write_fmt
   3:     0x7f02c0e9868a - std[b8564071bfb80320]::panicking::default_hook::{closure#0}
   4:     0x7f02c0eb96a3 - std[b8564071bfb80320]::panicking::default_hook
   5:     0x5565a7be6f40 - kani_compiler[980edcef3ed27b2]::session::PANIC_HOOK::{closure#0}::{closure#0}
   6:     0x5565a7be73a0 - kani_compiler[980edcef3ed27b2]::codegen_cprover_gotoc::utils::debug::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:     0x7f02c0eb9b42 - std[b8564071bfb80320]::panicking::panic_with_hook
   8:     0x7f02c0e98742 - std[b8564071bfb80320]::panicking::panic_handler::{closure#0}
   9:     0x7f02c0e903a9 - std[b8564071bfb80320]::sys::backtrace::__rust_end_short_backtrace::<std[b8564071bfb80320]::panicking::panic_handler::{closure#0}, !>
  10:     0x7f02c0e9a14d - __rustc[f325e6f53f8e9f03]::rust_begin_unwind
  11:     0x7f02bdacb57c - core[b218925afaf52552]::panicking::panic_fmt
  12:     0x7f02bd2efba2 - core[b218925afaf52552]::result::unwrap_failed
  13:     0x5565a799d540 - <kani_compiler[980edcef3ed27b2]::codegen_cprover_gotoc::context::goto_ctx::GotocCtx>::declare_function
  14:     0x5565a7b22f31 - <std[b8564071bfb80320]::thread::local::LocalKey<core[b218925afaf52552]::cell::RefCell<(core[b218925afaf52552]::option::Option<alloc[1fd94160f0f4009f]::boxed::Box<dyn core[b218925afaf52552]::ops::function::Fn<(), Output = alloc[1fd94160f0f4009f]::string::String>>>, core[b218925afaf52552]::option::Option<cprover_bindings[cc03a3a0ad66a1a8]::goto_program::location::Location>)>>>::with::<<kani_compiler[980edcef3ed27b2]::codegen_cprover_gotoc::context::goto_ctx::GotocCtx>::call_with_panic_debug_info<rustc_public[982db8fb9120de79]::mir::mono::InstanceDef, <kani_compiler[980edcef3ed27b2]::codegen_cprover_gotoc::compiler_interface::GotocCodegenBackend>::codegen_items::{closure#4}::{closure#0}, <kani_compiler[980edcef3ed27b2]::codegen_cprover_gotoc::compiler_interface::GotocCodegenBackend>::codegen_items::{closure#4}::{closure#1}>::{closure#0}, ()>
  15:     0x5565a7a7a20b - <kani_compiler[980edcef3ed27b2]::codegen_cprover_gotoc::compiler_interface::GotocCodegenBackend>::codegen_items
  16:     0x5565a7a773fd - <kani_compiler[980edcef3ed27b2]::codegen_cprover_gotoc::compiler_interface::GotocCodegenBackend as rustc_codegen_ssa[6aa05fb22a8957d5]::traits::backend::CodegenBackend>::codegen_crate::{closure#0}
  17:     0x5565a7ae6c15 - rustc_public[982db8fb9120de79]::compiler_interface::run::<rustc_public[982db8fb9120de79]::rustc_internal::run<<kani_compiler[980edcef3ed27b2]::codegen_cprover_gotoc::compiler_interface::GotocCodegenBackend as rustc_codegen_ssa[6aa05fb22a8957d5]::traits::backend::CodegenBackend>::codegen_crate::{closure#0}, alloc[1fd94160f0f4009f]::boxed::Box<dyn core[b218925afaf52552]::any::Any>>::{closure#0}, alloc[1fd94160f0f4009f]::boxed::Box<dyn core[b218925afaf52552]::any::Any>>
  18:     0x5565a7bff7c5 - rustc_public[982db8fb9120de79]::rustc_internal::run::<<kani_compiler[980edcef3ed27b2]::codegen_cprover_gotoc::compiler_interface::GotocCodegenBackend as rustc_codegen_ssa[6aa05fb22a8957d5]::traits::backend::CodegenBackend>::codegen_crate::{closure#0}, alloc[1fd94160f0f4009f]::boxed::Box<dyn core[b218925afaf52552]::any::Any>>
  19:     0x5565a7a83bb9 - <kani_compiler[980edcef3ed27b2]::codegen_cprover_gotoc::compiler_interface::GotocCodegenBackend as rustc_codegen_ssa[6aa05fb22a8957d5]::traits::backend::CodegenBackend>::codegen_crate
  20:     0x7f02c294db8c - <rustc_interface[4089758db528eb1a]::queries::Linker>::codegen_and_build_linker
  21:     0x7f02c294448a - rustc_interface[4089758db528eb1a]::interface::run_compiler::<(), rustc_driver_impl[f578478d149be60]::run_compiler::{closure#0}>::{closure#2}
  22:     0x7f02c29c1e64 - std[b8564071bfb80320]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[4089758db528eb1a]::util::run_in_thread_with_globals<rustc_interface[4089758db528eb1a]::util::run_in_thread_pool_with_globals<rustc_interface[4089758db528eb1a]::interface::run_compiler<(), rustc_driver_impl[f578478d149be60]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  23:     0x7f02c29c1c2d - <std[b8564071bfb80320]::thread::lifecycle::spawn_unchecked<rustc_interface[4089758db528eb1a]::util::run_in_thread_with_globals<rustc_interface[4089758db528eb1a]::util::run_in_thread_pool_with_globals<rustc_interface[4089758db528eb1a]::interface::run_compiler<(), rustc_driver_impl[f578478d149be60]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[b218925afaf52552]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  24:     0x7f02c29bf907 - <std[b8564071bfb80320]::sys::thread::unix::Thread>::new::thread_start
  25:     0x7f02bbc980a2 - <unknown>
  26:     0x7f02bbd2080c - <unknown>
  27:                0x0 - <unknown>

Kani unexpectedly panicked during compilation.
Please file an issue here: https://github.com/model-checking/kani/issues/new?labels=bug&template=bug_report.md

[Kani] current codegen item: declare_function: code::foo::<'_>
[Kani] current codegen location: Loc { file: "code.rs", function: None, start_line: 2, start_col: Some(1), end_line: 2, end_col: Some(19), pragmas: [] }
warning: 2 warnings emitted

error: /home/matthias/.kani/kani-0.68.0/bin/kani-compiler exited with status exit status: 101

Activity

  1. self-assigned this
    on Sep 24, 2026
  2. added theissue type on Sep 24, 2026
  3. matthiaskrgr commented on Sep 24, 2026

    @matthiaskrgr
    ContributorAuthor
    async fn foo() {
        let _data = &mut [8; !0usize];
        bar().await
    }
    async fn bar() {}
    
  4. feliperodri commented on Sep 25, 2026

    @feliperodri
    Member

    Triaged against main (de756c9): still reproduces. Same family as #4840 — an oversized array ([0u8; !0usize / 8]) reaches a layout/ABI query whose error is unwrapped, here codegen/typ.rs:1651 (Failed to get ABI for OfInstance). Reporting the error instead of unwrapping should cover both.

  5. added this to the Autoharness milestone on Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Z-Kani CompilerIssues that require some changes to the compiler[C] BugThis is a bug. Something isn't working.[F] CrashKani crashed

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions