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

Docs for fetch_add/fetch_sub/pow and overflow behavior #40916

Closed
ghost opened this issue Mar 29, 2017 · 4 comments
Closed

Docs for fetch_add/fetch_sub/pow and overflow behavior #40916

ghost opened this issue Mar 29, 2017 · 4 comments
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools

Comments

@ghost
Copy link

ghost commented Mar 29, 2017

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 and fetch_sub wrap around, while pow panics in debug mode and wraps around in release mode.

cc @alexcrichton

@frewsxcv frewsxcv added the A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools label Mar 30, 2017
@steveklabnik
Copy link
Member

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.

@ghost
Copy link
Author

ghost commented Mar 30, 2017

In that case, we must add a note for fetch_add and fetch_sub. They don't panic in debug mode: https://is.gd/AnruSb

@ollie27
Copy link
Member

ollie27 commented Mar 30, 2017

Dupe of #34618?

@alexcrichton
Copy link
Member

Yeah just adding a note here about overflow should be fine, but yeah looks like a dupe of #34618 so closing

frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 2, 2017
… r=alexcrichton

Add a note about overflow for fetch_add/fetch_sub

Fixes rust-lang#40916

r? @steveklabnik
bors added a commit that referenced this issue Apr 2, 2017
…hton

Add a note about overflow for fetch_add/fetch_sub

Fixes #40916
Fixes #34618

r? @steveklabnik
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 3, 2017
… r=alexcrichton

Add a note about overflow for fetch_add/fetch_sub

Fixes rust-lang#40916
Fixes rust-lang#34618

r? @steveklabnik
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 3, 2017
… r=alexcrichton

Add a note about overflow for fetch_add/fetch_sub

Fixes rust-lang#40916
Fixes rust-lang#34618

r? @steveklabnik
arielb1 pushed a commit to arielb1/rust that referenced this issue Apr 5, 2017
… r=alexcrichton

Add a note about overflow for fetch_add/fetch_sub

Fixes rust-lang#40916
Fixes rust-lang#34618

r? @steveklabnik
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
Projects
None yet
Development

No branches or pull requests

4 participants