Repository navigation
Description
Part of #4887 (Missing Arbitrary umbrella). Related: #4890 (requires bounded arguments), #4888 (generic function with no candidate type), #3832 (autoharness tracking).
This is a list of input types that AutoHarness cannot generate today and that we think should be supported. Each entry has a minimal reproducer and the skip reason Kani prints. Found while evaluating cargo kani autoharness on about 110 crates.
Tested with Kani built from main at 47689dc (Kani 0.68.0, CBMC 6.11.0, nightly-2026-10-23).
Types that still fail in every mode
Modes: default; --bounded-arguments; --constructor-args. All three were tried for each entry.
-
Arrays of a type without
Arbitrary([T; N])pub struct NoArb { pub x: u8 } pub fn array_of_user(a: [NoArb; 2]) -> u8 { a[0].x }
Missing Arbitrary implementation for argument(s) a: [NoArb; 2]
Reason: arrays are common in protocol and embedded code. Generating[T; N]element-wise whenTcan be generated would cover them. -
Boxed trait objects (
Box<dyn Trait>)pub fn boxed_dyn(d: Box<dyn Fn() -> u8>) -> u8 { d() }
Missing Arbitrary implementation for argument(s) d: std::boxed::Box<dyn std::ops::Fn() -> u8>
Reason: callbacks and plugin APIs. A clear "trait object: not supported" reason would also help if no implementation is planned. -
Reference to a trait object (
&dyn Trait)pub fn dyn_ref(d: &dyn std::fmt::Debug) -> usize { format!("{:?}", d).len() }
Missing Arbitrary implementation for argument(s) d: &dyn std::fmt::Debug -
Function pointers (
fn(T) -> U)pub fn fn_ptr(f: fn(u8) -> u8) -> u8 { f(1) }
Missing Arbitrary implementation for argument(s) f: fn(u8) -> u8
Inconsistency:pub fn closure_arg(f: impl Fn(u8) -> u8) -> u8 { f(1) }is supported (throughnondet_fn1). A function pointer could use the same model. This may be the cheapest entry on the list. -
HashMap/HashSetpub fn map_arg(m: std::collections::HashMap<u8, u8>) -> usize { m.len() }
Missing Arbitrary implementation for argument(s) m: std::collections::HashMap<u8, u8>
Reason: common in every real crate. Related: Internal compiler error onHashMap/HashSet(RandomState::new): rustc_metadata panics onAnonConst#5101 (ICE onRandomState::new). TheRandomStatepath reaches agetrandomsyscall, so a fixed-hasher model would be needed. -
References inside
Option(Option<&T>)pub fn option_ref(o: Option<&u8>) -> u8 { o.copied().unwrap_or(0) }
Missing Arbitrary implementation for argument(s) o: std::option::Option<&u8>
Reason: lookup and iterator APIs. This also needs the bounded model that&Talready gets in some cases. -
Pin<&mut T>pub fn pinned(p: std::pin::Pin<&mut u8>) -> u8 { *p.into_ref() }
Missing Arbitrary implementation for argument(s) p: std::pin::Pin<&mut u8>
Reason: async and runtime code.
Types that only need the bounded model extended
- A
&strinside a tuple ((&str, u8))pub fn tuple_str(t: (&str, u8)) -> u8 { t.1 }
Missing Arbitrary implementation for argument(s) t: (&str, u8)
--bounded-argumentshandles a top-level&str,&[T],StringandVec, but not the same types inside a tuple, struct orOption. This is the composition case for Autoharness umbrella: requires bounded arguments (RequiresBoundedArguments) #4890.
Already supported (for reference, so nobody duplicates the work)
&str,String,&[u8],&mut [u8],Vec<u8>: with--bounded-arguments.- Primitive types (
u8,u128,char,f64),Rc<u8>,RefCell<u8>,Cell<u8>,PhantomData<u8>,Duration,Result<u8, E>whereEis a crate-local type, and crate-local structs and enums: selected by default in our probe. impl Fn(u8) -> u8arguments.
Request
Please decide, per entry, one of: support it, or record in the skip reason why no implementation is planned (as the umbrella's "common cases" section asks). We can split this into one issue per type if you prefer the umbrella's per-type convention.
Reproduce: put the functions above in src/lib.rs of a crate, then run cargo kani autoharness --list -Z autoharness -Z unstable-options, and again with --bounded-arguments and --constructor-args. Kani prints the skip reason for each function.
This was found with Kani in an experiment where AI agents used the Kani agent plugin (#5059) to evaluate Kani autoharness on popular crates. The text was written with AI assistance; the reproducers were run by hand on the Kani build named above.
Activity
feliperodri commentedon Nov 7, 2026
@Tianshu-Huang @srivatsansamraj @acearyanarun @CYJ904 can you take a look at this?