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.
Objective
When going over #20901, it came across to me that the
Sync
bound onPlugin
might be too strong. There are currently zero uses in first-party crates where we currently rely onPlugin: Sync
, or in other words ,we never rely on plugins being simultaneously accessible from multiple threads. Given that most of the plugins we have are ZSTs, this might be too tight of a restriction on plugins that require more configuration (e.g.RemotePlugin
).Solution
Remove the bound on the trait. Utilize that to use
Cell
instead ofRwLock
inRemotePlugin
.Given this loosens the restrictions on a core trait, I expect this PR to be, at least, a bit contentious. I currently cannot think of a common use case inside the core App framework for plugins (and Apps that contain them) to be accessed simultaneously from multiple threads.
Testing
Local tests.