-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsE-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Description
Location
rust/library/std/src/sync/mutex.rs
Lines 186 to 189 in 0ad927c
#[stable(feature = "rust1", since = "1.0.0")] | |
unsafe impl<T: ?Sized + Send> Send for Mutex<T> {} | |
#[stable(feature = "rust1", since = "1.0.0")] | |
unsafe impl<T: ?Sized + Send> Sync for Mutex<T> {} |
Summary
I think it is a good idea to document Send
& Sync
impls in types such as Mutex
, RwLock
etc. especially considering they are unsafe
traits.
Also it's not obvious why some types have particular restrictions, for example:
- why
Mutex
isSync
only if theT: Send
- why
MutexGuard
is!Send
It can be done as // SAFETY comments or proper docs.
workingjubilee, reswqa, IoaNNUwU and GuillaumeGomez
Metadata
Metadata
Assignees
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsE-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.