forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
44: Make `Gc<T>` require bounds `T: Send + Sync` r=ltratt a=jacob-hughes The collector finalizes objects off the main thread. This means that if any fields are accessed via T's drop method, it must be done in a thread-safe way. A common pattern is to allow the `Gc<T>` to hold trait objects. For this change to work, TO methods need a `where Self: Send + Sync` clause for the compiler to guarantee object safety. Such clauses are deprecated in rustc because they can be used to create UB when binding to user traits with methods. However, at the time of this commit it's the only known way to add additional bounds for auto traits. From my understanding this usage is considered safe until a better situation arises [1]. [1]: rust-lang#50781 (comment) Co-authored-by: Jake Hughes <[email protected]>
- Loading branch information
Showing
2 changed files
with
31 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters