about summary refs log tree commit diff
path: root/src/liballoc
AgeCommit message (Collapse)AuthorLines
2019-12-28Auto merge of #67459 - ssomers:#67438, r=RalfJungbors-25/+152
prune ill-conceived BTreeMap iter_mut assertion and test its mutability Proposal to deal with #67438 (and I'm more sure now that this is the right thing to do). Passes testing with miri.
2019-12-28Rollup merge of #67629 - kraai:remove-redundant-link-texts, r=steveklabnikOliver Scherer-8/+8
Remove redundant link texts Most of these links are followed by a parenthesized expression. I think that the redundant link texts were added to prevent interpretation as an inline link. This is unnecessary since the closing square bracket and opening parenthesis are separated by whitespace.
2019-12-26prune ill-conceived BTreeMap iter_mut assertion and test moreStein Somers-25/+152
2019-12-26Remove redundant link textsMatthew Kraai-8/+8
2019-12-24reuse `capacity` variable in slice::repeatking6cong-4/+4
2019-12-22Format the worldMark Rousskov-2061/+1698
2019-12-22Rollup merge of #67504 - Mark-Simulacrum:note-data-offset, r=CentrilMazdak Farrokhzad-0/+4
Warn against relying on ?Sized being last Fixes #62522
2019-12-21Warn against relying on ?Sized being lastMark Rousskov-0/+4
2019-12-21Require issue = "none" over issue = "0" in unstable attributesRoss MacArthur-16/+16
2019-12-20Rollup merge of #66755 - mark-i-m:const-vec-new, r=ecstatic-morseMazdak Farrokhzad-18/+4
Remove a const-if-hack in RawVec r? @ecstatic-morse cc @Centril
2019-12-19Rollup merge of #67281 - llogiq:nonoverlapping-insert, r=alexcrichtonMark Rousskov-0/+40
add string.insert benchmarks This adds benchmarks for `String::insert` and `String::insert_str`
2019-12-18no need to bootstrapMark Mansi-9/+2
2019-12-18add fixmeMark Mansi-0/+1
2019-12-18fix importMark Mansi-1/+1
2019-12-18use usize::MAX instead of !0Mark Mansi-1/+1
2019-12-18remove a bit more hackeryMark Mansi-41/+9
2019-12-18Remove a const-if-hack in RawVecMark Mansi-8/+32
2019-12-18Propagate cfg bootstrapMark Rousskov-14/+3
2019-12-18Add benchmarks for string::insert(_str)Andre Bogus-0/+40
2019-12-16Rollup merge of #65778 - bdonlan:stable_weak_count, r=dtolnayMazdak Farrokhzad-49/+35
Stabilize `std::{rc,sync}::Weak::{weak_count, strong_count}` * Original PR: #56696 * Tracking issue: #57977 Closes: #57977 Supporting comments: > Although these were added for testing, it is occasionally useful to have a way to probe optimistically for whether a weak pointer has become dangling, without actually taking the overhead of manipulating atomics. Are there any plans to stabilize this? _Originally posted by @bdonlan in https://github.com/rust-lang/rust/issues/57977#issuecomment-516970921_ > Having this stabilized would help. Currently, the only way to check if a weak pointer has become dangling is to call `upgrade`, which is by far expensive. _Originally posted by @glebpom in https://github.com/rust-lang/rust/issues/57977#issuecomment-526934709_ Not sure if stabilizing these warrants a full RFC, so throwing this out here as a start for now. Note: per CONTRIBUTING.md, I ran the tidy checks, but they seem to be failing on unchanged files (primarily in `src/stdsimd`).
2019-12-15Rollup merge of #67300 - aloucks:issue-65970, r=rkruppeMazdak Farrokhzad-1/+16
Restore original implementation of Vec::retain This PR reverts #48065, which aimed to optimize `Vec::retain` by making use of `Vec::drain_filter`. Unfortunately at that time, `drain_filter` was unsound. The soundness hole in `Vec::drain_filter` was fixed in #61224 by guaranteeing that cleanup logic runs via a nested `Drop`, even in the event of a panic. Implementing this nested drop affects codegen (apparently?) and results in slower code. Fixes #65970
2019-12-14Bump Weak::strong_count/weak_count stabilizations from 1.40 to 1.41David Tolnay-4/+4
2019-12-14Restore original implementation of Vec::retainAaron Loucks-1/+16
This PR reverts #48065, which aimed to optimize `Vec::retain` by making use of `Vec::drain_filter`. Unfortunately at that time, `drain_filter` was unsound. The soundness hole in `Vec::drain_filter` was fixed in #61224 by guaranteeing that cleanup logic runs via a nested `Drop`, even in the event of a panic. Implementing this nested drop affects codegen (apparently?) and results in slower code. Fixes #65970
2019-12-14Auto merge of #67136 - oli-obk:const_stability, r=Centrilbors-1/+13
Require stable/unstable annotations for the constness of all stable fns with a const modifier r? @RalfJung @Centril Every `#[stable]` const fn now needs either a `#[rustc_const_unstable]` attribute or a `#[rustc_const_stable]` attribute. You can't silently stabilize the constness of a function anymore.
2019-12-13Rollup merge of #67235 - jonas-schievink:vecdeque-leak, r=KodrAusMazdak Farrokhzad-1/+47
VecDeque: drop remaining items on destructor panic Closes https://github.com/rust-lang/rust/issues/67232
2019-12-13Require stable/unstable annotations for the constness of all stable ↵Oliver Scherer-0/+12
functions with a `const` modifier
2019-12-13Reuse the `staged_api` feature for `rustc_const_unstable`Oliver Scherer-1/+1
2019-12-13Rollup merge of #67243 - jonas-schievink:linkedlist-drop, r=KodrAusMazdak Farrokhzad-1/+122
LinkedList: drop remaining items when drop panics https://github.com/rust-lang/rust/pull/67235, but for `LinkedList`, which has the same issue. I've also copied over the other drop-related tests from `VecDeque` since AFAICT `LinkedList` didn't have any.
2019-12-13Rollup merge of #66341 - crgl:vec-deque-extend, r=AmanieuMazdak Farrokhzad-1/+16
Match `VecDeque::extend` to `Vec::extend_desugared` Currently, `VecDeque::extend` [does not reserve at all](https://github.com/rust-lang/rust/pull/65069#discussion_r333166522). This implementation still runs a check every iteration of the loop, but should reallocate at most once for the common cases where the `size_hint` lower bound is exact. Further optimizations in the future could improve this for some common cases, but given the complexity of the `Vec::extend` implementation it's not immediately clear that this would be worthwhile.
2019-12-12Rollup merge of #67238 - llogiq:moo-and-improved, r=Dylan-DPCYuki Okushi-13/+8
Small std::borrow::Cow improvements This is a small set of improvements (+ one more tested code path) for `Cow`.
2019-12-12Rollup merge of #62514 - stephaneyfx:box-ffi, r=nikomatsakisYuki Okushi-0/+53
Clarify `Box<T>` representation and its use in FFI This officializes what was only shown as a code example in [the unsafe code guidelines](https://rust-lang.github.io/unsafe-code-guidelines/layout/function-pointers.html?highlight=box#use) and follows [the discussion](https://github.com/rust-lang/unsafe-code-guidelines/issues/157) in the corresponding repository. It is also related to [the issue](https://github.com/rust-lang/rust/issues/52976) regarding marking `Box<T>` `#[repr(transparent)]`. If the statement this PR adds is incorrect or a more in-depth discussion is warranted, I apologize. Should it be the case, the example in the unsafe code guidelines should be amended and some document should make it clear that it is not sound/supported.
2019-12-12Add comment to `Dropper`Jonas Schievink-0/+2
2019-12-12LinkedList: drop remaining items when drop panicsJonas Schievink-1/+122
2019-12-11Small Cow improvementsAndre Bogus-13/+8
2019-12-11VecDeque: drop remaining items on destructor panicJonas Schievink-1/+45
2019-12-11clarify that `Box<T>` should only be used when defined *in Rust*Nicholas Matsakis-7/+16
2019-12-10Fix description based on reviewStephane Raux-1/+1
2019-12-11Rollup merge of #67180 - NieDzejkob:vec-doc-copied, r=Dylan-DPCYuki Okushi-1/+1
doc: Use .copied() instead of .cloned() in Vec example None
2019-12-10Remove trailing whitespaceStephane Raux-4/+4
2019-12-09Specify behavior when passed a null pointerStephane Raux-2/+6
2019-12-09Use Niko's wordingStephane Raux-2/+21
2019-12-09doc: Use .copied() instead of .cloned() in Vec exampleJakub Kądziołka-1/+1
2019-12-07liballoc: ignore tests in Miri instead of removing them entirelyRalf Jung-24/+23
2019-12-05Rollup merge of #66710 - vorner:weak-into-raw-null-docs, r=dtolnayMazdak Farrokhzad-20/+28
weak-into-raw: Clarify some details in Safety Clarify it is OK to pass a pointer that never owned a weak count (one from Weak::new) back into it as it was created from it. Relates to discussion in #60728. @CAD97 Do you want to have a look at the new docs?
2019-12-05weak-into-raw: Clarify some details in SafetyMichal 'vorner' Vaner-20/+28
Clarify it is OK to pass a pointer that never owned a weak count (one from Weak::new) back into it as it was created from it. Relates to discussion in #60728.
2019-12-03Auto merge of #66256 - CAD97:patch-2, r=RalfJungbors-2/+2
Layout::pad_to_align is infallible As per [this comment](https://github.com/rust-lang/rust/issues/55724#issuecomment-441421651) (cc @glandium). > Per https://github.com/rust-lang/rust/blob/eb981a1/src/libcore/alloc.rs#L63-L65, `layout.size()` is always <= `usize::MAX - (layout.align() - 1)`. > > Which means: > > * The maximum value `layout.size()` can have is already aligned for `layout.align()` (`layout.align()` being a power of two, `usize::MAX - (layout.align() - 1)` is a multiple of `layout.align()`) > * Incidentally, any value smaller than that maximum value will align at most to that maximum value. > > IOW, `pad_to_align` can not return `Err(LayoutErr)`, except for the layout not respecting its invariants, but we shouldn't care about that. This PR makes `pad_to_align` return `Layout` directly, representing the fact that it cannot fail.
2019-12-01Rollup merge of #66890 - dtolnay:fmt4, r=Dylan-DPCMazdak Farrokhzad-401/+373
Format liballoc with rustfmt Same strategy as #66691 -- as with my previous formatting PRs, I am avoiding causing merge conflicts in other PRs by only touches those files that are not involved in any currently open PR. Files that appear in new PRs between when this PR is opened and when it makes it to the top of the bors queue will be reverted from this PR. The list of files involved in open PRs is determined by querying GitHub's GraphQL API [with this script](https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8). With the list of files from the script in outstanding_files, the relevant commands were: ``` $ find src/liballoc -name '*.rs' \ | xargs rustfmt --edition=2018 --unstable-features --skip-children $ rg liballoc outstanding_files | xargs git checkout -- ``` To confirm no funny business: ``` $ git checkout $THIS_COMMIT^ $ git show --pretty= --name-only $THIS_COMMIT \ | xargs rustfmt --edition=2018 --unstable-features --skip-children $ git diff $THIS_COMMIT # there should be no difference ``` r? @Dylan-DPC
2019-12-01Rollup merge of #66662 - RalfJung:miri-test-liballoc, r=dtolnayMazdak Farrokhzad-14/+24
Miri: run panic-catching tests in liballoc I also converted two tests from using `thread::spawn(...).join()` just for catching panics, to `catch_panic`, so that Miri can run them.
2019-11-30Rollup merge of #66759 - CAD97:patch-3, r=KodrAusMazdak Farrokhzad-0/+3
impl TrustedLen for vec::Drain The iterator methods just forward to `slice::Iter`, which is `TrustedLen`. This can probably be applied to other `Drain` structs as well.
2019-11-29Format liballoc with rustfmtDavid Tolnay-401/+373