Skip to content

Commit 31906e4

Browse files
committed
Rollup merge of rust-lang#49916 - llogiq:doc-atomic-fetch-update, r=kennytm
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`.
2 parents d21433e + 2f60341 commit 31906e4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libcore/sync/atomic.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1425,8 +1425,8 @@ assert_eq!(foo.load(Ordering::SeqCst), 0b011110);
14251425

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

0 commit comments

Comments
 (0)