about summary refs log tree commit diff
path: root/library/alloc/src
AgeCommit message (Collapse)AuthorLines
2020-11-01Rollup merge of #78602 - RalfJung:raw-ptr-aliasing-issues, r=m-ou-seMara Bos-2/+3
fix various aliasing issues in the standard library This fixes various cases where the standard library either used raw pointers after they were already invalidated by using the original reference again, or created raw pointers for one element of a slice and used it to access neighboring elements.
2020-11-01Rollup merge of #78596 - pavlukivan:master, r=m-ou-seMara Bos-2/+2
Fix doc links to std::fmt `std::format` and `core::write` macros' docs linked to `core::fmt` for format string reference, even though only `std::fmt` has format string documentation (and the link titles were `std::fmt`)
2020-10-31fix aliasing issue in binary_heapRalf Jung-2/+3
2020-10-31Fix doc links to std::fmtIvan Pavluk-2/+2
std::format and core::write macros' docs linked to core::fmt for format string reference, even though only std::fmt has format string documentation and the link titles were std::fmt.
2020-10-30Constantify more BTreeMap and BTreeSet functionsBenoît du Garreau-4/+22
- BTreeMap::len - BTreeMap::is_empty - BTreeSet::len - BTreeSet::is_empty
2020-10-29Rollup merge of #78499 - SkiFire13:fix-string-retain, r=m-ou-seJonas Schievink-4/+6
Prevent String::retain from creating non-utf8 strings when abusing panic Fixes #78498 The idea is the same as `Vec::drain`, set the len to 0 so that nobody can observe the broken invariant if it escapes the function (in this case if `f` panics)
2020-10-29Rollup merge of #76138 - camelid:rc-fully-qualified-syntax, r=steveklabnikJonas Schievink-9/+38
Explain fully qualified syntax for `Rc` and `Arc` Also cleaned up some other small things. @rustbot modify labels: T-doc
2020-10-29Auto merge of #78446 - RalfJung:box, r=Amanieubors-7/+2
fix Box::into_unique https://github.com/rust-lang/rust/pull/77187/ broke Stacked Borrows pointer tagging around `Box::into_unique` (this is caused by `Box` being a special case in the type system, which box-internal code needs to account for). This PR fixes that. r? `@Amanieu` Cc `@TimDiekmann` Fixes https://github.com/rust-lang/rust/issues/78419.
2020-10-29Prevent String::retain from creating non-utf8 strings when abusing panicGiacomo Stevanato-4/+6
2020-10-28Don't say you "should" use fully qualified syntaxCamelid-10/+16
That recommendation was removed last year; there isn't a particular style that is officially recommended anymore.
2020-10-28Fix broken intra-doc linkCamelid-1/+1
2020-10-28Explain fully qualified syntax for `Rc` and `Arc`Camelid-9/+32
2020-10-27Add unsized_fn_params featureSantiago Pastorino-1/+2
2020-10-27fix Box::into_uniqueRalf Jung-7/+2
2020-10-27Auto merge of #78359 - ssomers:btree_cleanup_mem, r=Mark-Simulacrumbors-40/+42
BTreeMap: move generic support functions out of navigate.rs A preparatory step chipped off #78104, useful in general (if at all). r? `@Mark-Simulacrum`
2020-10-27Rollup merge of #78347 - Rustin-Liu:rustin-patch-doc, r=kennytmYuki Okushi-2/+2
Add lexicographical comparison doc close https://github.com/rust-lang/rust/issues/72255
2020-10-26Auto merge of #77187 - TimDiekmann:box-alloc, r=Amanieubors-150/+431
Support custom allocators in `Box` r? `@Amanieu` This pull request requires a crater run. ### Prior work: - #71873 - #58457 - [`alloc-wg`](https://github.com/TimDiekmann/alloc-wg)-crate Currently blocked on: - ~#77118~ - ~https://github.com/rust-lang/chalk/issues/615 (#77515)~
2020-10-26Add lexicographical comparison docRustin-Liu-2/+2
Add links Fix typo Use `sequence` Fix typo Fix broken link Fix broken link Fix broken link Fix broken links Fix broken links
2020-10-26BTreeMap: move generic functions out of navigate.rsStein Somers-40/+42
2020-10-25Auto merge of #78015 - ssomers:btree_merge_mergers, r=Mark-Simulacrumbors-97/+111
btree: merge the implementations of MergeIter Also remove the gratuitous Copy bounds. Same benchmark performance. r? `@Mark-Simulacrum`
2020-10-25Merge remote-tracking branch 'upstream/master' into box-allocTim Diekmann-896/+1042
2020-10-25Rollup merge of #78322 - ssomers:btree_no_min_len_at_node_level, ↵Yuki Okushi-55/+55
r=Mark-Simulacrum BTreeMap: stop mistaking node::MIN_LEN for a node level constraint Correcting #77612 that fell into the trap of assuming that node::MIN_LEN is an imposed minimum everywhere, and trying to make it much more clear it is an offered minimum at the node level. r? @Mark-Simulacrum
2020-10-25Rollup merge of #78208 - liketechnik:issue-69399, r=oli-obkYuki Okushi-1/+3
replace `#[allow_internal_unstable]` with `#[rustc_allow_const_fn_unstable]` for `const fn`s `#[allow_internal_unstable]` is currently used to side-step feature gate and stability checks. While it was originally only meant to be used only on macros, its use was expanded to `const fn`s. This pr adds stricter checks for the usage of `#[allow_internal_unstable]` (only on macros) and introduces the `#[rustc_allow_const_fn_unstable]` attribute for usage on `const fn`s. This pr does not change any of the functionality associated with the use of `#[allow_internal_unstable]` on macros or the usage of `#[rustc_allow_const_fn_unstable]` (instead of `#[allow_internal_unstable]`) on `const fn`s (see https://github.com/rust-lang/rust/issues/69399#issuecomment-712911540). Note: The check for `#[rustc_allow_const_fn_unstable]` currently only validates that the attribute is used on a function, because I don't know how I would check if the function is a `const fn` at the place of the check. I therefore openend this as a 'draft pull request'. Closes rust-lang/rust#69399 r? @oli-obk
2020-10-24Rollup merge of #77610 - hermitcore:dtors, r=m-ou-seJonas Schievink-1/+1
revise Hermit's mutex interface to support the behaviour of StaticMutex rust-lang/rust#77147 simplifies things by splitting this Mutex type into two types matching the two use cases: StaticMutex and MovableMutex. To support the new behavior of StaticMutex, we move part of the mutex implementation into libstd. The interface to the OS changed. Consequently, I removed a few functions, which aren't longer needed.
2020-10-24BTreeMap: stop mistaking node::MIN_LEN as a node level constraintStein Somers-55/+55
2020-10-23Rename `Box::alloc` to `Box::alloc_ref`Tim Diekmann-2/+2
2020-10-23Add a spin loop hint for Arc::downgradeNicolas Nattis-0/+3
2020-10-23Rollup merge of #78163 - camelid:fixup-lib-docs, r=m-ou-seYuki Okushi-9/+10
Clean up lib docs Cherry-picked out of #78094.
2020-10-23Rollup merge of #77969 - ryan-scott-dev:bigo-notation-consistency, r=m-ou-seYuki Okushi-9/+9
Doc formating consistency between slice sort and sort_unstable, and big O notation consistency Updated documentation for slice sorting methods to be consistent between stable and unstable versions, which just ended up being minor formatting differences. I also went through and updated any doc comments with big O notation to be consistent with #74010 by italicizing them rather than having them in a code block.
2020-10-22Clean up lib docsCamelid-9/+10
2020-10-22BTreeMap/Set: merge the implementations of MergeIterStein Somers-97/+111
2020-10-21switch allow_internal_unstable const fns to rustc_allow_const_fn_unstableFlorian Warzecha-1/+3
2020-10-21Rollup merge of #78056 - ssomers:btree_chop_up_1, r=dtolnayYuki Okushi-222/+239
BTreeMap: split off most code of remove and split_off Putting map.rs on a diet, in addition to #77851. r? @dtolnay
2020-10-20BTreeMap: less sharing, more similarity between leaf and internal nodesStein Somers-45/+36
2020-10-20BTreeMap: reuse BoxedNode instances directly instead of their contentsStein Somers-7/+3
2020-10-20Rollup merge of #77612 - ssomers:btree_cleanup_2, r=Mark-SimulacrumYuki Okushi-79/+115
BTreeMap: test invariants more thoroughly and more readably r? @Mark-Simulacrum
2020-10-19BTreeMap: test invariants more thoroughly and more readablyStein Somers-79/+115
2020-10-18Auto merge of #76885 - dylni:move-slice-check-range-to-range-bounds, r=KodrAusbors-8/+5
Move `slice::check_range` to `RangeBounds` Since this method doesn't take a slice anymore (#76662), it makes more sense to define it on `RangeBounds`. Questions: - Should the new method be `assert_len` or `assert_length`?
2020-10-18BTreeMap: split off most code of remove and split_offStein Somers-222/+239
2020-10-18Rollup merge of #77851 - exrook:split-btreemap, r=dtolnayYuki Okushi-468/+480
BTreeMap: refactor Entry out of map.rs into its own file btree/map.rs is approaching the 3000 line mark, splitting out the entry code buys about 500 lines of headroom. I've created this PR because the changes I've made in #77438 will push `map.rs` over the 3000 line limit and cause tidy to complain. I picked `Entry` to factor out because it feels less tightly coupled to the rest of `BTreeMap` than the various iterator implementations. Related: #60302
2020-10-17Rollup merge of #77932 - ssomers:btree_cleanup_gdb, r=Mark-SimulacrumDylan DPC-1/+0
BTreeMap: improve gdb introspection of BTreeMap with ZST keys or values I accidentally pushed an earlier revision in #77788: it changes the index of tuples for BTreeSet from ""[{}]".format(i) to "key{}".format(i). Which doesn't seem to make the slightest difference on my linux box nor on CI. In fact, gdb doesn't make any distinction between "key{}" and "val{}" for a BTreeMap either, leading to confusing output if you test more. But easy to improve. r? @Mark-Simulacrum
2020-10-17Rollup merge of #77751 - vojtechkral:vecdeque-binary-search, r=scottmcm,dtolnayDylan DPC-1/+138
liballoc: VecDeque: Add binary search functions I am submitting rust-lang/rfcs#2997 as a PR as suggested by @scottmcm I haven't yet created a tracking issue - if there's a favorable feedback I'll create one and update the issue links in the unstable attribs.
2020-10-16Auto merge of #77997 - fusion-engineering-forks:to-string-no-shrink, ↵bors-1/+0
r=joshtriplett Remove shrink_to_fit from default ToString::to_string implementation. As suggested by `@scottmcm` on Zulip. shrink_to_fit() seems like the wrong thing to do here in most use cases of to_string(). Would be intereseting to see if it makes any difference in a timer run. r? `@joshtriplett`
2020-10-16liballoc: VecDeque: Simplify binary_search_by()Vojtech Kral-15/+4
2020-10-16liballoc: VecDeque: Add tracking issue for binary search fnsVojtech Kral-3/+3
2020-10-16Auto merge of #77850 - kornelski:resizedefault, r=dtolnaybors-44/+0
Remove deprecated unstable Vec::resize_default It's [been deprecated](https://github.com/rust-lang/rust/pull/57656) for 15 releases.
2020-10-16Remove shrink_to_fit from default ToString::to_string implementation.Mara Bos-1/+0
Co-authored-by: scottmcm <scottmcm@users.noreply.github.com>
2020-10-16Merge branch 'master' into box-allocTim Diekmann-39/+114
2020-10-16Rollup merge of #77935 - ssomers:btree_cleanup_1, r=Mark-SimulacrumDylan DPC-7/+62
BTreeMap: make PartialCmp/PartialEq explicit and tested Follow-up on a topic raised in #77612 r? @Mark-Simulacrum
2020-10-15Fix typo in documentationstrct-1/+1