Rename Div operator trait to Quot and Modulo operator trait to Rem#5990
Merged
bors merged 1 commit intorust-lang:incomingfrom Apr 21, 2013
Merged
Rename Div operator trait to Quot and Modulo operator trait to Rem#5990bors merged 1 commit intorust-lang:incomingfrom
bors merged 1 commit intorust-lang:incomingfrom
Conversation
bors
added a commit
that referenced
this pull request
Apr 21, 2013
This renaming, proposed in the [Numeric Bikeshed](https://github.com/mozilla/rust/wiki/Bikeshed-Numeric-Traits#rename-modulo-into-rem-or-remainder-in-traits-and-docs), will allow us to implement div and and modulo methods that follow the conventional mathematical definitions for negative numbers without altering the definitions of the operators (and confusing systems programmers). Here is a useful answer on StackOverflow that explains the difference between `div`/`mod` and `quot`/`rem` in Haskell: (When is the difference between quotRem and divMod useful?)[http://stackoverflow.com/a/339823/679485]. This is part of the numeric trait reforms tracked in issue #4819.
Contributor
|
Does % still do the thing that is one machine instruction? |
Contributor
Author
|
@graydon Yes of course. / and % behave exactly like C – for compatibility and performance reasons. The only change is the name. |
Contributor
|
Cool, thanks! |
This was referenced Apr 22, 2013
bors
added a commit
that referenced
this pull request
Apr 23, 2013
BigInt had been supported quot/rem and div/mod correctly, but after merging #5990 they have been broken. This commit fixes it.
2 tasks
flip1995
pushed a commit
to flip1995/rust
that referenced
this pull request
Sep 10, 2020
default_trait_access: Fix wrong suggestion rust-lang/rust-clippy#5975 (comment) > I think the underlying problem is clippy suggests code with complete parameters, not clippy triggers this lint even for complex types. AFAIK, If code compiles with `Default::default`, it doesn't need to specify any parameters, as type inference is working. (So, in this case, `default_trait_access` should suggest `RefCell::default`.) Fixes rust-lang#5975 Fixes rust-lang#5990 changelog: `default_trait_access`: fixed wrong suggestion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This renaming, proposed in the Numeric Bikeshed, will allow us to implement div and and modulo methods that follow the conventional mathematical definitions for negative numbers without altering the definitions of the operators (and confusing systems programmers). Here is a useful answer on StackOverflow that explains the difference between
div/modandquot/remin Haskell: (When is the difference between quotRem and divMod useful?)[http://stackoverflow.com/a/339823/679485].This is part of the numeric trait reforms tracked in issue #4819.