Skip to content

Commit

Permalink
Rollup merge of rust-lang#49916 - llogiq:doc-atomic-fetch-update, r=k…
Browse files Browse the repository at this point in the history
…ennytm

improve Atomic*::fetch_update docs

This clarifies that fetch_update *always* returns the previous value, either as `Ok(_)` or `Err(_)`, depending on whether the supplied update function returned `Some(_)` or `None`.
  • Loading branch information
kennytm committed Apr 14, 2018
2 parents d21433e + 2f60341 commit 31906e4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libcore/sync/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1425,8 +1425,8 @@ assert_eq!(foo.load(Ordering::SeqCst), 0b011110);

doc_comment! {
concat!("Fetches the value, and applies a function to it that returns an optional
new value. Returns a `Result` (`Ok(_)` if the function returned `Some(_)`, else `Err(_)`) of the
previous value.
new value. Returns a `Result` of `Ok(previous_value)` if the function returned `Some(_)`, else
`Err(previous_value)`.
Note: This may call the function multiple times if the value has been changed from other threads in
the meantime, as long as the function returns `Some(_)`, but the function will have been applied
Expand Down

0 comments on commit 31906e4

Please sign in to comment.