Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Docs: sync #29377

Closed
29 of 31 tasks
steveklabnik opened this issue Oct 26, 2015 · 18 comments · Fixed by #54078
Closed
29 of 31 tasks

API Docs: sync #29377

steveklabnik opened this issue Oct 26, 2015 · 18 comments · Fixed by #54078
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. E-help-wanted Call for participation: Help is requested to fix this issue. E-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. P-medium Medium priority

Comments

@steveklabnik
Copy link
Member

steveklabnik commented Oct 26, 2015

Part of #29329

http://doc.rust-lang.org/std/sync/

Here's what needs to be done to close out this issue:

  • the module-level documentation is very small. It should explain what the module is for in more detail, with some examples.
  • std::sync::atomic could use links to the types it references.
  • std::sync::atomic::fence has very... dry docs that aren't very helpful. And there's no examples.
  • ATOMIC_*_INIT (link is just to BOOL but all of them) could use examples.
  • Atomic* (link is to Bool but all of them) are mostly fine, but could use links to other types and some beefing up generally.
  • Barrier needs a bunch of types linked.
  • BarrierWaitResult should explain its relationship with Barrier and link to it.
  • Condvar needs examples on its methods.
  • Once needs to link to ONCE_INIT.
  • PoisonError needs examples.
  • RwLock needs examples, links to types, and a comparison between it and Mutex.
  • WaitTimeoutResult should link to the method that creates it.
  • TryLockError needs to link to the function that creates it.
  • ONCE_INIT needs a link to Once and some examples.
  • LockResult needs links.
  • TryLockResult needs links.
  • Weak could do a much better job of explaining itself.
  • std::sync::mspc needs a lot of links. The docs are good but a bit jargon-heavy, expanding those would be nice.
  • IntoIter needs more links and to explain how you get one.
  • Iter is the same.
  • Receiver needs links, examples, and more explanation of what it is.
  • RecvError needs to link to recv.
  • SendError needs links.
  • Sender has the same issues as Receiver.
  • SyncSender has the same as Sender.
  • TryIter needs to link to how to create one.
  • RecvTimeoutError needs to link to recv_timeout.
  • TryRecvError needs to link to try_recv
  • TrySendError needs to link to try_send.
  • channel has almost no docs and it's the focus of this module!
  • sync_channel should point to channel and then tell how it's different.
@iuliuv
Copy link

iuliuv commented Jan 11, 2016

Possible inconsistency in the Rust documentation about channels:

https://doc.rust-lang.org/std/sync/mpsc/fn.sync_channel.html
Function std::sync::mpsc::sync_channel
"As with asynchronous channels, all senders will panic in send if the Receiver has been destroyed"

https://doc.rust-lang.org/std/sync/mpsc/struct.SyncSender.html
Struct std::sync::mpsc::SyncSender:
fn send(&self, t: T) -> Result<(), SendError>
"This function will never panic, but it may return Err if the Receiver has disconnected and is no longer able to receive information."

@kmcallister
Copy link
Contributor

I'm working on updating the Arc docs to more closely match the refined Rc docs from #36571.

@steveklabnik steveklabnik added the E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. label Mar 8, 2017
@steveklabnik
Copy link
Member Author

I am happy to mentor anyone who wants to tackle this issue.

@steveklabnik steveklabnik added the A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools label Mar 10, 2017
@steveklabnik steveklabnik added P-medium Medium priority E-help-wanted Call for participation: Help is requested to fix this issue. E-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate. and removed A-docs labels Mar 24, 2017
@projektir
Copy link
Contributor

@steveklabnik for all the ones that need links, are you talking about for example the types wrapped in <code> tags, such as Sender under the std::sync::mpsc::Receiver page? Is it safe to say that as general rule every type under a <code> tag should link to the page for that type? Is there other linking on these pages you would expect to see?

@steveklabnik
Copy link
Member Author

steveklabnik commented Mar 27, 2017

Is it safe to say that as general rule every type under a <code> tag should link to the page for that type?

Yes, exactly. Note that sometimes there is a bug here; that is, certain kinds of docs get rendered on two pages and so the links won't work. I don't think that's an issue here, but our tools will catch those cases, so you shouldn't worry about it too much, but figured it'd be worth a mention.

Is there other linking on these pages you would expect to see?

That's pretty much it, just the stuff that's in <code> already.

@projektir
Copy link
Contributor

projektir commented Mar 27, 2017

Someone looks to have fixed up Barrier on nightly, btw.

@steveklabnik
Copy link
Member Author

Someone looks to have fixed up Barrier on nightly, btw.

Ah, I made these off of the stable links, I think :(

frewsxcv added a commit to frewsxcv/rust that referenced this issue Mar 29, 2017
Adding linking for Once docs rust-lang#29377

Linking everything around `Once`, `ONCE_INIT`, and `OnceState`.
Technius added a commit to Technius/rust that referenced this issue Mar 31, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue Mar 31, 2017
Adding links for Atomics docs rust-lang#29377

r? @steveklabnik

This should be good for `std::sync::atomic`. The other pages still need more (examples, etc.).
frewsxcv added a commit to frewsxcv/rust that referenced this issue Mar 31, 2017
Adding links for Atomics docs rust-lang#29377

r? @steveklabnik

This should be good for `std::sync::atomic`. The other pages still need more (examples, etc.).
Technius added a commit to Technius/rust that referenced this issue Apr 1, 2017
This change adds links to to `Receiver`, `Iter`, `TryIter`, `IntoIter`,
`Sender`, `SyncSender`, `SendError`, `RecvError`, `TryRecvError`,
`RecvTimeoutError`, `TrySendError`, `Sender::send`, `SyncSender::send`,
`SyncSender::try_send`, `Receiver::recv`, `Receiver::recv_timeout`,
`Receiver::iter`, and `Receiver::try_iter`.

Examples added to `Receiver`, `Sender`, `Receiver::iter`.
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 3, 2017
…steveklabnik

Updating the description for BarrierWaitResult rust-lang#29377

Referencing `Barrier`, removing reference to `is_leader`.
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 3, 2017
…steveklabnik

Updating the description for BarrierWaitResult rust-lang#29377

Referencing `Barrier`, removing reference to `is_leader`.
@projektir
Copy link
Contributor

projektir commented Apr 4, 2017

@steveklabnik can we check some boxes off to track progress and make it easier to see where we're at? 😄 Things that I believe can be marked off:

std::sync::atomic -> merged, but I could understand if you want more stuff here
Once -> merged
ONCE_INIT -> merged
WaitTimeoutResult -> looks good to me on nightly
LockResult -> has links on nightly
TryLockResult -> has links on nightly

Awaiting merge/approval:
BarrierWaitResult -> going to be merged, could as well be marked off I think
std::sync::mspc -> looks good, too, but waiting for approval

@steveklabnik
Copy link
Member Author

@projektir done, thank you!

frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 4, 2017
…steveklabnik

Updating the description for BarrierWaitResult rust-lang#29377

Referencing `Barrier`, removing reference to `is_leader`.
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 4, 2017
Add links and some examples to std::sync::mpsc docs

Addresses part of rust-lang#29377
r? @steveklabnik

I took a stab at adding links to the `std::sync::mpsc` docs, and I also wrote a few examples.

Edit: Whoops, typed in `?r` instead of `r?`.
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 4, 2017
…steveklabnik

Updating the description for BarrierWaitResult rust-lang#29377

Referencing `Barrier`, removing reference to `is_leader`.
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 4, 2017
Add links and some examples to std::sync::mpsc docs

Addresses part of rust-lang#29377
r? @steveklabnik

I took a stab at adding links to the `std::sync::mpsc` docs, and I also wrote a few examples.

Edit: Whoops, typed in `?r` instead of `r?`.
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 13, 2017
Updating docs for std::sync::Weak rust-lang#29377

I will duplicate these changes for [`std::rc::Weak`] if they are approved.

[`std::rc::Weak`]: https://doc.rust-lang.org/std/rc/struct.Weak.html

r? @jonathandturner
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 13, 2017
Updating docs for std::sync::Weak rust-lang#29377

I will duplicate these changes for [`std::rc::Weak`] if they are approved.

[`std::rc::Weak`]: https://doc.rust-lang.org/std/rc/struct.Weak.html

r? @jonathandturner
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 13, 2017
Updating docs for std::sync::Weak rust-lang#29377

I will duplicate these changes for [`std::rc::Weak`] if they are approved.

[`std::rc::Weak`]: https://doc.rust-lang.org/std/rc/struct.Weak.html

r? @jonathandturner
@durka
Copy link
Contributor

durka commented Apr 13, 2017

Condvar has examples on its methods, but the ones for wait_* seem to contain race conditions.

WaitTimeoutResult::timed_out has an example that does not use the method (it is copied from the incorrect example for Condvar::wait_timeout).

@projektir
Copy link
Contributor

I think @GuillaumeGomez worked on the Condvar examples?

@GuillaumeGomez
Copy link
Member

It's very possible, I had issue with timeout stuff...

frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 24, 2017
Adding links and examples for various mspc pages rust-lang#29377

Adding links and copying examples for the various Iterators; adding some extra stuff to `Sender`/`SyncSender`/`Receiver`.
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 24, 2017
Adding links and examples for various mspc pages rust-lang#29377

Adding links and copying examples for the various Iterators; adding some extra stuff to `Sender`/`SyncSender`/`Receiver`.
arielb1 pushed a commit to arielb1/rust that referenced this issue Apr 27, 2017
Adding links and examples for various mspc pages rust-lang#29377

Adding links and copying examples for the various Iterators; adding some extra stuff to `Sender`/`SyncSender`/`Receiver`.
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 27, 2017
Adding links and examples for various mspc pages rust-lang#29377

Adding links and copying examples for the various Iterators; adding some extra stuff to `Sender`/`SyncSender`/`Receiver`.
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 27, 2017
Adding links and examples for various mspc pages rust-lang#29377

Adding links and copying examples for the various Iterators; adding some extra stuff to `Sender`/`SyncSender`/`Receiver`.
frewsxcv added a commit to frewsxcv/rust that referenced this issue May 3, 2017
…eveklabnik

Update docs of 'fence'

This PR updates the docs for `std::sync::atomic::fence` with an example and a diagram.
Part of rust-lang#29377.
r? @steveklabnik
@gamazeps
Copy link
Contributor

@steveklabnik is the list of things to do in this module up to date ?

I was thinking on tackling this module once I am done with the thread module (probably on Monday).

If no one else is working on this I'll try to document the whole module for the next week (and maybe a little bit of the next one).

@GuillaumeGomez
Copy link
Member

@gamazeps: More or less. It still has a lot of places to improvement anyway so feel free to give it a try!

@projektir
Copy link
Contributor

projektir commented May 15, 2017

@gamazeps so everything starting with Weak and going down should be done now, it's just not marked off.

I've been working on rewriting this page: std::sync::atomic: https://doc.rust-lang.org/std/sync/atomic/, but that relates more to this issue: #40306, and I have been distracted so it's going slow. I hope to get it done this week.

Atomic fence may be done, also, I've seen some PR's for it. But @steveklabnik would need to clarify.

So everything else should be up for grabs and of course nothing's stopping you from improving any given page further.

@Mark-Simulacrum Mark-Simulacrum added the C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. label Jul 24, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue Sep 23, 2017
std::sync::RwLock docs improvement

Addresses the `RwLock` part of rust-lang#29377.
r? @steveklabnik

Added examples, links to types, and a small comparison between RwLock and Mutex.
@lorepozo
Copy link
Contributor

@steveklabnik I completed the RwLock subtask with #44778

@lorepozo
Copy link
Contributor

@steveklabnik ditto for PoisonError and TryLockError.

What did you have in mind for changes to Atomic*?

@steveklabnik
Copy link
Member Author

@lucasem thank you!

What did you have in mind for changes to Atomic*?

So I'm looking at them now, and they're pretty good. Mostly, there's a few types mentioned that don't have links, like how https://doc.rust-lang.org/std/sync/atomic/struct.AtomicBool.html doesn't have a link to https://doc.rust-lang.org/stable/std/primitive.bool.html

I wonder if we should point to the module documentation as well, like, add a sentence to each type saying

For more about the differences between atomic types and non-atomic types, please see the module-level documentation.

Thoughts?

Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Sep 29, 2017
docs improvement std::sync::{PoisonError, TryLockError}

Addresses the `PoisonError` and `TryLockError` parts of rust-lang#29377.
Adds examples and links.

r? @steveklabnik
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Sep 29, 2017
docs improvement sync::atomic::Atomic*

Addresses the `Atomic*` part of rust-lang#29377.
r? @steveklabnik
pietroalbini added a commit to pietroalbini/rust that referenced this issue Oct 5, 2018
…teveklabnik

Expand the documentation for the `std::sync` module

I've tried to expand the documentation for Rust's synchronization primitives. The module level documentation explains why synchronization is required when working with a multiprocessor system,
and then links to the appropiate structure in this module.

Fixes rust-lang#29377, since this should be the last item on the checklist (documentation for `Atomic*` was fixed in rust-lang#44854, but not ticked off the checklist).
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 4, 2022
intra-doc: Make `Receiver::into_iter` into a clickable link

The documentation on `std::sync::mpsc::Iter` and `std::sync::mpsc::TryIter` provides links to the corresponding `Receiver` methods, unlike `std::sync::mpsc::IntoIter` does.

This was left out in c59b188
Related to rust-lang#29377
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. E-help-wanted Call for participation: Help is requested to fix this issue. E-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. P-medium Medium priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants