summary refs log tree commit diff
path: root/src/libcore/lib.rs
AgeCommit message (Collapse)AuthorLines
2018-10-19Stabilize impl_header_lifetime_elision in 2015Scott McMurray-1/+1
It's already stable in 2018; this finishes the stabilization.
2018-10-05Auto merge of #54017 - alexcrichton:wasm-atomics2, r=sfacklerbors-0/+1
std: Start implementing wasm32 atomics 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-29Use impl_header_lifetime_elision in libcoreScott McMurray-0/+1
2018-09-30Auto merge of #54601 - cuviper:prep-1.31, r=Mark-Simulacrumbors-1/+1
Bump to 1.31.0 and bootstrap from 1.30 beta Closes #54594.
2018-09-29Revert "Auto merge of #53508 - japaric:maybe-uninit, r=RalfJung"Ralf Jung-2/+0
This reverts commit c6e3d7fa3113aaa64602507f39d4627c427742ff, reversing changes made to 4591a245c7eec9f70d668982b1383cd2a6854af5.
2018-09-27Bump to 1.31.0 and bootstrap from 1.30 betaJosh Stone-1/+1
2018-09-24std: Start implementing wasm32 atomicsAlex Crichton-0/+1
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-22core: fix deprecated warningsJorge Aparicio-0/+2
2018-09-14Move std::os::raw::c_void into libcore and re-export in libstdIsaac Woods-0/+1
2018-09-11stabalize infer outlives requirements (RFC 2093).toidiu-1/+0
Co-authored-by: nikomatsakis
2018-09-01rebaseTim-0/+7
2018-08-27Auto merge of #53227 - nivkner:pin_move, r=RalfJungbors-0/+1
move the Pin API into its own module for centralized documentation This implements the change proposed by @withoutboats in #49150, as suggested by @RalfJung in the review of #53104, along with the documentation that was originally in it, that was deemed more appropriate in module-level documentation. r? @RalfJung
2018-08-27Auto merge of #53441 - toidiu:ak-fix53419, r=nikomatsakisbors-0/+1
fix for late-bound regions Fix for https://github.com/rust-lang/rust/issues/53419 r? @nikomatsakis
2018-08-24check that adding infer-outlives requirement to all crates worksNiko Matsakis-0/+1
2018-08-23Stabilize 'attr_literals' feature.Sergio Benitez-1/+0
2018-08-23move PinMut into pin module and export through stdNiv Kaminer-0/+1
2018-08-15Make core::sync::atomic::Ordering #[non_exhaustive]varkor-0/+1
2018-08-09[nll] libcore: enable feature(nll) for bootstrapmemoryruins-0/+1
2018-08-07Place unions, pointer casts and pointer derefs behind extra feature gatesOliver Schneider-0/+1
2018-08-05Remove unnecessary or invalid feature attributesvarkor-4/+0
2018-07-20Update stdsimd to undo an accidental stabilizationAlex Crichton-3/+0
Closes #52403
2018-07-06Remove unnecessary feature gate.Thayne McCombs-1/+0
To fix a warning.
2018-07-04Auto merge of #51395 - SimonSapin:repr-transparent, r=SimonSapinbors-0/+1
Add #[repr(transparent)] to some libcore types * `UnsafeCell` * `Cell` * `NonZero*` * `NonNull` * `Unique` CC https://github.com/rust-lang/rust/issues/43036
2018-07-01Rollup merge of #51511 - Centril:feature/stabilize_iterator_flatten, ↵Pietro Albini-1/+0
r=SimonSapin Stabilize Iterator::flatten in 1.29, fixes #48213. This PR stabilizes [`Iterator::flatten`](https://doc.rust-lang.org/nightly/std/iter/trait.Iterator.html#method.flatten) in *version 1.29* (1.28 goes to beta in 10 days, I don't think there's enough time to land it in that time, but let's see...). Tracking issue is: #48213. cc @bluss re. itertools. r? @SimonSapin ping @pietroalbini -- let's do a crater run when this passes CI :)
2018-06-30Bootstrap from 1.28.0-beta.3Mark Simulacrum-1/+0
2018-06-16Add #[repr(transparent)] to some libcore typesSimon Sapin-0/+1
* `UnsafeCell` * `Cell` * `NonZero*` * `NonNull` * `Unique`
2018-06-12Stabilize #[repr(transparent)]Simon Sapin-1/+1
Tracking issue FCP: https://github.com/rust-lang/rust/issues/43036#issuecomment-394094318 Reference PR: https://github.com/rust-lang-nursery/reference/pull/353
2018-06-11stabilize Iterator::flatten in 1.29, fixes #48115.Mazdak Farrokhzad-1/+0
2018-06-11Remove deprecated heap modulesSimon Sapin-7/+0
The heap.rs file was already unused.
2018-06-10Auto merge of #51200 - tmccombs:stable-iter-repeat-with, r=Centril,kennytmbors-1/+0
Stabilize iterator_repeat_with Fixes #48169
2018-06-06Auto merge of #51263 - cramertj:futures-in-core, r=aturonbors-0/+5
Add Future and task system to the standard library This adds preliminary versions of the `std::future` and `std::task` modules in order to unblock development of async/await (https://github.com/rust-lang/rust/issues/50547). These shouldn't be considered as final forms of these libraries-- design questions about the libraries should be left on https://github.com/rust-lang/rfcs/pull/2418. Once that RFC (or a successor) is merged, these APIs will be adjusted as necessary. r? @aturon
2018-06-06Add Future and task system to the standard libraryTaylor Cramer-0/+5
2018-06-03Rollup merge of #51299 - faern:const-int-ops, r=oli-obkMark Simulacrum-0/+1
const fn integer operations A follow up to #51171 Fixes #51267 Makes a lot of the integer methods (`swap_bytes`, `count_ones` etc) `const fn`s. See #51267 for a discussion about why this is wanted and the solution used.
2018-06-03s/panic_fmt/panic_impl/g in docsJorge Aparicio-1/+1
2018-06-02Stabilize iterator_repeat_withThayne McCombs-1/+0
Fixes #48169
2018-06-02Make most integer operations const fnsLinus Färnstrand-0/+1
2018-05-27lib.rs don't beautifuluuttff8-2/+2
2018-05-22Add Option::as_pin_mutTaylor Cramer-0/+1
2018-05-21Make `[T]::len` and `str::len` const fnOliver Schneider-0/+3
2018-05-17Switch to 1.26 bootstrap compilerMark Simulacrum-12/+7
2018-05-16Make core::nonzero privateSimon Sapin-1/+1
It is now an implementation detail of ptr::NonNull and num::NonZero*
2018-05-06Added some simple documentation.kennytm-0/+8
2018-05-06Some final touches to ensure `./x.py test --stage 0 src/lib*` workskennytm-0/+1
2018-05-01Auto merge of #49724 - kennytm:range-inc-start-end-methods, r=Kimundibors-0/+1
Introduce RangeInclusive::{new, start, end} methods and make the fields private. cc #49022
2018-05-01Removed direct field usage of RangeInclusive in rustc itself.kennytm-0/+1
2018-04-28stabilize `#[must_use]` for functions and must-use operatorsZack M. Davis-1/+1
This is in the matter of RFC 1940 and tracking issue #43302.
2018-04-24Rollup merge of #49906 - kennytm:stable-unreachable, r=sfacklerkennytm-0/+1
Stabilize `std::hint::unreachable_unchecked`. Closes #43751.
2018-04-22Auto merge of #49757 - GuillaumeGomez:never-search, r=QuietMisdreavusbors-0/+1
Add specific never search Fixes #49529. r? @QuietMisdreavus
2018-04-22Auto merge of #49896 - SimonSapin:inherent, r=alexcrichtonbors-1/+4
Add inherent methods in libcore for [T], [u8], str, f32, and f64 # Background Primitive types are defined by the language, they don’t have a type definition like `pub struct Foo { … }` in any crate. So they don’t “belong” to any crate as far as `impl` coherence is concerned, and on principle no crate would be able to define inherent methods for them, without a trait. Since we want these types to have inherent methods anyway, the standard library (with cooperation from the compiler) bends this rule with code like [`#[lang = "u8"] impl u8 { /*…*/ }`](https://github.com/rust-lang/rust/blob/1.25.0/src/libcore/num/mod.rs#L2244-L2245). The `#[lang]` attribute is permanently-unstable and never intended to be used outside of the standard library. Each lang item can only be defined once. Before this PR there is one impl-coherence-rule-bending lang item per primitive type (plus one for `[u8]`, which overlaps with `[T]`). And so one `impl` block each. These blocks for `str`, `[T]` and `[u8]` are in liballoc rather than libcore because *some* of the methods (like `<[T]>::to_vec(&self) -> Vec<T> where T: Clone`) need a global memory allocator which we don’t want to make a requirement in libcore. Similarly, `impl f32` and `impl f64` are in libstd because some of the methods are based on FFI calls to C’s `libm` and we want, as much as possible, libcore not to require “runtime support”. In libcore, the methods of `str` and `[T]` that don’t allocate are made available through two **unstable traits** `StrExt` and `SliceExt` (so the traits can’t be *named* by programs on the Stable release channel) that have **stable methods** and are re-exported in the libcore prelude (so that programs on Stable can *call* these methods anyway). Non-allocating `[u8]` methods are not available in libcore: https://github.com/rust-lang/rust/issues/45803. Some `f32` and `f64` methods are in an unstable `core::num::Float` trait with stable methods, but that one is **not in the libcore prelude**. (So as far as Stable programs are concerns it doesn’t exist, and I don’t know what the point was to mark these methods `#[stable]`.) https://github.com/rust-lang/rust/issues/32110 is the tracking issue for these unstable traits. # High-level proposal Since the standard library is already bending the rules, why not bend them *a little more*? By defining a few additional lang items, the compiler can allow the standard library to have *two* `impl` blocks (in different crates) for some primitive types. The `StrExt` and `SliceExt` traits still exist for now so that we can bootstrap from a previous-version compiler that doesn’t have these lang items yet, but they can be removed in next release cycle. (`Float` is used internally and needs to be public for libcore unit tests, but was already `#[doc(hidden)]`.) I don’t know if https://github.com/rust-lang/rust/issues/32110 should be closed by this PR, or only when the traits are entirely removed after we make a new bootstrap compiler. # Float methods Among the methods of the `core::num::Float` trait, three are based on LLVM intrinsics: `abs`, `signum`, and `powi`. PR https://github.com/rust-lang/rust/pull/27823 “Remove dependencies on libm functions from libcore” moved a bunch of `core::num::Float` methods back to libstd, but left these three behind. However they aren’t specifically discussed in the PR thread. The `compiler_builtins` crate defines `__powisf2` and `__powidf2` functions that look like implementations of `powi`, but I couldn’t find a connection with the `llvm.powi.f32` and `llvm.powi.f32` intrinsics by grepping through LLVM’s code. In discussion starting at https://github.com/rust-lang/rust/issues/32110#issuecomment-370647922 Alex says that we do not want methods in libcore that require “runtime support”, but it’s not clear whether that applies to these `abs`, `signum`, or `powi`. In doubt, I’ve **removed** them for the trait and moved them to inherent methods in libstd for now. We can move them back later (or in this PR) if we decide that’s appropriate. # Change details For users on the Stable release channel: * I believe this PR does not make any breaking change * Some methods for `[u8]`, `f32`, and `f64` are newly available to `#![no_std]` users (fixes https://github.com/rust-lang/rust/issues/45803) * There should be no visible change for `std` users in terms of what programs compile or what their behavior is. (Only in compiler error messages, possibly.) For Nightly users, additionally: * The unstable `StrExt` and `SliceExt` traits are gone * Their methods are now inherent methods of `str` and `[T]` (so only code that explicitly named the traits should be affected, not "normal" method calls) * The `abs`, `signum` and `powi` methods of the `Float` trait are gone * The `Float` trait’s unstable feature name changed to `float_internals` with no associated tracking issue, to reflect it being a permanently unstable implementation detail rather than a public API on a path to stabilization. * Its remaining methods are now inherent methods of `f32` and `f64`. ----- CC @rust-lang/libs for the API changes, @rust-lang/compiler for the new lang items
2018-04-21add more aliasesGuillaume Gomez-0/+1