about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2018-12-22Update src/libcore/num/dec2flt/mod.rsMazdak Farrokhzad-1/+3
Co-Authored-By: frewsxcv <coreyf@rwell.org>
2018-12-22Update regex to EBNFCorey Farwell-10/+8
2018-12-21Fix Unpin docs linkTaylor Cramer-1/+1
2018-12-21Rename Box/Arc/Rc::pinned to ::pinTaylor Cramer-1/+1
2018-12-21Pin stabilization: fix doctestsTaylor Cramer-4/+1
2018-12-21Stabilize PinTaylor Cramer-27/+27
2018-12-21Update Pin API to match the one proposed for stabilizationTaylor Cramer-22/+17
Remove pin::Unpin reexport and add Unpin to the prelude. Change Pin associated functions to methods. Rename get_mut_unchecked_ to get_unchecked_mut Remove impl Unpin for Pin Mark Pin repr(transparent)
2018-12-20fix nitsNicole Mazzuca-2/+4
2018-12-20Update src/libcore/num/mod.rsDavid Tolnay-1/+1
Co-Authored-By: ubsan <npmazzuca@gmail.com>
2018-12-20Add DoubleEndedIterator::nth_backClar Fon-6/+107
2018-12-20Stabilize `Rc`, `Arc` and `Pin` as method receiversMichael Hewson-1/+23
This lets you write methods using `self: Rc<Self>`, `self: Arc<Self>`, `self: Pin<&mut Self>`, `self: Pin<Box<Self>`, and other combinations involving `Pin` and another stdlib receiver type, without needing the `arbitrary_self_types`. Other user-created receiver types can be used, but they still require the feature flag to use. This is implemented by introducing a new trait, `Receiver`, which the method receiver's type must implement if the `arbitrary_self_types` feature is not enabled. To keep composed receiver types such as `&Arc<Self>` unstable, the receiver type is also required to implement `Deref<Target=Self>` when the feature flag is not enabled. This lets you use `self: Rc<Self>` and `self: Arc<Self>` in stable Rust, which was not allowed previously. It was agreed that they would be stabilized in #55786. `self: Pin<&Self>` and other pinned receiver types do not require the `arbitrary_self_types` feature, but they cannot be used on stable because `Pin` still requires the `pin` feature.
2018-12-19Rollup merge of #56907 - rumajo:master, r=kennytm,CentrilPietro Albini-1/+1
Fix grammar in compiler error for array iterators This fixes a small grammatical mistake in the message the compiler gives when attempting to iterate directly over an array `arr` without calling `arr.iter()` or borrowing `&arr`.
2018-12-19Rollup merge of #56881 - Amanieu:ordering_eq, r=alexcrichtonPietro Albini-1/+1
Implement Eq, PartialEq and Hash for atomic::Ordering r? @alexcrichton
2018-12-19Fix tidy errorWilliam Brown-1/+2
2018-12-19Updates based on commentWilliam Brown-8/+4
2018-12-19Extend documentation for mem uninit to discuss partial allocation of the valuesWilliam Brown-0/+42
2018-12-18Auto merge of #56160 - oli-obk:const_fn_let, r=nikomatsakisbors-1/+0
Fix various aspects around `let` bindings inside const functions * forbid `let` bindings in const contexts that use short circuiting operators * harden analysis code against derefs of mutable references Initially this PR was about stabilizing `let` bindings, but too many flaws were exposed that need some more testing on nightly
2018-12-17fix testsNicole Mazzuca-2/+2
2018-12-17deny intra-doc link resolution failures in libstdAndy Russell-0/+6
2018-12-17rename div_euc -> div_euclid, and mod_euc -> rem_euclidNicole Mazzuca-91/+111
logic is written up in https://github.com/rust-lang/rust/issues/49048 Also, update the documentation slightly
2018-12-17Update the stdsimd submoduleAlex Crichton-0/+1
This brings in a few updates: * Update wasm intrinsic naming for atomics * Update and reimplement most simd128 wasm intrinsics * Other misc improvements here and there, including a small start to AVX-512 intrinsics
2018-12-17Auto merge of #56904 - sinkuu:cycle_fold, r=blussbors-13/+2
Remove Cycle::try_fold override Fixes #56883
2018-12-17Remove `<Cycle as Iterator>::try_fold` overrideShotaro Yamada-13/+2
It was a incorrect optimization.
2018-12-17Fix grammar in compiler error for array iteratorsMatthew Russell-1/+1
2018-12-16Implement Eq, PartialEq and Hash for atomic::OrderingAmanieu d'Antras-1/+1
2018-12-16Rollup merge of #56855 - nikic:remove-cttz-hack, r=nagisaMazdak Farrokhzad-14/+1
Remove u8 cttz hack This issue has since been fixed in LLVM: https://github.com/llvm-mirror/llvm/commit/1886c8e29a9992d73c5e6ba0d52eb98ee036ab5d Furthermore this code doesn't actually work, because the 8 literal does not match the $BITS provided from the macro invocation, so effectively this was just dead code. Ref #43024. What LLVM does is still not ideal for CPUs that only have bsf but not tzcnt, will create a patch for that later. r? @nagisa
2018-12-16Rollup merge of #56761 - estebank:path-display, r=zackmdavisMazdak Farrokhzad-2/+7
Suggest using `.display()` when trying to print a `Path` Fix #38997.
2018-12-16Rollup merge of #56706 - oli-obk:const_unsafe_fn, r=CentrilMazdak Farrokhzad-2/+2
Make `const unsafe fn` bodies `unsafe` r? @Centril Updated for tracking issue discussion https://github.com/rust-lang/rust/issues/55607#issuecomment-445882296
2018-12-16Rollup merge of #53506 - phungleson:fix-from-docs-atomic, r=KodrAusMazdak Farrokhzad-2/+15
Documentation for impl From for AtomicBool and other Atomic types As part of issue #51430 (cc @skade). The impl is very simple, so not sure if we need to go into any details.
2018-12-15Remove u8 cttz hackNikita Popov-14/+1
This issue has since been fixed in LLVM: https://github.com/llvm-mirror/llvm/commit/1886c8e29a9992d73c5e6ba0d52eb98ee036ab5d Furthermore this doesn't actually work, because the "8" literal does not match the $BITS provided from the macro invocation, so effectively this code was not being used anyway...
2018-12-15Rollup merge of #56677 - aelred:must-use-on-traits, r=estebankPietro Albini-0/+5
#[must_use] on traits in stdlib Based on #55506. Adds `#[must_use]` attribute to traits in the stdlib: - `Iterator` - `Future` - `FnOnce` - `Fn` - `FnMut` There may be other traits that should have the attribute, but I couldn't find/think of any.
2018-12-15Rollup merge of #56751 - mbrubeck:hash, r=dtolnayPietro Albini-1/+1
Allow ptr::hash to accept fat pointers Fat pointers implement Hash since #45483. This is a follow-up to #56250.
2018-12-14Auto merge of #56536 - alexcrichton:update-master, r=Mark-Simulacrumbors-23/+5
Bump to 1.33.0 * Update bootstrap compiler * Update version to 1.33.0 * Remove some `#[cfg(stage0)]` annotations
2018-12-13Change bounds on `TryFrom` blanket impl to use `Into` instead of `From`Ozaren-2/+2
2018-12-13Wording changesEsteban Küber-3/+3
2018-12-13Update code comments of `c_void` to explain the reasoning for its current ↵Sebastian Dröge-4/+6
implementation We need at least two variants of the enum as otherwise the compiler complains about the #[repr(u8)] attribute and we also need at least one variant as otherwise the enum would be uninhabitated and dereferencing pointers to it would be UB. As such, mark the variants not unstable because they should not actually exist but because they are temporary implementation details until `extern type` is stable and can be used instead.
2018-12-13Remove confusing comment about ideally using `!` for `c_void`Sebastian Dröge-3/+4
Using `!` for `c_void` would have the problem that pointers and potentially references to an uninhabited type would be created, and at least for references this is UB. Also document in addition that newtype wrappers around `c_void` are not recommended for representing opaque types (as a workaround for `extern type` not being stable) but instead refer to the Nomicon.
2018-12-13Auto merge of #56161 - RalfJung:vecdeque-stacked-borrows, r=SimonSapinbors-4/+4
VecDeque: fix for stacked borrows `VecDeque` violates a version of stacked borrows where creating a shared reference is not enough to make a location *mutably accessible* from raw pointers (and I think that is the version we want). There are two problems: * Creating a `NonNull<T>` from `&mut T` goes through `&T` (inferred for a `_`), then `*const T`, then `NonNull<T>`. That means in this stricter version of Stacked Borrows, we cannot actually write to such a `NonNull` because it was created from a shared reference! This PR fixes that by going from `&mut T` to `*mut T` to `*const T`. * `VecDeque::drain` creates the `Drain` struct by *first* creating a `NonNull` from `self` (which is an `&mut VecDeque`), and *then* calling `self.buffer_as_mut_slice()`. The latter reborrows `self`, asserting that `self` is currently the unique pointer to access this `VecDeque`, and hence invalidating the `NonNull` that was created earlier. This PR fixes that by instead using `self.buffer_as_slice()`, which only performs read accesses and creates only shared references, meaning the raw pointer (`NonNull`) remains valid. It is possible that other methods on `VecDeque` do something similar, miri's test coverage of `VecDeque` is sparse to say the least. Cc @nikomatsakis @Gankro
2018-12-12Suggest using `.display()` when trying to print a `Path`Esteban Küber-2/+7
2018-12-12Rename Pinned marker type to PhantomPinnedTaylor Cramer-8/+11
2018-12-12Expand documantation for std::pin moduleTaylor Cramer-15/+22
2018-12-12Allow ptr::hash to accept fat pointersMatt Brubeck-1/+1
2018-12-12Bump to 1.33.0Alex Crichton-23/+5
* Update bootstrap compiler * Update version to 1.33.0 * Remove some `#[cfg(stage0)]` annotations Actually updating the version number is blocked on updating Cargo
2018-12-11std: Depend directly on crates.io cratesAlex Crichton-7/+14
Ever since we added a Cargo-based build system for the compiler the standard library has always been a little special, it's never been able to depend on crates.io crates for runtime dependencies. This has been a result of various limitations, namely that Cargo doesn't understand that crates from crates.io depend on libcore, so Cargo tries to build crates before libcore is finished. I had an idea this afternoon, however, which lifts the strategy from #52919 to directly depend on crates.io crates from the standard library. After all is said and done this removes a whopping three submodules that we need to manage! The basic idea here is that for any crate `std` depends on it adds an *optional* dependency on an empty crate on crates.io, in this case named `rustc-std-workspace-core`. This crate is overridden via `[patch]` in this repository to point to a local crate we write, and *that* has a `path` dependency on libcore. Note that all `no_std` crates also depend on `compiler_builtins`, but if we're not using submodules we can publish `compiler_builtins` to crates.io and all crates can depend on it anyway! The basic strategy then looks like: * The standard library (or some transitive dep) decides to depend on a crate `foo`. * The standard library adds ```toml [dependencies] foo = { version = "0.1", features = ['rustc-dep-of-std'] } ``` * The crate `foo` has an optional dependency on `rustc-std-workspace-core` * The crate `foo` has an optional dependency on `compiler_builtins` * The crate `foo` has a feature `rustc-dep-of-std` which activates these crates and any other necessary infrastructure in the crate. A sample commit for `dlmalloc` [turns out to be quite simple][commit]. After that all `no_std` crates should largely build "as is" and still be publishable on crates.io! Notably they should be able to continue to use stable Rust if necessary, since the `rename-dependency` feature of Cargo is soon stabilizing. As a proof of concept, this commit removes the `dlmalloc`, `libcompiler_builtins`, and `libc` submodules from this repository. Long thorns in our side these are now gone for good and we can directly depend on crates.io! It's hoped that in the long term we can bring in other crates as necessary, but for now this is largely intended to simply make it easier to manage these crates and remove submodules. This should be a transparent non-breaking change for all users, but one possible stickler is that this almost for sure breaks out-of-tree `std`-building tools like `xargo` and `cargo-xbuild`. I think it should be relatively easy to get them working, however, as all that's needed is an entry in the `[patch]` section used to build the standard library. Hopefully we can work with these tools to solve this problem! [commit]: https://github.com/alexcrichton/dlmalloc-rs/commit/28ee12db813a3b650a7c25d1c36d2c17dcb88ae3
2018-12-12Documentation for impl From for AtomicBool and other Atomic typesSon-2/+15
2018-12-11Make `const unsafe fn` bodies `unsafe`Oliver Scherer-2/+2
2018-12-10Update Cargo submodule and its dependenciesAlex Crichton-2/+0
Hopefully just another routine update! So far this starts to enable the `std::arch` in stage0 builds of rustc. This means that we may need stage0/not(stage0) in stdsimd itself, but more and more code is starting to use `std::arch` so I think it's time to start shifting the balance of work here.
2018-12-10Add #[must_use] attribute to stdlib traitsFelix Chapman-0/+5
2018-12-09Auto merge of #56630 - sinkuu:core_iter, r=kennytmbors-22/+39
Resolve FIXME in libcore/iter/mod.rs and makes a few improvements.
2018-12-09Don't call size_hint of underlying iterator needlesslyShotaro Yamada-2/+10