Track which reference belongs to which store #292
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 itfrom_usize
in the first place.