| Age | Commit message (Collapse) | Author | Lines |
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
References:
- http://stackoverflow.com/q/29884402/51683
- http://stackoverflow.com/q/28387711/51683
|
|
Building on the example in PartialEq.
|
|
Including an example of a custom implementation. I put this expanded
section after the `Derivable` section to encourage use of that first.
|
|
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
|
|
|
|
Also add `Hash` to `std::cmp::Ordering` and most possible traits to
`fmt::Error`.
|
|
|
|
Removing redundant statement about lexicographic ordering.
|
|
Instead of transmuting, use a match; the compiler has learnt how to
optimize it.
|
|
in their API docs
Fixes #29711
|
|
|
|
Remove `stable` stability annotations from inherent impls
|
|
Fixes #28166
|
|
Instead of manually defining it, `partial_cmp` can simply wrap the
result of `cmp` for totally ordered types.
|
|
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`.
|
|
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.
|
|
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`.
|
|
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')
|
|
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
|
|
|
|
Fixes #26620
|
|
|
|
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
|
|
In my opinion this looks nicer, but also it matches the whitespace generally
used for stability markers more closely.
|
|
Fixes #24173
|
|
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]
|
|
`min`-like functions now return the leftmost element/input for equal elements.
`max`-like return the rightmost.
Closes #23687.
cc @HeroesGrave, @aturon, @alexcrichton
|
|
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]
|
|
This commit stabilizes the `std::num` module:
* The `Int` and `Float` traits are deprecated in favor of (1) the
newly-added inherent methods and (2) the generic traits available in
rust-lang/num.
* The `Zero` and `One` traits are reintroduced in `std::num`, which
together with various other traits allow you to recover the most
common forms of generic programming.
* The `FromStrRadix` trait, and associated free function, is deprecated
in favor of inherent implementations.
* A wide range of methods and constants for both integers and floating
point numbers are now `#[stable]`, having been adjusted for integer
guidelines.
* `is_positive` and `is_negative` are renamed to `is_sign_positive` and
`is_sign_negative`, in order to address #22985
* The `Wrapping` type is moved to `std::num` and stabilized;
`WrappingOps` is deprecated in favor of inherent methods on the
integer types, and direct implementation of operations on
`Wrapping<X>` for each concrete integer type `X`.
Closes #22985
Closes #21069
[breaking-change]
|
|
|
|
|
|
* cast 3-valued `core::cmp::Ordering` to `i32`, not `int`.
* use `isize`/`usize` in the impl macros.
|
|
|
|
|
|
|
|
Conflicts:
src/libcore/cmp.rs
src/libcore/fmt/mod.rs
src/libcore/iter.rs
src/libcore/marker.rs
src/libcore/num/f32.rs
src/libcore/num/f64.rs
src/libcore/result.rs
src/libcore/str/mod.rs
src/librustc/lint/builtin.rs
src/librustc/lint/context.rs
src/libstd/sync/mpsc/mod.rs
src/libstd/sync/poison.rs
|
|
|
|
|
|
* `core` - for the core crate
* `hash` - hashing
* `io` - io
* `path` - path
* `alloc` - alloc crate
* `rand` - rand crate
* `collections` - collections crate
* `std_misc` - other parts of std
* `test` - test crate
* `rustc_private` - everything else
|
|
|
|
|
|
This gets rid of the 'experimental' level, removes the non-staged_api
case (i.e. stability levels for out-of-tree crates), and lets the
staged_api attributes use 'unstable' and 'deprecated' lints.
This makes the transition period to the full feature staging design
a bit nicer.
|
|
|
|
[breaking-change]
|