about summary refs log tree commit diff
path: root/src/libcore/cmp.rs
AgeCommit message (Collapse)AuthorLines
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
2015-11-12libcore: deny warnings in doctestsKevin Butler-4/+0
2015-11-06Remove stability annotations from trait impl itemsVadim Petrochenkov-2/+0
Remove `stable` stability annotations from inherent impls
2015-09-30Clarify logic instead of using 'vice versa'Steve Klabnik-1/+1
Fixes #28166
2015-09-16Reuse cmp in totally ordered typesAndrea Canciani-3/+1
Instead of manually defining it, `partial_cmp` can simply wrap the result of `cmp` for totally ordered types.
2015-09-16Specialize `PartialOrd` for totally ordered primitive typesAndrea Canciani-4/+22
Knowing the result of equality comparison can enable additional optimizations in LLVM. Additionally, this makes it obvious that `partial_cmp` on totally ordered types cannot return `None`.
2015-08-12Remove all unstable deprecated functionalityAlex Crichton-73/+1
This commit removes all unstable and deprecated functions in the standard library. A release was recently cut (1.3) which makes this a good time for some spring cleaning of the deprecated functions.
2015-08-09Replace many uses of `mem::transmute` with more specific functionsTobias Bucher-1/+6
The replacements are functions that usually use a single `mem::transmute` in their body and restrict input and output via more concrete types than `T` and `U`. Worth noting are the `transmute` functions for slices and the `from_utf8*` family for mutable slices. Additionally, `mem::transmute` was often used for casting raw pointers, when you can already cast raw pointers just fine with `as`.
2015-07-29Rollup merge of #27326 - steveklabnik:doc_show_use, r=GankroSteve Klabnik-4/+8
In spirit with https://internals.rust-lang.org/t/should-we-keep-including-obvious-imports-in-code-examples/2217, show the feature flags we're using in examples. (also one instance of 'use')
2015-07-27std: Deprecate a number of unstable featuresAlex Crichton-0/+2
Many of these have long since reached their stage of being obsolete, so this commit starts the removal process for all of them. The unstable features that were deprecated are: * cmp_partial * fs_time * hash_default * int_slice * iter_min_max * iter_reset_fuse * iter_to_vec * map_in_place * move_from * owned_ascii_ext * page_size * read_and_zero * scan_state * slice_chars * slice_position_elem * subslice_offset
2015-07-27Show appropriate feature flags in docsSteve Klabnik-4/+8
2015-06-30Make note of Ord's derive orderingSteve Klabnik-0/+2
Fixes #26620
2015-06-17Fallout in tests and docs from feature renamingsAlex Crichton-4/+4
2015-06-17core: Split apart the global `core` featureAlex Crichton-18/+20
This commit shards the broad `core` feature of the libcore library into finer grained features. This split groups together similar APIs and enables tracking each API separately, giving a better sense of where each feature is within the stabilization process. A few minor APIs were deprecated along the way: * Iterator::reverse_in_place * marker::NoCopy
2015-05-09Convert #[lang="..."] to #[lang = "..."]Nick Hamann-2/+2
In my opinion this looks nicer, but also it matches the whitespace generally used for stability markers more closely.
2015-04-20remove bad example from PartialEq docsSteve Klabnik-21/+0
Fixes #24173
2015-03-31rollup merge of #23288: alexcrichton/issue-19470Alex Crichton-1/+0
This is a deprecated attribute that is slated for removal, and it also affects all implementors of the trait. This commit removes the attribute and fixes up implementors accordingly. The primary implementation which was lost was the ability to compare `&[T]` and `Vec<T>` (in that order). This change also modifies the `assert_eq!` macro to not consider both directions of equality, only the one given in the left/right forms to the macro. This modification is motivated due to the fact that `&[T] == Vec<T>` no longer compiles, causing hundreds of errors in unit tests in the standard library (and likely throughout the community as well). Closes #19470 [breaking-change]
2015-03-31rollup merge of #23878: Ryman/stable_extremesAlex Crichton-5/+9
`min`-like functions now return the leftmost element/input for equal elements. `max`-like return the rightmost. Closes #23687. cc @HeroesGrave, @aturon, @alexcrichton
2015-03-31std: Remove #[old_orphan_check] from PartialEqAlex Crichton-1/+0
This is a deprecated attribute that is slated for removal, and it also affects all implementors of the trait. This commit removes the attribute and fixes up implementors accordingly. The primary implementation which was lost was the ability to compare `&[T]` and `Vec<T>` (in that order). This change also modifies the `assert_eq!` macro to not consider both directions of equality, only the one given in the left/right forms to the macro. This modification is motivated due to the fact that `&[T] == Vec<T>` no longer compiles, causing hundreds of errors in unit tests in the standard library (and likely throughout the community as well). cc #19470 [breaking-change]