Skip to content

-Z uninit-checks: pointers to trait objects are unsupported #5166

Open

Description

@feliperodri

With -Z uninit-checks, any access through a pointer to a trait object fails with an unsupported check, even when nothing uninitialized is involved:

use std::fmt::Debug;
#[kani::proof]
fn size_of_val_dyn() {
    let x: u32 = kani::any();
    let o: &dyn Debug = &x;
    assert_eq!(std::mem::size_of_val(o), 4);
}
$ kani dynp.rs                      # VERIFICATION:- SUCCESSFUL
$ kani dynp.rs -Z uninit-checks     # Failed Checks: Kani does not support reasoning about memory initialization of pointers to trait objects.

Kani 0.68.0 at c5e65fd (nightly-2026-10-23), CBMC 6.11.0.

This blocks uninit checking on verify-rust-std's Challenge 2 solution (model-checking/verify-rust-std#649): its vtable_size, vtable_align, size_of_val_dyn and align_of_val_dyn harnesses all fail this way (14 harnesses). "Add support for trait objects" is an unchecked item in #3300 without its own issue, so this one tracks it.

Related: #3300.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions