| Age | Commit message (Collapse) | Author | Lines |
|
|
|
in stdlib docs
|
|
|
|
|
|
Stabilize Option::copied
closes https://github.com/rust-lang/rust/issues/57126
|
|
Option and Result: Add references to documentation of as_ref and as_mut
This makes the documentation more consistent with that of `Pin::as_ref` which converts "from `&Pin<Pointer<T>>` to `Pin<&t>`".
This generally makes it clearer that the reference is going inside the option.
|
|
Improved test output
|
|
No old chestnuts in iter::repeat docs
The current language may be amusing, yet is just imprecise and most especially difficult to understand for someone who speaks English as a foreign language.
|
|
Stabilize Range*::contains.
Closes https://github.com/rust-lang/rust/issues/32311. There's also a bit of rustfmt on range.rs thrown in for good measure (I forgot to turn off format-on-save in VSCode).
|
|
Consistent naming for duration_float methods and additional f32 methods
`duration_float` tracking issue: #54361
New list of methods:
- `as_secs_f64(&self) -> f64`
- `as_secs_f32(&self) -> f32`
- `from_secs_f64(secs: f64) -> Duration`
- `from_secs_f32(secs: f32) -> Duration`
- `mul_f64(self, rhs: f64) -> Duration`
- `mul_f32(self, rhs: f32) -> Duration`
- `div_f64(self, rhs: f64) -> Duration`
- `div_f32(self, rhs: f64) -> Duration`
- `div_duration_f64(self, rhs: Duration) -> f64`
- `div_duration_f32(self, rhs: Duration) -> f32`
With [`num_traits::Float`](https://docs.rs/num-traits/0.2.6/num_traits/float/trait.Float.html) we could've reduced number of methods by factor of two, but unfortunately it's not part of `std`.
|
|
A few improvements to comments in user-facing crates
Not too many this time, and all concern comments (almost all doc comments) in user-facing crates (libstd, libcore, liballoc).
r? @steveklabnik
|
|
we can now skip should_panic tests with the libtest harness
|
|
|
|
closes https://github.com/rust-lang/rust/issues/57126
|
|
core: ensure VaList passes improper_ctypes lint
Ensure the `core::ffi::VaList` structure passes the `improper_ctypes` lint.
Fixes: #58280
|
|
|
|
This reverts commit dc2d5058e999abb18ab2686b4e3e385ec6e36666.
|
|
This reverts commit 313aab8fbeb98730f8ffa741ccf54f843d5e3525.
|
|
|
|
|
|
|
|
Add clamp for ranges. Implements #44095
Ready for merge
|
|
|
|
The current language may be amusing, yet is just imprecise and most especially difficult to understand for someone who speaks English as a foreign language.
|
|
|
|
Simplify Iterator::{min, max}
This PR simplifies the `select_fold1` helper method used to implmement `Iterator::{min, min_by, min_by_key, max, max_by, max_by_key}` by removing the projection argument, which was only used by the implementations of `min_by_key` and `max_by_key`.
I also added tests to ensure that the stability as mentioned in the comments of `min` and `max` is preserved, and fixed the `iter::{bench_max, bench_max_by_key}` benchmarks which the compiler presumably was able to collapse into closed-form expressions. None of the benchmark results were impacted, I suspect their generated assembly didn't change.
|
|
Note that NonNull does not launder shared references for mutation
See https://users.rust-lang.org/t/relative-pointer-an-abstraction-to-build-movable-self-referential-types/26186/6
|
|
Replace assert with assert_eq
Use `assert_eq!` instead of `assert!` for the tests
|
|
impl FromIterator for Result: Use assert_eq! instead of assert!
|
|
Standardize `Range*` documentation
This updates the final example in the documentation for the types
`Range`, `RangeFrom`, `RangeFull`, `RangeInclusive`, `RangeTo`,
`RangeToInclusive`.
|
|
Use lifetime contravariance to elide more lifetimes in core+alloc+std
Sample:
```diff
- impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b mut B> for &'a mut A where A: PartialEq<B> {
+ impl<A: ?Sized, B: ?Sized> PartialEq<&mut B> for &mut A where A: PartialEq<B> {
#[inline]
- fn eq(&self, other: &&'b mut B) -> bool { PartialEq::eq(*self, *other) }
+ fn eq(&self, other: &&mut B) -> bool { PartialEq::eq(*self, *other) }
#[inline]
- fn ne(&self, other: &&'b mut B) -> bool { PartialEq::ne(*self, *other) }
+ fn ne(&self, other: &&mut B) -> bool { PartialEq::ne(*self, *other) }
}
```
[I didn't know this worked](https://internals.rust-lang.org/t/why-can-you-use-different-unconstrained-lifetimes-to-implement-traits/9544/2?u=scottmcm) until recently, but since defining methods contravariantly in their lifetimes this way has worked back to Rust 1.0, we might as well take advantage of combining it with IHLE.
|
|
Fix documentation of from_ne_bytes and from_le_bytes
Copypasta mistake, the documentation of `from_ne_bytes` and `from_le_bytes` used the big-endian variant in the example snippets.
|
|
|
|
Expand docs for `TryFrom` and `TryInto`.
The examples are still lacking for now, both for module docs and for methods/impl's. Will be adding those in further pushes.
Should hopefully resolve the doc concern in #33417 when finished?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This updates the final example in the documentation for the types
`Range`, `RangeFrom`, `RangeFull`, `RangeInclusive`, `RangeTo`,
`RangeToInclusive`.
|
|
|
|
std::nth_element (a.k.a. quickselect)
Add some more notes to the documentation:
- Mention that the median can be found if we used `len() / 2`.
- Mention that this function is usually called "kth element" in other libraries.
Address some comments in PR:
- Change wording on some of the documentation
- Change recursive function into a loop
Update name to `partition_at_index` and add convenience return values.
Address reviewer comments:
- Don't swap on each iteration when searching for min/max element.
- Add some docs about when we panic.
- Test that the sum of the lengths of the output matches the length of the input.
- Style fix for for-loop.
Address more reviewer comments
Fix Rng stuff for test
Fix doc test build
Don't run the partition_at_index test on wasm targets
Miri does not support entropy for test partition_at_index
|
|
|
|
|