about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2018-09-29Merge branch 'master' into dropMichael Bradshaw-45/+52
2018-09-30Auto merge of #54601 - cuviper:prep-1.31, r=Mark-Simulacrumbors-436/+3
Bump to 1.31.0 and bootstrap from 1.30 beta Closes #54594.
2018-09-29Auto merge of #54240 - csmoe:nonzero_from, r=alexcrichtonbors-0/+14
Impl From<NonZero<T>> for T Closes https://github.com/rust-lang/rust/issues/54171 r? @SimonSapin
2018-09-29Auto merge of #54660 - kennytm:rollup, r=kennytmbors-5/+5
Rollup of 8 pull requests Successful merges: - #54564 (Add 1.29.1 release notes) - #54567 (Include path in stamp hash for debuginfo tests) - #54577 (rustdoc: give proc-macros their own pages) - #54590 (std: Don't let `rust_panic` get inlined) - #54598 (Remove useless lifetimes from `Pin` `impl`s.) - #54604 (Added help message for `self_in_typedefs` feature gate) - #54635 (Improve docs for std::io::Seek) - #54645 (Compute Android gdb version in compiletest)
2018-09-29add MaybeUninitJorge Aparicio-0/+96
2018-09-29Revert "Auto merge of #53508 - japaric:maybe-uninit, r=RalfJung"Ralf Jung-136/+47
This reverts commit c6e3d7fa3113aaa64602507f39d4627c427742ff, reversing changes made to 4591a245c7eec9f70d668982b1383cd2a6854af5.
2018-09-27Bump to 1.31.0 and bootstrap from 1.30 betaJosh Stone-436/+3
2018-09-27Don't have two adjacent "see also" sentencesTobias Bucher-3/+1
2018-09-26Gate const core::mem::needs_drop behind const_needs_dropMichael Bradshaw-0/+1
2018-09-26Remove useless lifetimes from `Pin` `impl`s.Alexander Ronald Altman-5/+5
2018-09-26Make core::mem::needs_drop a const fnMichael Bradshaw-0/+9
2018-09-25Rollup merge of #54537 - sdroege:chunks-exact, r=alexcrichtonPietro Albini-82/+82
Rename slice::exact_chunks() to slice::chunks_exact() See https://github.com/rust-lang/rust/issues/47115#issuecomment-403090815 and https://github.com/rust-lang/rust/issues/47115#issuecomment-424053547
2018-09-25Rollup merge of #54058 - Kerollmops:slice-dedup, r=shepmasterPietro Albini-0/+232
Introduce the partition_dedup/by/by_key methods for slices This PR propose to add three methods to the slice type, the `partition_dedup`, `partition_dedup_by` and `partition_dedup_by_key`. The two other methods are based on `slice::partition_dedup_by`. These methods take a mutable slice, deduplicates it and moves all duplicates to the end of it, returning two mutable slices, the first containing the deduplicated elements and the second all the duplicates unordered. ```rust let mut slice = [1, 2, 2, 3, 3, 2]; let (dedup, duplicates) = slice.partition_dedup(); assert_eq!(dedup, [1, 2, 3, 2]); assert_eq!(duplicates, [3, 2]); ``` The benefits of adding these methods is that it is now possible to: - deduplicate a slice without having to allocate and possibly clone elements on the heap, really useful for embedded stuff that can't allocate for example. - not loose duplicate elements, because, when using `Vec::dedup`, duplicates elements are dropped. These methods add more flexibillity to the user. Note that this is near a copy/paste of the `Vec::dedup_by` function, once this method is stable the goal is to replace the algorithm in `Vec` by the following. ```rust pub fn Vec::dedup_by<F>(&mut self, same_bucket: F) where F: FnMut(&mut T, &mut T) -> bool { let (dedup, _) = self.as_mut_slice().partition_dedup_by(same_bucket); let len = dedup.len(); self.truncate(len); } ```
2018-09-25Rollup merge of #53518 - phungleson:fix-impl-from-for-convert, r=frewsxcvPietro Albini-0/+26
Add doc for impl From in char_convert As part of issue #51430 (cc @skade). The impl is very simple, let me know if we need to go into any details.
2018-09-25Add examples for docSon-4/+22
2018-09-25Also rename ExactChunks iterator name to ChunksExactSebastian Dröge-25/+25
2018-09-24std: Start implementing wasm32 atomicsAlex Crichton-0/+9
This commit is an initial start at implementing the standard library for wasm32-unknown-unknown with the experimental `atomics` feature enabled. None of these changes will be visible to users of the wasm32-unknown-unknown target because they all require recompiling the standard library. The hope with this is that we can get this support into the standard library and start iterating on it in-tree to enable experimentation. Currently there's a few components in this PR: * Atomic fences are disabled on wasm as there's no corresponding atomic op and it's not clear yet what the convention should be, but this will change in the future! * Implementations of `Mutex`, `Condvar`, and `RwLock` were all added based on the atomic intrinsics that wasm has. * The `ReentrantMutex` and thread-local-storage implementations panic currently as there's no great way to get a handle on the current thread's "id" yet. Right now the wasm32 target with atomics is unfortunately pretty unusable, requiring a lot of manual things here and there to actually get it operational. This will likely continue to evolve as the story for atomics and wasm unfolds, but we also need more LLVM support for some operations like custom `global` directives for this to work best.
2018-09-24Rename slice::exact_chunks() to slice::chunks_exact()Sebastian Dröge-59/+59
See https://github.com/rust-lang/rust/issues/47115#issuecomment-403090815 and https://github.com/rust-lang/rust/issues/47115#issuecomment-424053547
2018-09-24Auto merge of #53783 - RalfJung:ptr-docs, r=alexcrichtonbors-549/+701
Rewrite docs for pointer methods This takes over https://github.com/rust-lang/rust/pull/51016 by @ecstatic-morse. They did most of the work, I just did some editing. However, I realized one problem: This updates the docs for the "free functions" in `core::ptr`, but it does not update the copies of these docs for the inherent methods of the `*const T` and `*mut T` types. These getting out-of-sync is certainly bad, but I also don't feel like copying all this stuff around. Instead, we should remove this redundancy. Any good ideas?
2018-09-23Auto merge of #54339 - cramertj:no-cx, r=aturonbors-424/+43
Remove spawning from task::Context r? @aturon cc https://github.com/rust-lang-nursery/wg-net/issues/56
2018-09-23Introduce the partition_dedup/by/by_key methods for slicesClément Renault-0/+232
2018-09-22address Mark-Simulacrum commentsJorge Aparicio-11/+8
2018-09-22don't deprecate mem::{uninitialized,zeroed} just yetJorge Aparicio-2/+3
2018-09-22core: fix deprecated warningsJorge Aparicio-44/+40
2018-09-22add MaybeUninit and deprecate mem::{uninitialized,zeroed}Jorge Aparicio-0/+95
2018-09-22Rollup merge of #54422 - ljedrz:simplify_first_last, r=Mark-SimulacrumPietro Albini-6/+6
Simplify slice's first(_mut) and last(_mut) with get This change makes these functions easier to read and interpret. I haven't detected any difference in performance locally. r? @Mark-Simulacrum
2018-09-22Rollup merge of #54280 - japaric:no-cas-for-thumbv6, r=alexcrichtonPietro Albini-0/+23
remove (more) CAS API from Atomic* types where not natively supported closes #54276 In PR #51953 I made the Atomic* types available on targets like thumbv6m and msp430 with the intention of *only* exposing the load and store API on those types -- the rest of the API doesn't work on those targets because the are no native instructions to implement CAS loops. Unfortunately, it seems I didn't properly cfg away all the CAS API on those targets, as evidenced in #54276. This PR amends the issue by removing the rest of the CAS API. This is technically a breaking change because *libraries* that were using this API and were being compiled for e.g. thumbv6m-none-eabi will stop compiling. However, using those libraries (before this change) in programs (binaries) would lead to linking errors when compiled for e.g. thumbv6m so this change effectively shifts a linker error in binaries to a compiler error in libraries. On a side note: extending the Atomic API is a bit error prone because of these non-cas targets. Unless the author of the change is aware of these targets and properly uses `#[cfg(atomic = "cas")]` they could end up exposing new CAS API on these targets. I can't think of a test to check that an API is not present on some target, but we could extend the `tidy` tool to check that *all* newly added atomic API has the `#[cfg(atomic = "cas")]` attribute unless it's whitelisted in `tidy` then the author of the change would have to verify if the API can be used on non-cas targets. In any case, I'd like to plug this hole ASAP. We can revisit testing in a follow-up issue / PR. r? @alexcrichton cc @mvirkkunen
2018-09-22Rollup merge of #53652 - oconnor663:copy_in_place, r=alexcrichtonPietro Albini-0/+104
define copy_within on slices This is a safe wrapper around `ptr::copy`, for regions within a single slice. Previously, safe in-place copying was only available as a side effect of `Vec::drain`. I've wanted this API a couple times in the past, and I figured I'd just whip up a PR to help discuss it. It's possible something like this exists elsewhere and I just missed it. It might also be a big enough addition to warrant an RFC, I'm not sure.
2018-09-21clarify write_bytes a bitRalf Jung-0/+4
2018-09-21Simplify slice's first(_mut) and last(_mut) with getljedrz-6/+6
2018-09-20Rollup merge of #52813 - newpavlov:duration_mul_div_extras, r=alexcrichtonkennytm-1/+120
Duration div mul extras Successor of #52556. This PR adds the following `impl`s: - `impl Mul<Duration> for u32` (to allow `10*SECOND` in addition to `SECOND*10`) - `impl Mul<f64> for Duration` (to allow `2.5*SECOND` vs `2*SECOND + 500*MILLISECOND`) - `impl Mul<Duration> for f64` - `impl MulAssign<f64> for Duration` - `impl Div<f64> for Duration` - `impl DivAssign<f64> for Duration` - `impl Div<Duration> for Duration` (`Output = f64`, can be useful e.g. for `duration/MINUTE`) `f64` is chosen over `f32` to minimize rounding errors. (52 bits fraction precision vs `Duration`'s ~94 bit)
2018-09-20add tests for copy_withinJack O'Connor-0/+47
2018-09-20define copy_within on slicesJack O'Connor-0/+57
This is a safe wrapper around ptr::copy, for regions within a single slice. Previously, safe in-place copying was only available as a side effect of Vec::drain.
2018-09-19Remove spawning from task::ContextTaylor Cramer-424/+43
2018-09-19Added tracking issue, fixed check, 1.30 -> 1.31Artyom Pavlov-8/+8
2018-09-19Auto merge of #53877 - withoutboats:compositional-pin, r=aturonbors-102/+306
Update to a new pinning API. ~~Blocked on #53843 because of method resolution problems with new pin type.~~ @r? @cramertj cc @RalfJung @pythonesque anyone interested in #49150
2018-09-18Cleanup Deref impls and add ?Sized bound to &mut T implsTaylor Cramer-4/+4
2018-09-18clarify swapRalf Jung-5/+10
2018-09-17Cleanup and fix method resolution issueTaylor Cramer-60/+102
2018-09-17Adjust the docs of `from_raw_parts` to match the implementationTobias Bucher-4/+4
2018-09-17Use more obvious calculation for slice size checkTobias Bucher-4/+2
2018-09-17rearrange for clarityRalf Jung-41/+40
2018-09-17tweaksRalf Jung-4/+27
2018-09-17move from_nonzero test from run-pass to libcorecsmoe-0/+7
2018-09-17introduce from_nonzero featurecsmoe-1/+1
2018-09-16Auto merge of #53910 - IsaacWoods:unify_cvoid, r=SimonSapinbors-0/+43
Move std::os::raw::c_void into libcore and re-export in libstd Implements the first part of [RFC 2521](https://github.com/rust-lang/rfcs/pull/2521). cc #53856
2018-09-16remove (more) CAS API from Atomic* types where not natively supportedJorge Aparicio-0/+23
closes #54276
2018-09-16Auto merge of #53754 - RalfJung:slice_align_to, r=alexcrichtonbors-9/+8
stabilize slice_align_to This is very hard to implement correctly, and leads to [serious bugs](https://github.com/llogiq/bytecount/pull/42) when done incorrectly. Moreover, this is needed to be able to run code that opportunistically exploits alignment on miri. So code using `align_to`/`align_to_mut` gets the benefit of a well-tested implementation *and* of being able to run in miri to test for (some kinds of) UB. This PR also clarifies the guarantee wrt. the middle part being as long as possible. Should the docs say under which circumstances the middle part could be shorter? Currently, that can only happen when running in miri.
2018-09-15implement From<NonZero<Int>> for Intcsmoe-0/+7
2018-09-14Move std::os::raw::c_void into libcore and re-export in libstdIsaac Woods-0/+43