Skip to content

An API for creating a non-deterministic slice #614

@zhassan-aws

Description

@zhassan-aws

Requested feature: Creating a non-deterministic slice (with non-deterministic content as well as a non-deterministic length) currently requires multiple steps. For example, the following code creates a non-deterministic slice of u8 with a maximum length of 10:

let arr: [u8; 10] = rmc::nondet();
let slice_len: usize = rmc::nondet();
rmc::assume(slice_len <= 10);
&arr[..slice_len]

It would be useful to wrap this in some API to simplify creating non-deterministic slices.
Use case: To test functions that take a slice.
Link to relevant documentation (Rust reference, Nomicon, RFC):
Is this a breaking change?

Metadata

Metadata

Assignees

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