-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Docs for fetch_add/fetch_sub/pow and overflow behavior #40916
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
Comments
The default behavior for overflow is "panic in debug mode, wrap in release mode." So anything that does that does not need a note. Anything else should get one. |
In that case, we must add a note for |
Dupe of #34618? |
Yeah just adding a note here about overflow should be fine, but yeah looks like a dupe of #34618 so closing |
… r=alexcrichton Add a note about overflow for fetch_add/fetch_sub Fixes rust-lang#40916 r? @steveklabnik
…hton Add a note about overflow for fetch_add/fetch_sub Fixes #40916 Fixes #34618 r? @steveklabnik
… r=alexcrichton Add a note about overflow for fetch_add/fetch_sub Fixes rust-lang#40916 Fixes rust-lang#34618 r? @steveklabnik
… r=alexcrichton Add a note about overflow for fetch_add/fetch_sub Fixes rust-lang#40916 Fixes rust-lang#34618 r? @steveklabnik
… r=alexcrichton Add a note about overflow for fetch_add/fetch_sub Fixes rust-lang#40916 Fixes rust-lang#34618 r? @steveklabnik
fetch_add fetch_sub pow
Do docs for those methods need to explain what happens on overflow? There are three possible overflow behaviors: panic, saturate, wrap. Is it obvious what those methods do on overflow?
Perhaps we should explain? I guess
fetch_add
andfetch_sub
wrap around, whilepow
panics in debug mode and wraps around in release mode.cc @alexcrichton
The text was updated successfully, but these errors were encountered: