about summary refs log tree commit diff
path: root/src/liballoc
AgeCommit message (Collapse)AuthorLines
2020-06-25Rollup merge of #73616 - pickfire:liballoc-hash, r=joshtriplettDylan DPC-2/+2
Liballoc minor hash import tweak
2020-06-25Rollup merge of #72700 - davidtwco:issue-66220-improper-ctypes-declarations, ↵Dylan DPC-0/+2
r=lcnr,varkor `improper_ctypes_definitions` lint Addresses #19834, #66220, and #66373. This PR takes another attempt at #65134 (reverted in #66378). Instead of modifying the existing `improper_ctypes` lint to consider `extern "C" fn` definitions in addition to `extern "C" {}` declarations, this PR adds a new lint - `improper_ctypes_definitions` - which only applies to `extern "C" fn` definitions. In addition, the `improper_ctype_definitions` lint differs from `improper_ctypes` by considering `*T` and `&T` (where `T: Sized`) FFI-safe (addressing #66220). There wasn't a clear consensus in #66220 (where the issues with #65134 were primarily discussed) on the approach to take, but there has [been some discussion in Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/.2366220.20improper_ctypes.20definitions.20vs.20declarations/near/198903086). I fully expect that we'll want to iterate on this before landing. cc @varkor + @shepmaster (from #19834) @hanna-kruppe (active in discussing #66220), @SimonSapin (#65134 caused problems for Servo, want to make sure that this PR doesn't)
2020-06-24Rollup merge of #73667 - nrabulinski:master, r=Dylan-DPCDylan DPC-1/+1
Update BTreeMap::new() doc Updates the documentation according to [this comment](https://github.com/rust-lang/rust/pull/72876/files/0c5c644c91edf6ed949cfa5ffc524f43369df604#r433232581) on #72876
2020-06-24Rollup merge of #73638 - yuqio:remove-unused-crate-imports, r=nikomatsakisDylan DPC-2/+0
Remove unused crate imports in 2018 edition crates Closes #73570
2020-06-24lints: add `improper_ctypes_definitions`David Wood-0/+2
This commit adds a new lint - `improper_ctypes_definitions` - which functions identically to `improper_ctypes`, but on `extern "C" fn` definitions (as opposed to `improper_ctypes`'s `extern "C" {}` declarations). Signed-off-by: David Wood <david@davidtw.co>
2020-06-23Rollup merge of #72876 - TrolledWoods:patch-2, r=Dylan-DPCManish Goregaokar-0/+2
Mention that BTreeMap::new() doesn't allocate I think it would be nice to mention this, so you don't have to dig through the src to look at the definition of new().
2020-06-23Update map.rsNikodem Rabuliński-1/+1
2020-06-23Rollup merge of #73398 - oli-obk:const_raw_ptr_cmp, r=varkor,RalfJung,nagisaManish Goregaokar-1/+1
A way forward for pointer equality in const eval r? @varkor on the first commit and @RalfJung on the second commit cc #53020
2020-06-23Remove unused crate imports in 2018 edition cratesyuqio-2/+0
2020-06-22Rollup merge of #71660 - sollyucko:master, r=dtolnayDylan DPC-11/+70
impl PartialEq<Vec<B>> for &[A], &mut [A] https://github.com/rust-lang/rfcs/issues/2917
2020-06-22Liballoc minor hash import tweakIvan Tham-2/+2
2020-06-20Update stability attribute of new Vec PartialEq implsDavid Tolnay-13/+13
2020-06-20impl PartialEq<Vec<B>> for &[A], &mut [A]Solomon Ucko-0/+59
2020-06-20Satisfy tidyOliver Scherer-1/+1
2020-06-20Remove uses of `Vec::remove_item`Lukas Kalbertodt-16/+0
2020-06-20Deprecate `Vec::remove_item`Lukas Kalbertodt-10/+8
2020-06-19Rollup merge of #73465 - lzutao:spec-char-tostring, r=sfacklerManish Goregaokar-0/+8
Add specialization of `ToString for char` Closes #73462
2020-06-19Rollup merge of #72709 - LeSeulArtichaut:unsafe-liballoc, r=nikomatsakisManish Goregaokar-257/+387
`#[deny(unsafe_op_in_unsafe_fn)]` in liballoc This PR proposes to make use of the new `unsafe_op_in_unsafe_fn` lint, i.e. no longer consider the body of an unsafe function as an unsafe block and require explicit unsafe block to perform unsafe operations. This has been first (partly) suggested by @Mark-Simulacrum in https://github.com/rust-lang/rust/pull/69245#issuecomment-587817065 Tracking issue for the feature: #71668. ~~Blocked on #71862.~~ r? @Mark-Simulacrum cc @nikomatsakis can you confirm that those changes are desirable? Should I restrict it to only BTree for the moment?
2020-06-19Apply suggestions from code reviewLeSeulArtichaut-9/+11
Co-authored-by: nikomatsakis <niko@alum.mit.edu>
2020-06-19`#[deny(unsafe_op_in_unsafe_fn)]` in liballocLeSeulArtichaut-261/+389
2020-06-19Rollup merge of #73479 - pickfire:liballoc-spell, r=dtolnayRalf Jung-3/+3
Minor tweaks to liballoc
2020-06-19Rollup merge of #73459 - cuviper:into_boxed_slice-unicast, r=dtolnayRalf Jung-1/+1
Reduce pointer casts in Box::into_boxed_slice We only need to cast the pointer once to change `Box<T>` to an array `Box<[T; 1]>`, then we can let unsized coercion return `Box<[T]>`.
2020-06-19Rearrange liballoc __impl_slice_eq1Ivan Tham-1/+1
2020-06-19Liballoc clean up macro_rules styleIvan Tham-1/+1
2020-06-19Fix liballoc doc spellingIvan Tham-1/+1
2020-06-18Ensure std benchmarks get tested.Eric Huss-0/+1
2020-06-18Add specialization of `ToString for char`Lzu Tao-0/+8
2020-06-17Reduce pointer casts in Box::into_boxed_sliceJosh Stone-1/+1
We only need to cast the pointer once to change `Box<T>` to an array `Box<[T; 1]>`, then we can let unsized coercion return `Box<[T]>`.
2020-06-15Rollup merge of #72584 - CAD97:stabilize-58957, r=dtolnayRalf Jung-2/+8
Stabilize vec::Drain::as_slice and add `AsRef<[T]> for Drain<'_, T>`. Tracking issue: #58957. Does not stabilize `slice::IterMut::as_slice` yet. cc @cuviper This PR proposes stabilizing just the `vec::Drain::as_slice` part of that tracking issue. My ultimate goal here: being able to use `for<T, I: Iterator<Item=T> + AsRef<[T]>> I` to refer to `vec::IntoIter`, `vec::Drain`, and eventually `array::IntoIter`, as an approximation of the set of by-value iterators that can be "previewed" as by-ref iterators. (Actually expressing that as a trait requires GAT.)
2020-06-12Rollup merge of #72906 - lzutao:migrate-numeric-assoc-consts, r=dtolnayDylan DPC-17/+17
Migrate to numeric associated consts The deprecation PR is #72885 cc #68490 cc rust-lang/rfcs#2700
2020-06-10Migrate to numeric associated constsLzu Tao-17/+17
2020-06-09Rename some identifiers in `RawVec` and `libarena`.Nicholas Nethercote-53/+36
- Use `len` more consistently for the number of elements in a vector, because that's the usual name. - Use `additional` more consistently for the number of elements we want to add, because that's what `Vec::reserve()` uses. - Use `cap` consistently rather than `capacity`. - Plus a few other tweaks. This increases consistency and conciseness.
2020-06-09Remove `RawVec::reserve_in_place`.Nicholas Nethercote-39/+6
Also remove a now-unnecessary `placement` argument.
2020-06-08Rollup merge of #72811 - pickfire:liballoc-impl, r=AmanieuRalf Jung-42/+40
Liballoc impl Mainly code rearrangements
2020-06-08Rollup merge of #72583 - CAD97:vec-iter-asref-slice, r=dtolnayRalf Jung-0/+7
impl AsRef<[T]> for vec::IntoIter<T> Adds `impl<T> AsRef<[T]> for vec::IntoIter<T>`. This mirrors the same trait impl for [`slice::Iter`](https://doc.rust-lang.org/nightly/std/slice/struct.Iter.html). Both types already offer `fn as_slice(&self) -> &[T]`, this just adds the trait impl for `vec::IntoIter`. If/when `fn as_slice(&self) -> &[T]` stabilizes for `vec::Drain` and `slice::IterMut`, they should get `AsRef<[T]>` impls as well. As thus, tangentially related to #58957. My ultimate goal here: being able to use `for<T, I: Iterator<Item=T> + AsRef<[T]>> I` to refer to `vec::IntoIter`, `vec::Drain`, and eventually `array::IntoIter`, as an approximation of the set of by-value iterators that can be "previewed" as by-ref iterators. (Actually expressing that as a trait requires GAT.)
2020-06-06Elide type on liballoc vecIvan Tham-1/+1
2020-06-05Auto merge of #73025 - Dylan-DPC:rollup-a1uzj5u, r=Dylan-DPCbors-1/+1
Rollup of 5 pull requests Successful merges: - #72260 (Spell out `Self` in async function return) - #72996 (Remove unsused `NodeId` related APIs in hir map) - #73010 (Update RELEASES.md) - #73017 (Use assert_eq for liballoc test) - #73019 (add test for #72960) Failed merges: r? @ghost
2020-06-05Auto merge of #72957 - Mark-Simulacrum:bootstrap-bump, r=sfacklerbors-24/+5
Bump bootstrap compiler to 1.45 Pretty standard update.
2020-06-05Use assert_eq for liballoc testIvan Tham-1/+1
2020-06-05Add more assert to Vec with_capacity docsIvan Tham-0/+3
Show assertion on len too to show them how adding new items will affect both the length and capacity, before and after.
2020-06-03Bump to 1.46Mark Rousskov-24/+5
2020-06-03Add assert to Vec with_capacity docsIvan Tham-0/+2
2020-06-01Mention that BTreeMap::new() doesn't allocateTrolledWoods-0/+2
I think it would be nice to mention this, so you don't have to dig through the src to look at the definition of new().
2020-05-31Merge raw_vec into_box with previous impl<T, Global>Ivan Tham-26/+24
There are two separate `impl<T, Global>` which no special reason, it would be better to merge both of them.
2020-05-31Rearrange impl blocks with Deref as firstIvan Tham-16/+16
The other blocks depends on Deref to make it easier for readers when reimplementing or reading the implementations.
2020-05-30Rollup merge of #72499 - mendess:master, r=dtolnayRalf Jung-0/+41
Override Box::<[T]>::clone_from Avoid dropping and reallocating when cloning to an existing box if the lengths are the same. It would be nice if this could also be specialized for `Copy` but I don't know how that works since it's not on stable. Will gladly look into it if it's deemed as a good idea. This is my first PR with code, hope I did everything right :smile:
2020-05-30Rollup merge of #72162 - cuviper:extend_one, r=Mark-SimulacrumYuki Okushi-0/+126
Add Extend::{extend_one,extend_reserve} This adds new optional methods on `Extend`: `extend_one` add a single element to the collection, and `extend_reserve` pre-allocates space for the predicted number of incoming elements. These are used in `Iterator` for `partition` and `unzip` as they shuffle elements one-at-a-time into their respective collections.
2020-05-29Add Extend::{extend_one,extend_reserve}Josh Stone-0/+126
This adds new optional methods on `Extend`: `extend_one` add a single element to the collection, and `extend_reserve` pre-allocates space for the predicted number of incoming elements. These are used in `Iterator` for `partition` and `unzip` as they shuffle elements one-at-a-time into their respective collections.
2020-05-29Auto merge of #72756 - RalfJung:rollup-tbjmtx2, r=RalfJungbors-0/+19
Rollup of 9 pull requests Successful merges: - #67460 (Tweak impl signature mismatch errors involving `RegionKind::ReVar` lifetimes) - #71095 (impl From<[T; N]> for Box<[T]>) - #71500 (Make pointer offset methods/intrinsics const) - #71804 (linker: Support `-static-pie` and `-static -shared`) - #71862 (Implement RFC 2585: unsafe blocks in unsafe fn) - #72103 (borrowck `DefId` -> `LocalDefId`) - #72407 (Various minor improvements to Ipv6Addr::Display) - #72413 (impl Step for char (make Range*<char> iterable)) - #72439 (NVPTX support for new asm!) Failed merges: r? @ghost
2020-05-29Rollup merge of #71095 - pickfire:box-from-array, r=dtolnayRalf Jung-0/+19
impl From<[T; N]> for Box<[T]> Based on https://github.com/rust-lang/rust/pull/68692