This is an archive of the discontinued Mercurial Phabricator instance.

rust-repo: make `Send` by not storing functions in `LazyCell`
ClosedPublic

Authored by martinvonz on Apr 21 2022, 2:12 PM.

Details

Summary

We (Google) want to use Repo in a context where we can store it in
Mutex<Repo>. However, that currently doesn't work because it's not
Send because the LazyCell initialization functions are not
Send. It's easy to fix that by passing them to the get_or_init()
and get_mut_or_init() functions. We'll probably also want Repo to
be Send (and even Sync) in core later, so this seems like a step
in the right direction.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

martinvonz created this revision.Apr 21 2022, 2:12 PM
Alphare accepted this revision.Apr 25 2022, 4:53 AM
Alphare added a subscriber: Alphare.

Thanks!

This revision is now accepted and ready to land.Apr 25 2022, 4:53 AM
martinvonz updated this revision to Diff 33331.May 3 2022, 2:06 AM
martinvonz updated this revision to Diff 33332.May 3 2022, 11:55 AM
Alphare requested changes to this revision.Mon, May 9, 11:26 AM

Unfortunately, this does not apply anymore. Sorry for the delay in review, it's been really packed lately.

This revision now requires changes to proceed.Mon, May 9, 11:26 AM
martinvonz updated this revision to Diff 33372.Mon, May 9, 11:42 AM

Unfortunately, this does not apply anymore. Sorry for the delay in review, it's been really packed lately.

No problem. I've rebased and resolved the conflict now.

This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.