summary refs log tree commit diff
path: root/src/libcore/cmp.rs
AgeCommit message (Collapse)AuthorLines
2017-07-13Add a stability marker for core::cmp::Reverse.0Steven Fackler-1/+1
Closes #43027
2017-07-13Stabilize cmp::ReverseSteven Fackler-4/+3
Closes #40893
2017-05-27Rollup merge of #42260 - stjepang:document-cmp-traits-agreement, r=alexcrichtonMark Simulacrum-2/+14
Docs: impls of PartialEq/PartialOrd/Ord must agree Fixes #41270. This PR brings two improvements to the docs: 1. Docs for `PartialEq`, `PartialOrd`, and `Ord` clarify that their implementations must agree. 2. Fixes a subtle bug in the Dijkstra example for `BinaryHeap`, where the impls are inconsistent. Thanks @Rufflewind for spotting the bug! r? @alexcrichton cc @frankmcsherry
2017-05-27Docs: impls of PartialEq/PartialOrd/Ord must agreeStjepan Glavina-2/+14
2017-04-10Explicit help message for binop type missmatchEsteban Küber-0/+2
When trying to do a binary operation with missing implementation, for example `1 + Some(2)`, provide an explicit help message: ``` note: no implementation for `{integer} + std::option::Option<{integer}>` ``` Use `rustc_on_unimplemented` for the suggestions. Move cfail test to ui.
2017-03-30cmp: Implement all PartialOrd methods for ReverseUlrik Sverdrup-0/+9
When making a forwarding wrapper we must in general forward all methods, so that we use the type's own `lt` for example instead of the default. Example important case: f32's partial_cmp does several operations but its lt is a primitive.
2017-03-29Rollup merge of #40720 - mitsuhiko:feature/rev-key, r=BurntSushiCorey Farwell-0/+35
Added core::cmp::Reverse for sort_by_key reverse sorting I'm not sure if this is the best way to go about proposing this feature but it's pretty useful. It allows you to use `sort_by_key` and return tuples where a single item is then reversed to how it normally sorts. I quite miss something like this in Rust currently though I'm not sure if this is the best way to implement it.
2017-03-29Updated tracking issue for cmp::ReverseArmin Ronacher-3/+3
2017-03-29Changed cmp::Reverse to unstableArmin Ronacher-3/+4
2017-03-22Various fixes to wording consistency in the docsStjepan Glavina-3/+3
2017-03-22Improved bounds for cmp::ReverseArmin Ronacher-6/+6
2017-03-22Fix the test for cmp::ReverseArmin Ronacher-1/+1
2017-03-22Added core::cmp::Reverse for sort_by_key reverse sortingArmin Ronacher-0/+34
2017-03-17Stabilize ordering_chaining, closes #37053Aaron Turon-6/+2
2017-03-14Inline functions Ordering::{then, then_with}Stjepan Glavina-0/+2
@jongiddy noticed bad performance due to the lack of inlining on `then` and `then_with`. I confirmed that inlining really is the culprit by creating a custom `then` function and repeating his benchmark on my machine with and without the `#[inline]` attribute. The numbers were exactly the same on my machine without the attribute. With `#[inline]` I got the same performance as I did with manually inlined implementation.
2017-02-03Bump version, upgrade bootstrapAlex Crichton-9/+3
This commit updates the version number to 1.17.0 as we're not on that version of the nightly compiler, and at the same time this updates src/stage0.txt to bootstrap from freshly minted beta compiler and beta Cargo.
2016-12-30Such large. Very 128. Much bits.Simonas Kazlauskas-0/+6
This commit introduces 128-bit integers. Stage 2 builds and produces a working compiler which understands and supports 128-bit integers throughout. The general strategy used is to have rustc_i128 module which provides aliases for iu128, equal to iu64 in stage9 and iu128 later. Since nowhere in rustc we rely on large numbers being supported, this strategy is good enough to get past the first bootstrap stages to end up with a fully working 128-bit capable compiler. In order for this strategy to work, number of locations had to be changed to use associated max_value/min_value instead of MAX/MIN constants as well as the min_value (or was it max_value?) had to be changed to use xor instead of shift so both 64-bit and 128-bit based consteval works (former not necessarily producing the right results in stage1). This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-12-29Fix typo in PartialOrd docsLuc Street-1/+1
2016-11-01Merge branch 'master' of https://github.com/rust-lang/rustMarcin Fatyga-7/+10
Conflicts: src/libcoretest/lib.rs
2016-10-27tidy/features: fix checking of lang featuresTamir Duberstein-4/+4
Removes the `STATUSES` static which duplicates truth from the pattern match in `collect_lang_features`. Fixes existing duplicates by renaming: - never_type{,_impls} on `impl`s on `!` - concat_idents{,_macro} on `macro_rules! concat_idents` Fixes #37013.
2016-10-27Rename ordering chaining functions.Marcin Fatyga-12/+12
2016-10-22Actually fix doctests.Marcin Fatyga-1/+5
2016-10-16Fix doctestsMarcin Fatyga-4/+4
2016-10-10Fix commentsMarcin Fatyga-2/+2
2016-10-09Fix trailing whitespace.Marcin Fatyga-4/+4
2016-10-09Add or and or_else for ordering.Marcin Fatyga-0/+70
2016-09-26Add missing links on cmp moduleGuillaume Gomez-3/+6
2016-09-10Improve `Eq` derivingVadim Petrochenkov-1/+12
2016-08-31Fix typo in PartialOrd docsFabian Zaiser-1/+1
2016-08-24Use `#[prelude_import]` in `libcore`.Jeffrey Seyfried-8/+1
2016-08-19Remove old stage0 compatibilityBrian Anderson-27/+18
2016-08-13Rename empty/bang to neverAndrew Cann-4/+4
Split Ty::is_empty method into is_never and is_uninhabited
2016-08-13Minor fixups based on @eddyb's feedbackAndrew Cann-2/+2
Mainly, remove mk_empty() method and replace with tcx.types.empty
2016-08-13implement std::cmp::* traits for `!`Andrew Cann-0/+33
2016-05-23Complete `PartialOrd`'s example so it passes make check-docsCarol (Nichols || Goulding)-0/+21
2016-05-23Prefer `ClassName` over `Self` in example trait implementationsCarol (Nichols || Goulding)-8/+8
2016-05-23Use `()` when referring to functionsCarol (Nichols || Goulding)-4/+4
2016-05-23Add some newlines in some code examplesCarol (Nichols || Goulding)-0/+2
2016-05-23"non equal" => "not equal"; consistent with the surrounding textCarol (Nichols || Goulding)-1/+1
2016-05-23Add an explicit "How can I implement `PartialOrd`" doc sectionCarol (Nichols || Goulding)-2/+44
Similar to the `Ord` examples but calling out that it can be defined using `cmp` from `Ord` or using `partial_cmp` in a situation that demands that.
2016-05-23Add an explicit "How can I implement `Ord`" doc sectionCarol (Nichols || Goulding)-0/+40
References: - http://stackoverflow.com/q/29884402/51683 - http://stackoverflow.com/q/28387711/51683
2016-05-23Add an explicit "How can I implement `Eq`" doc sectionCarol (Nichols || Goulding)-1/+24
Building on the example in PartialEq.
2016-05-23Add an explicit "How can I implement `PartialEq`"? doc sectionCarol (Nichols || Goulding)-4/+31
Including an example of a custom implementation. I put this expanded section after the `Derivable` section to encourage use of that first.
2016-05-23`derive` explanation for PartialOrd should match that for OrdCarol (Nichols || Goulding)-2/+2
I think these just got out of sync, but both use a lexicographic ordering. Relevant commits in the history of these explanations: * 8b81f76 on 2015-06-30 * e22770b on 2016-02-09
2016-05-23Add explanations about what derived trait implementations doCarol (Nichols || Goulding)-2/+7
2016-04-15Implement `Default` for more types in the standard libraryTobias Bucher-1/+1
Also add `Hash` to `std::cmp::Ordering` and most possible traits to `fmt::Error`.
2016-03-18Add doc examplesGuillaume Gomez-0/+35
2016-02-09Clarifying behavior of #[derive(Ord, PartialOrd)] in doc comments.Adam Perry-4/+4
Removing redundant statement about lexicographic ordering.
2016-01-21Remove `unsafe` code from `core::cmp`Andrea Canciani-13/+4
Instead of transmuting, use a match; the compiler has learnt how to optimize it.
2015-11-16Make note about traits that can be derivedSteve Klabnik-0/+8
in their API docs Fixes #29711