Skip to content

Add documentation to Send & Sync impls #122856

Open
@IoaNNUwU

Description

Location

#[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 is Sync only if the T: Send
  • why MutexGuard is !Send

It can be done as // SAFETY comments or proper docs.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: 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.E-mentorCall 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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions