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

ptr::offset, Spell out the units used for the offset argument #11002

Closed

Conversation

pnkfelix
Copy link
Member

Spell out the units used for the offset argument, so that people do not try to scale to units of bytes themselves.

not try to scale to units of bytes themselves.
bors added a commit that referenced this pull request Dec 16, 2013
…r=alexcrichton

Spell out the units used for the `offset` argument, so that people do not try to scale to units of bytes themselves.
@bors bors closed this Dec 16, 2013
bors added a commit that referenced this pull request Feb 21, 2014
…r=alexcrichton

ptr::RawPtr, spell out units used for the `offset` argument.

spell out units used for the `offset` argument, so that callers do not
try to scale to byte units themselves.

(this was originally landed in PR #11002 for the stand-alone functions, but that PR did not modify the `RawPtr` methods, since that had no doc at all at the time.  Now `RawPtr` has the *only* documentation for `offset`, since the stand-alone functions went away in PR #12167 / PR #12248.)
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 1, 2023
teach `eager_or_lazy` about panicky arithmetic operations

Fixes rust-lang#9422
Fixes rust-lang#9814
Fixes rust-lang#11793

It's a bit sad that we have to do this because arithmetic operations seemed to me like the prime example where a closure would not be necessary, but this has "side effects" (changes behavior when going from lazy to eager) as some of these panic on overflow/underflow if compiled with `-Coverflow-checks` (which is the default in debug mode).
Given the number of backlinks in the mentioned issues, this seems to be a FP that is worth fixing, probably.

changelog: [`unnecessary_lazy_evaluations`]: don't lint if closure has panicky arithmetic operations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants