Skip to content

Assignment in stdlib has lhs that isn't lvalue #1554

Open

Description

@danielsn

Adding the checks here https://github.com/danielsn/kani/tree/issue-1554 caused the following crash in the stdlib test

   Compiling std_lib_test v0.1.0 (/private/tmp/std_lib_test)
     Running `/Users/dsn/ws/rmc/target/debug/kani-compiler --crate-name std_lib_test --edition=2021 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C metadata=c2ba6e9c2cdabb49 -C extra-filename=-c2ba6e9c2cdabb49 --out-dir /private/tmp/std_lib_test/target/x86_64-apple-darwin/debug/deps --target x86_64-apple-darwin -C incremental=/private/tmp/std_lib_test/target/x86_64-apple-darwin/debug/incremental -L dependency=/private/tmp/std_lib_test/target/x86_64-apple-darwin/debug/deps -L dependency=/private/tmp/std_lib_test/target/debug/deps --extern 'noprelude:alloc=/private/tmp/std_lib_test/target/x86_64-apple-darwin/debug/deps/liballoc-4638958d0cdc42fe.rmeta' --extern 'noprelude:compiler_builtins=/private/tmp/std_lib_test/target/x86_64-apple-darwin/debug/deps/libcompiler_builtins-112db2fe498ba292.rmeta' --extern 'noprelude:core=/private/tmp/std_lib_test/target/x86_64-apple-darwin/debug/deps/libcore-1be5a5ce74bde5bf.rmeta' --extern kani=/private/tmp/std_lib_test/target/x86_64-apple-darwin/debug/deps/libkani-da3d92f2588b258e.rmeta --extern 'noprelude:panic_unwind=/private/tmp/std_lib_test/target/x86_64-apple-darwin/debug/deps/libpanic_unwind-406ea3fd64fd4dd3.rmeta' --extern 'noprelude:proc_macro=/private/tmp/std_lib_test/target/x86_64-apple-darwin/debug/deps/libproc_macro-28f49ff7b5764c7a.rmeta' --extern 'noprelude:std=/private/tmp/std_lib_test/target/x86_64-apple-darwin/debug/deps/libstd-116cc0896e751e99.rmeta' -Z unstable-options --kani-flags`
thread 'rustc' panicked at 'Expected lvalue on LHS of assignment
Expr { value: AddressOf(Expr { value: Symbol { identifier: "_ZN3std2rt7cleanup17h34f47fa3982a8503E::FnDefSingleton" }, typ: StructTag("tag-_ZN3std2rt7cleanup17h34f47fa3982a8503E::FnDefStruct"), location: None }), typ: Pointer { typ: StructTag("tag-_ZN3std2rt7cleanup17h34f47fa3982a8503E::FnDefStruct") }, location: None }
Pointer { typ: StructTag("tag-_ZN3std2rt7cleanup17h34f47fa3982a8503E::FnDefStruct") }', cprover_bindings/src/goto_program/expr.rs:1498:9
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: cprover_bindings::goto_program::expr::Expr::assign
             at /Users/dsn/ws/rmc/cprover_bindings/src/goto_program/expr.rs:1498:9
   3: kani_compiler::codegen_cprover_gotoc::codegen::statement::<impl kani_compiler::codegen_cprover_gotoc::context::goto_ctx::GotocCtx>::codegen_statement
             at /Users/dsn/ws/rmc/kani-compiler/src/codegen_cprover_gotoc/codegen/statement.rs:55:21
   4: kani_compiler::codegen_cprover_gotoc::codegen::block::<impl kani_compiler::codegen_cprover_gotoc::context::goto_ctx::GotocCtx>::codegen_block
             at /Users/dsn/ws/rmc/kani-compiler/src/codegen_cprover_gotoc/codegen/block.rs:31:32
   5: kani_compiler::codegen_cprover_gotoc::codegen::function::<impl kani_compiler::codegen_cprover_gotoc::context::goto_ctx::GotocCtx>::codegen_function::{{closure}}
             at /Users/dsn/ws/rmc/kani-compiler/src/codegen_cprover_gotoc/codegen/function.rs:115:71
   6: core::iter::traits::iterator::Iterator::for_each::call::{{closure}}
             at /rustc/40336865fe7d4a01139a3336639c6971647e885c/library/core/src/iter/traits/iterator.rs:828:29
   7: core::iter::adapters::map::map_fold::{{closure}}
             at /rustc/40336865fe7d4a01139a3336639c6971647e885c/library/core/src/iter/adapters/map.rs:84:21
   8: <core::iter::adapters::enumerate::Enumerate<I> as core::iter::traits::iterator::Iterator>::fold::enumerate::{{closure}}
             at /rustc/40336865fe7d4a01139a3336639c6971647e885c/library/core/src/iter/adapters/enumerate.rs:106:27
   9: core::iter::traits::iterator::Iterator::fold
             at /rustc/40336865fe7d4a01139a3336639c6971647e885c/library/core/src/iter/traits/iterator.rs:2414:21
  10: <core::iter::adapters::enumerate::Enumerate<I> as core::iter::traits::iterator::Iterator>::fold
             at /rustc/40336865fe7d4a01139a3336639c6971647e885c/library/core/src/iter/adapters/enumerate.rs:112:9
  11: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
             at /rustc/40336865fe7d4a01139a3336639c6971647e885c/library/core/src/iter/adapters/map.rs:124:9
  12: core::iter::traits::iterator::Iterator::for_each
             at /rustc/40336865fe7d4a01139a3336639c6971647e885c/library/core/src/iter/traits/iterator.rs:831:9
  13: kani_compiler::codegen_cprover_gotoc::codegen::function::<impl kani_compiler::codegen_cprover_gotoc::context::goto_ctx::GotocCtx>::codegen_function
             at /Users/dsn/ws/rmc/kani-compiler/src/codegen_cprover_gotoc/codegen/function.rs:115:13
  14: <kani_compiler::codegen_cprover_gotoc::compiler_interface::GotocCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate::{{closure}}
             at /Users/dsn/ws/rmc/kani-compiler/src/codegen_cprover_gotoc/compiler_interface.rs:112:35
  15: kani_compiler::codegen_cprover_gotoc::utils::debug::<impl kani_compiler::codegen_cprover_gotoc::context::goto_ctx::GotocCtx>::call_with_panic_debug_info::{{closure}}
             at /Users/dsn/ws/rmc/kani-compiler/src/codegen_cprover_gotoc/utils/debug.rs:68:13
  16: std::thread::local::LocalKey<T>::try_with
             at /rustc/40336865fe7d4a01139a3336639c6971647e885c/library/std/src/thread/local.rs:445:16
  17: std::thread::local::LocalKey<T>::with
             at /rustc/40336865fe7d4a01139a3336639c6971647e885c/library/std/src/thread/local.rs:421:9
  18: kani_compiler::codegen_cprover_gotoc::utils::debug::<impl kani_compiler::codegen_cprover_gotoc::context::goto_ctx::GotocCtx>::call_with_panic_debug_info
             at /Users/dsn/ws/rmc/kani-compiler/src/codegen_cprover_gotoc/utils/debug.rs:65:9
  19: <kani_compiler::codegen_cprover_gotoc::compiler_interface::GotocCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
             at /Users/dsn/ws/rmc/kani-compiler/src/codegen_cprover_gotoc/compiler_interface.rs:111:25
  20: <rustc_session::session::Session>::time::<alloc::boxed::Box<dyn core::any::Any>, rustc_interface::passes::start_codegen::{closure#0}>
  21: <rustc_interface::passes::QueryContext>::enter::<<rustc_interface::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core::result::Result<alloc::boxed::Box<dyn core::any::Any>, rustc_errors::ErrorGuaranteed>>
  22: <rustc_interface::queries::Queries>::ongoing_codegen
  23: <rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorGuaranteed>>
  24: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
  25: rustc_interface::interface::create_compiler_and_run::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>
  26: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Kani unexpectedly panicked during compilation.
If you are seeing this message, please file an issue here: https://github.com/model-checking/kani/issues/new?labels=bug&template=bug_report.md

[Kani] current codegen item: codegen_function: core::mem::ManuallyDrop::<fn() {rt::cleanup}>::take
_ZN4core3mem13manually_drop21ManuallyDrop$LT$T$GT$4take17heedc9682a28ce463E
[Kani] current codegen location: Loc { file: "/Users/dsn/.rustup/toolchains/nightly-2022-08-16-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/mem/manually_drop.rs", function: None, start_line: 110, start_col: Some(5), end_line: 110, end_col: Some(56) }
error: could not compile `std`

Activity

  1. added
    [C] Bug
    on Nov 14, 2022
  2. tedinski commented on Nov 14, 2022

    @tedinski
    Contributor
  3. added theissue type on Apr 1, 2026
  4. added
    Z-Kani Compiler
    on Nov 5, 2026
  5. self-assigned this
    on Nov 6, 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 Compiler[C] Bug[F] Crash

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions