tokio-rs / loom

Concurrency permutation testing tool for Rust.
MIT License
2.13k stars 111 forks source link

Track which reference belongs to which store #292

Open alexkeizer opened 1 year ago

alexkeizer commented 1 year ago

Add a unique id to stores, and keep track of this id in references. When a reference is used with a different store, this will panic with a message explaining that the user might be trying to reuse object across executions.

This implements the suggestion in #290, although it adds a new id to stores, rather than reusing the execution ids.

One point I would like some more feedback on, is the naming of Ref::from_usize. I changed the signature to also take a store id, but left the name as is. Changing it to Ref::new feels natural, but figured I'd ask for the rationale behind naming it from_usize in the first place.

alexkeizer commented 1 year ago

I fixed the formatting, and the compile error for the checkpoint feature, but the minrust job complains that it can't build once_cell, and I'm not really sure how that's caused by my changes (I didn't touch dependencies). The error is (taken from https://github.com/tokio-rs/loom/actions/runs/3498939232/jobs/5946011488)

Checking once_cell v1.16.0
error: edition 2021 is unstable and only available with -Z unstable-options.

error: could not compile `once_cell`
alexkeizer commented 1 year ago

Some digging later, it seems that once_cell bumped its MSRV to 1.56.0 when going from 1.14 to 1.15, and loom transitively depends on once_cell 1.16, but minrust checks with rust 1.51.0.

~Is there a specific procedure for changing looms MSRV, or should I just add a PR that changes the minrust job to check with 1.56? Alternatively, do we want to stick with 1.51.0, and pin the once_cell dependency to 1.14 somehow?~

EDIT: Fixed in #296