Giacomo Stevanato
af1e3633f7
Set sift=true only when PeekMut yields a mutable reference
2020-09-20 01:12:02 +02:00
Giacomo Stevanato
924cd135b6
Added benchmarks for BinaryHeap
2020-09-20 01:12:02 +02:00
Denis Vasilik
f9fa649545
Use intra-doc links
2020-09-19 23:30:52 +02:00
bors
f68e08933d
Auto merge of #76929 - ssomers:btree_cleanup_2, r=Mark-Simulacrum
...
BTreeMap: wrap node's raw parent pointer in NonNull
Now that the other `*const` (root) is gone, seemed like a small step forward.
r? `@Mark-Simulacrum`
2020-09-19 19:15:06 +00:00
Stein Somers
0661b0a36d
BTreeMap: wrap node's raw parent pointer in NonNull
2020-09-19 19:02:42 +02:00
Mara Bos
26d6081f1d
Relax promises about condition variable.
...
This allows for futex or thread parking based implementations in the
future.
2020-09-19 18:48:39 +02:00
Stein Somers
c6a8cfbde8
BTreeMap: code readability tweaks
2020-09-19 17:08:43 +02:00
Lzu Tao
a50ec5f144
Remove outdated ignored tidy comment
2020-09-19 15:01:51 +00:00
Lzu Tao
3ee724e610
Move (u)int_impl macros to their own files
2020-09-19 15:01:49 +00:00
rijenkii
a60f97849b
Add tracking issue for feature(unix_socket_peek)
2020-09-19 21:55:01 +07:00
Lzu Tao
a54584319e
Move dummy integer modules (like core::u32) to shells dir
2020-09-19 14:54:20 +00:00
Lzu Tao
550939f654
Move error structs to new mod
2020-09-19 14:54:20 +00:00
Lzu Tao
7125a481ce
Move Wrapping<T> definition to wrapping mod
2020-09-19 14:54:20 +00:00
Lzu Tao
baecad9c39
Move NonZero* to its file
2020-09-19 14:54:20 +00:00
Ralf Jung
b4c3f409af
Rollup merge of #76798 - alistair23:alistair/rv32-linux, r=jyn514
...
Build fixes for RISC-V 32-bit Linux support
This fixes build issues with the 32-bit RISC-V port.
2020-09-19 11:47:56 +02:00
Ralf Jung
46bb884cf3
Rollup merge of #76525 - fusion-engineering-forks:string-drain, r=dtolnay
...
Add as_str() to string::Drain.
Vec's Drain recently [had its `.as_slice()` stabilized](https://github.com/rust-lang/rust/pull/72584 ), but String's Drain was still missing the analogous `.as_str()`. This adds that.
Also improves the Debug implementation, which now shows the remaining data instead of just `"Drain { .. }"`.
2020-09-19 11:47:47 +02:00
Ralf Jung
fef3324043
Rollup merge of #76492 - fusion-engineering-forks:int-bits, r=dtolnay
...
Add associated constant `BITS` to all integer types
Recently I've regularly come across this snippet (in a few different crates, including `core` and `std`):
```rust
std::mem::size_of<usize>() * 8
```
I think it's time for a `usize::BITS`.
2020-09-19 11:47:45 +02:00
Ralf Jung
1720fd94e8
Rollup merge of #76434 - RalfJung:black-box, r=Mark-Simulacrum
...
do not inline black_box when building for Miri
We cannot do the assembly trick in Miri, but let's at least make sure MIR inlining does not circumvent the black_box.
Also use black_box instead of local optimization barriers in a few const tests.
2020-09-19 11:47:43 +02:00
Ralf Jung
67fa7b78a4
Rollup merge of #76400 - pickfire:patch-5, r=dtolnay
...
Clean up vec benches bench_in_place style
2020-09-19 11:47:41 +02:00
Ralf Jung
bac2f39350
Rollup merge of #76310 - scottmcm:array-try_from-vec, r=dtolnay
...
Add `[T; N]: TryFrom<Vec<T>>` (insta-stable)
This is very similar to the [existing](https://doc.rust-lang.org/nightly/std/convert/trait.TryFrom.html#impl-TryFrom%3CBox%3C%5BT%5D%3E%3E ) `Box<[T; N]>: TryFrom<Box<[T]>>`, but allows avoiding the `shrink_to_fit` if you have a vector and not a boxed slice.
Like the slice equivalents of this, it fails if the length of the vector is not exactly `N`.
This uses `Vec<T>` as the `Error` type to return the input, like how the `Rc<[T]> -> Rc<[T; N]>` (and Arc) ones also reflect the input directly in the error type.
```rust
#[stable(feature = "array_try_from_vec", since = "1.47.0")]
impl<T, const N: usize> TryFrom<Vec<T>> for [T; N] {
type Error = Vec<T>;
fn try_from(mut vec: Vec<T>) -> Result<[T; N], Vec<T>>;
}
```
Inspired by this zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/APIs.20for.20getting.20stuff.20from.20a.20Vec.20by.20owned/near/209048103
2020-09-19 11:47:39 +02:00
Ralf Jung
44be933ff7
Rollup merge of #73963 - hellow554:unsafe_path, r=Mark-Simulacrum
...
deny(unsafe_op_in_unsafe_fn) in libstd/path.rs
The libstd/path.rs part of #73904 . Wraps the two calls to an unsafe fn Initializer::nop() in an unsafe block.
2020-09-19 11:47:31 +02:00
Bastian Kauschke
39f125918d
cfg bootstrap
2020-09-19 11:33:11 +02:00
Bastian Kauschke
4debbdc6b9
transmute: use diagnostic item
2020-09-19 11:33:11 +02:00
Mara Bos
15eb638dc9
Add tracking issue number for string_drain_as_str.
2020-09-19 08:23:23 +02:00
Mara Bos
1bfe5efe8f
Add tracking issue number for int_bits_const.
2020-09-19 08:14:41 +02:00
Mara Bos
1e2dba1e7c
Use T::BITS
instead of size_of::<T> * 8
.
2020-09-19 06:54:42 +02:00
Mara Bos
5c30a16fa0
Add example/test to <int types>::BITS.
2020-09-19 06:50:45 +02:00
Mara Bos
3f68ae47df
Add BITS
associated constant to all integer types.
2020-09-19 06:50:45 +02:00
bors
c6ab8e5fe0
Auto merge of #76787 - lzutao:slice_iters_new, r=lcnr
...
Using <Iter>::new instead of exposing internal fields
As requested in https://github.com/rust-lang/rust/pull/76311#discussion_r487685126
2020-09-18 23:38:17 +00:00
Guillaume Gomez
28588e5df1
Add missing examples on HashSet iter types
2020-09-18 20:09:31 +02:00
Christiaan Dirkx
e3c6e46168
Make some methods of Pin<&mut T>
unstable const
...
Make the following methods unstable const under the `const_pin` feature:
- `into_ref`
- `get_mut`
- `get_unchecked_mut`
2020-09-18 19:23:50 +02:00
Denis Vasilik
719c40cb5a
Update library/alloc/src/collections/binary_heap.rs
...
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-09-18 16:45:44 +02:00
Denis Vasilik
62e0ee1ba0
Update library/alloc/src/collections/binary_heap.rs
...
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-09-18 16:45:35 +02:00
Denis Vasilik
ec7225feac
Update library/alloc/src/collections/binary_heap.rs
...
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-09-18 16:45:23 +02:00
Denis Vasilik
2230d8d14c
Update library/alloc/src/collections/binary_heap.rs
...
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-09-18 16:45:13 +02:00
Ralf Jung
0810c3ef19
support panic=abort in Miri
2020-09-18 13:15:54 +02:00
Denis Vasilik
49c8fcb47e
Use intra-doc links
2020-09-18 12:38:37 +02:00
Denis Vasilik
4af1b90b41
Move to intra-doc links
2020-09-18 12:38:25 +02:00
Alexis Bourget
b534d9f6e1
Fix broken link
2020-09-18 12:32:23 +02:00
Alexis Bourget
982ec0d0c9
Fix broken link
2020-09-18 11:14:36 +02:00
Alexis Bourget
bffd2111f7
Finish moving to intra doc links for std::sync
2020-09-18 11:09:36 +02:00
Denis Vasilik
bdb039d10b
Use intra-doc links
2020-09-18 10:50:04 +02:00
Lzu Tao
b65937031d
inline inner function of inlining methods
2020-09-18 08:36:21 +00:00
Lzu Tao
53d5261c69
Move unsafe code of slice new
function of their Iterator structs
...
Init false state in Split* constructors
2020-09-18 08:36:21 +00:00
Poliorcetics
4c92b3dc7d
Apply suggestions from code review
...
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-09-18 09:52:35 +02:00
Alexis Bourget
4675a3104b
Use intra-doc links in core/src/iter when possible
2020-09-18 09:51:26 +02:00
est31
baafc71f1f
Remove unused libc feature gate
...
Libc isn't used by alloc.
And std and panic_* use libc from crates.io now,
which isn't feature gated.
2020-09-18 08:59:43 +02:00
bors
a0925fba74
Auto merge of #76790 - ssomers:btree_slice_slasher_returns, r=Mark-Simulacrum
...
BTreeMap: avoid slices even more
Epilogue to #73971 : it seems the compiler is unable to realize that creating a slice and `get_unchecked`-ing one element is a simple fetch. So try to spell it out for the only remaining but often invoked case.
Also, the previous code doesn't seem fair game to me, using `get_unchecked` to reach beyond the end of a slice. Although the local function `slice_insert` also does that.
r? `@Mark-Simulacrum`
2020-09-18 05:47:00 +00:00
Amjad Alsharafi
878dfa6718
Fixed intra-docs links in library/std/src/collections/hash/map.rs
2020-09-18 07:50:22 +08:00
Amjad Alsharafi
3323a26144
Fixed some intra-docs links in library/core
2020-09-18 07:49:29 +08:00