Commit graph

636 commits

Author SHA1 Message Date
C
f7a6f0cae3 docs: fixing references 2020-12-29 14:03:30 +00:00
C
80f10d7aa7 fix: moved import into #[cfg(test)] 2020-12-29 14:03:30 +00:00
C
2de8356f60 style: applying Rust style 2020-12-29 14:03:30 +00:00
C
6002b280f1 refactor: removing // ignore-tidy-filelength 2020-12-29 14:03:30 +00:00
C
bd49a60f29 refactor: moved SpecExtend into spec_extend.rs 2020-12-29 14:03:30 +00:00
C
d24a27797d refactor: moving SpecFromIter into spec_from_iter.rs 2020-12-29 14:03:30 +00:00
C
56d82b3dcc refactor: moved SpecFromIterNested to spec_from_iter_nested.rs 2020-12-29 14:03:30 +00:00
C
9e08ce7190 refactor: moved InPlaceDrop into in_place_drop.rs 2020-12-29 14:03:30 +00:00
C
a3f3fc5aed refactor: moved SetLenOnDrop to set_len_on_drop 2020-12-29 14:03:30 +00:00
C
a2f4bc0d18 refactor: moved SpecFromElem to spec_from_elem.rs 2020-12-29 14:03:30 +00:00
C
dc46013248 refactor: moved PartialEq into partial_eq 2020-12-29 14:03:30 +00:00
C
5ac6709b95 refactor: moving SourceIterMarker into source_iter_marker.rs 2020-12-29 14:03:30 +00:00
C
840c4e2873 refactor: moved IsZero into is_zero.rs 2020-12-29 14:03:30 +00:00
C
2a1248976a refactor: moving AsIntoIter into into_iter.rs 2020-12-29 14:03:29 +00:00
C
93613901d0 refactor: moved IntoIter into into_iter.rs 2020-12-29 14:03:29 +00:00
C
2580822b91 refactor: moved Vec impl Cow into cow.rs 2020-12-29 14:03:29 +00:00
C
6bf9608f9f refactor: moving Drain into drain.rs 2020-12-29 14:03:29 +00:00
C
17593f258b refactor: moving Splice into splice.rs 2020-12-29 14:03:29 +00:00
C
434e5d1422 refactor: moving DrainFilter into drain_filter.rs 2020-12-29 14:03:29 +00:00
C
5182776c6c refactor: moving vec.rs to vec/mod.rs 2020-12-29 14:03:29 +00:00
Mara Bos
e3d26e007c
Rollup merge of #80448 - m-ou-se:deque-range-version, r=m-ou-se
Fix stabilization version of deque_range feature.

See https://github.com/rust-lang/rust/pull/79022#issuecomment-751315315
2020-12-28 19:09:35 +00:00
Mara Bos
e351a3b2ec
Rollup merge of #80430 - xfix:add-length-as-doc-alias, r=steveklabnik
Add "length" as doc alias to len methods

Currently when searching for `length` there are no results: https://doc.rust-lang.org/std/?search=length. This makes `len` methods appear when searching for `length`.
2020-12-28 19:09:32 +00:00
Mara Bos
7003537df6
Rollup merge of #80398 - CAD97:fix-80365, r=dtolnay
Use raw version of align_of in rc data_offset

This was missed in #73845 when switching to use the raw operators.
Fixes #80365
2020-12-28 19:09:24 +00:00
Mara Bos
255fde3f46
Rollup merge of #80390 - ssomers:btree_cleanup_slices_2, r=Mark-Simulacrum
BTreeMap: rename the area access methods

r? `@Mark-Simulacrum`
2020-12-28 19:09:20 +00:00
Mara Bos
10d6ff71e8 Fix stabilization version of deque_range feature. 2020-12-28 20:04:27 +01:00
Dylan DPC
cefe40bb0c
Rollup merge of #80353 - ssomers:btree_test_split_off, r=Mark-Simulacrum
BTreeMap: test split_off (and append) more thoroughly

Using DeterministicRng as a poor man's property based testing rig.
r? ``@Mark-Simulacrum``
2020-12-28 14:13:14 +01:00
Konrad Borowski
9e779986aa Add "length" as doc alias to len methods 2020-12-28 09:13:46 +01:00
Ralf Jung
8e0b7f988e de-stabilize unsized raw ptr methods for Weak 2020-12-28 00:39:09 +01:00
CAD97
eeed3118d0 Use raw version of align_of in rc data_offset
This was missed in #73845 when switching to use the raw operators.
Fixes #80365
2020-12-26 18:37:07 -05:00
Stein Somers
be3a5a1bec BTreeMap: rename the area access methods 2020-12-26 21:43:04 +01:00
bors
89524d0f8e Auto merge of #79520 - ssomers:btree_cleanup_1, r=Mark-Simulacrum
BTreeMap: clean up access to MaybeUninit arrays

Stop exposing and using immutable access to `MaybeUninit` slices when we need and have exclusive access to the tree.

r? `@Mark-Simulacrum`
2020-12-26 16:47:33 +00:00
bors
30a42735a0 Auto merge of #80354 - ssomers:btree_test_compact, r=Mark-Simulacrum
BTreeMap: test full nodes a little more

r? `@Mark-Simulacrum`
2020-12-26 13:46:16 +00:00
bors
d30dac2d83 Auto merge of #79022 - SpyrosRoum:stabilize-deque_range, r=m-ou-se
stabilize deque_range

Make #74217 stable, stabilizing `VecDeque::range` and `VecDeque::range_mut`.
Pr: #74099

r? `@m-ou-se`
2020-12-26 03:50:16 +00:00
Stein Somers
0d2548a173 BTreeMap: declare exclusive access to arrays when copying from them 2020-12-25 09:33:58 +01:00
Dylan DPC
7c7812dfd3
Rollup merge of #80352 - ssomers:btree_test_diagnostics, r=Mark-Simulacrum
BTreeMap: make test cases more explicit on failure

r? `@Mark-Simulacrum`
2020-12-25 03:39:51 +01:00
Stein Somers
f327a352b8 BTreeMap: test full nodes a little more 2020-12-24 16:48:27 +01:00
Stein Somers
d473cbe75b BTreeMap: test split_off (and append) more thoroughly 2020-12-24 16:44:46 +01:00
Stein Somers
9e618bacf2 BTreeMap: make test cases more explicit on failure 2020-12-24 15:58:57 +01:00
Stein Somers
8824efd61c BTreeMap: avoid implicit use of node length in flight 2020-12-24 11:41:40 +01:00
bors
3d10d3e49d Auto merge of #79521 - ssomers:btree_cleanup_2, r=Mark-Simulacrum
BTreeMap: relax the explicit borrow rule to make code shorter and safer

Expressions like `.reborrow_mut().into_len_mut()` are annoyingly long, and kind of dangerous for the reason `reborrow_mut()` is unsafe. By relaxing the single rule, we no longer have to make an exception for functions with a `borrow` name and functions like `as_leaf_mut`. This is largely restoring the declaration style of the btree::node API about a year ago, but with more explanation and consistency.

r? `@Mark-Simulacrum`
2020-12-23 21:43:28 +00:00
Yuki Okushi
0765536c0b
Rollup merge of #78083 - ChaiTRex:master, r=m-ou-se
Stabilize or_insert_with_key

Stabilizes the `or_insert_with_key` feature from https://github.com/rust-lang/rust/issues/71024. This allows inserting key-derived values when a `HashMap`/`BTreeMap` entry is vacant.

The difference between this and  `.or_insert_with(|| ... )` is that this provides a reference to the key to the closure after it is moved with `.entry(key_being_moved)`, avoiding the need to copy or clone the key.
2020-12-19 15:15:57 +09:00
Dylan DPC
2e9ed6fb93
Rollup merge of #80003 - Stupremee:fix-zst-vecdeque-conversion-panic, r=dtolnay
Fix overflow when converting ZST Vec to VecDeque

```rust
let v = vec![(); 100];
let queue = VecDeque::from(v);
println!("{:?}", queue);
```
This code will currently panic with a capacity overflow.
This PR resolves this issue and makes the code run fine.

Resolves #78532
2020-12-18 00:30:11 +01:00
Stein Somers
29114ff0fb BTreeMap: relax the explicit borrow rule to make code shorter and safer 2020-12-17 19:07:15 +01:00
Guillaume Gomez
53af11651b
Rollup merge of #80022 - ssomers:btree_cleanup_8, r=Mark-Simulacrum
BTreeSet: simplify implementation of pop_first/pop_last

…and stop it interfering in #79245.
r? ```````@Mark-Simulacrum```````
2020-12-17 11:36:49 +01:00
Guillaume Gomez
6b83013d1f
Rollup merge of #80006 - ssomers:btree_cleanup_6, r=Mark-Simulacrum
BTreeMap: more expressive local variables in merge

r? ```````@Mark-Simulacrum```````
2020-12-17 11:36:47 +01:00
bors
e261649593 Auto merge of #78682 - glandium:issue78471, r=lcnr
Do not inline finish_grow

Fixes #78471.

Looking at libgkrust.a in Firefox, the sizes for the `gkrust.*.o` file is:
- 18584816 (text) 582418 (data) with unmodified master
- 17937659 (text) 582554 (data) with #72227 reverted
- 17968228 (text) 582858 (data) with `#[inline(never)]` on `grow_amortized` and `grow_exact`, but that has some performance consequences
- 17927760 (text) 582322 (data) with this change

So in terms of size, at least in the case of Firefox, this patch more than undoes the regression. I don't think it should affect performance, but we'll see.
2020-12-15 06:32:10 +00:00
Guillaume Gomez
5d8b2a5bf1
Rollup merge of #79918 - woodruffw-forks:ww/doc-initializer-side-effects, r=dtolnay
doc(array,vec): add notes about side effects when empty-initializing

Copying some context from a conversation in the Rust discord:

* Both `vec![T; 0]` and `[T; 0]` are syntactically valid, and produce empty containers of their respective types

* Both *also* have side effects:

```rust
fn side_effect() -> String {
    println!("side effect!");

    "foo".into()
}

fn main() {
    println!("before!");

    let x = vec![side_effect(); 0];

    let y = [side_effect(); 0];

    println!("{:?}, {:?}", x, y);
}
```

produces:

```
before!
side effect!
side effect!
[], []
```

This PR just adds two small notes to each's documentation, warning users that side effects can occur.

I've also submitted a clippy proposal: https://github.com/rust-lang/rust-clippy/issues/6439
2020-12-14 14:43:44 +01:00
Stein Somers
6c7835e441 BTreeSet: simplify implementation of pop_first/pop_last 2020-12-14 11:25:34 +01:00
bors
7feab000b2 Auto merge of #80005 - ssomers:btree_cleanup_3, r=Mark-Simulacrum
BTreeMap: declare clear_parent_link directly on the root it needs

r? `@Mark-Simulacrum`
2020-12-13 22:13:02 +00:00
bors
69ff39ee32 Auto merge of #79987 - ssomers:btree_cleanup_4, r=Mark-Simulacrum
BTreeMap: detect bulk_steal's count-1 underflow in release builds too

r? `@Mark-Simulacrum`
2020-12-13 17:09:41 +00:00