Skip to content

Remove Send bound for Arbitrary? #262

@benwr

Description

@benwr

In my current project, I've got a complicated data structure I'd like to make an Arbitrary instance for; unfortunately the implementation relies on Rc for performance reasons, so it isn't Send.

I've considered using an ad-hoc structure, like a Vec or something, and generating the data structure in the test from that, but interpreting results of this test would be really annoying.

My other option at the moment is generating two versions of the data structure, one using Rc and the other using Arc. But this is also annoying to do nicely in Rust, and everything that depends on this data structure will need to do the "cfg(test)" dance to choose whether to use the thread-safe version or the other one.

So my question is: Instead of Sending generated values to threads, could quickcheck send a random seed, and then have the thread itself generate the value? I imagine this has significant tradeoffs, but it would make it much easier to test libraries that otherwise don't want to be thread-safe.

Edited to add: I might be willing to spend a significant amount of time working on this if it turns out to be compatible with your goals for the project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions