summary refs log tree commit diff
path: root/src/libstd/lib.rs
AgeCommit message (Collapse)AuthorLines
2017-11-08std: Remove `rand` crate and moduleAlex Crichton-15/+1
This commit removes the `rand` crate from the standard library facade as well as the `__rand` module in the standard library. Neither of these were used in any meaningful way in the standard library itself. The only need for randomness in libstd is to initialize the thread-local keys of a `HashMap`, and that unconditionally used `OsRng` defined in the standard library anyway. The cruft of the `rand` crate and the extra `rand` support in the standard library makes libstd slightly more difficult to port to new platforms, namely WebAssembly which doesn't have any randomness at all (without interfacing with JS). The purpose of this commit is to clarify and streamline randomness in libstd, focusing on how it's only required in one location, hashmap seeds. Note that the `rand` crate out of tree has almost always been a drop-in replacement for the `rand` crate in-tree, so any usage (accidental or purposeful) of the crate in-tree should switch to the `rand` crate on crates.io. This then also has the further benefit of avoiding duplication (mostly) between the two crates!
2017-11-03Mark several ascii methods as unstable againLukas Kalbertodt-0/+1
We don't want to stabilize them now already. The goal of this set of commits is just to add inherent methods to the four types. Stabilizing all of those methods can be done later.
2017-10-31Auto merge of #44764 - nvzqz:master, r=alexcrichtonbors-0/+2
Implement TryFrom<&[T]> for &[T; N] There are many cases where a buffer with a static compile-time size is preferred over a slice with a dynamic size. This allows for performing a checked conversion from `&[T]` to `&[T; N]`. This may also lead to compile-time optimizations involving `[T; N]` such as loop unrolling. This is my first PR to Rust, so I'm not sure if discussion of this change should happen here or does it need its own RFC? I figured these changes would be a subset of #33417.
2017-10-26Bump to 1.23 and update bootstrapAlex Crichton-12/+11
This commit updates the bootstrap compiler, bumps the version to 1.23, updates Cargo, updates books, and updates crates.io dependencies
2017-10-01Improve performance of spsc_queue and stream.Joshua Lockerman-0/+2
This commit makes two main changes. 1. It switches the spsc_queue node caching strategy from keeping a shared counter of the number of nodes in the cache to keeping a consumer only counter of the number of node eligible to be cached. 2. It separate the consumer and producers fields of spsc_queue and stream into a producer cache line and consumer cache line.
2017-09-29Enable required features for core::array in libstdNikolai Vazquez-0/+2
2017-09-19Auto merge of #44026 - QuietMisdreavus:trimmed-std, r=steveklabnikbors-1/+7
hide internal types/traits from std docs via new #[doc(masked)] attribute Fixes #43701 (hopefully for good this time) This PR introduces a new parameter to the `#[doc]` attribute that rustdoc looks for on `extern crate` statements. When it sees `#[doc(masked)]` on such a statement, it hides traits and types from that crate from appearing in either the "Trait Implementations" section of many type pages, or the "Implementors" section of trait pages. This is then applied to the `libc`/`rand`/`compiler_builtins` imports in libstd to prevent those crates from creating broken links in the std docs. Like in #43348, this also introduces a feature gate, `doc_masked`, that controls the use of this parameter. To view the std docs generated with this change, head to https://tonberry.quietmisdreavus.net/std-43701/std/index.html.
2017-09-17Add `<*const T>::align_offset` and use it in `memchr`Oliver Schneider-0/+1
2017-09-16stabilized needs_drop (fixes #41890)Michal Budzynski-1/+0
2017-09-16change #![feature(const_fn)] to specific gatesAlex Burka-0/+12
2017-09-09Auto merge of #44438 - Xaeroxe:clamp, r=Mark-Simulacrumbors-1/+0
Revert clamp Revert clamp per https://github.com/rust-lang/rust/issues/44095#issuecomment-328218316 while we take time to assess the potential backwards compatibility damage done by it.
2017-09-08Revert "Add panic unit tests"Jacob Kiesel-1/+0
This reverts commit b762283e57ff71f6763effb9cfc7fc0c7967b6b0.
2017-09-06Rollup merge of #44097 - Xaeroxe:clamp, r=burntsushiMark Simulacrum-0/+1
Add clamp functions Implementation of clamp feature: Tracking issue: https://github.com/rust-lang/rust/issues/44095 RFC: https://github.com/rust-lang/rfcs/pull/1961
2017-09-05add feature gate doc_masked and testsQuietMisdreavus-0/+1
2017-09-05new attribute #[doc(masked)] to hide internal crates from std docsQuietMisdreavus-1/+6
2017-09-04Add panic unit testsJacob Kiesel-0/+1
2017-08-31Bring back stage0 allocator logic on MSVCAlex Crichton-2/+5
I think there may still be bugs preventing its removal..
2017-08-31Update Cargo to 0.23.0 and our lockfileAlex Crichton-0/+2
2017-08-31Bump to 1.22.0Alex Crichton-10/+3
2017-08-27Whitelist unwind import in stdTatsuyuki Ishi-2/+2
This is a part of libbacktrace linkage and thus the compiler cannot detect if it's used or not.
2017-08-27Move unused-extern-crate to late passTatsuyuki Ishi-1/+2
2017-08-25*: remove crate_{name,type} attributesTamir Duberstein-3/+0
Fixes #41701.
2017-08-13Docs: restore link text after renaming anchorRuud van Asseldonk-2/+2
The text does not need the hyphen, but the anchor name does.
2017-08-13Replace space in Markdown link labelRuud van Asseldonk-3/+3
With the space, the tidy check does not recognize it as a link label. See also the comment above in line_is_url() in src/tools/tidy/src/style.rs.
2017-08-13Point "deref coercions" links to new bookRuud van Asseldonk-1/+1
Currently the link on doc.rust-lang.org is semi-broken; it links to a page that links to the exact page in the first edition in the book, or to the index of the second edition of the book. If the second editions is the recommended one now, we should point the links at that one. It seems that in the mean time, the links have been updated to point directly to the first edition of the book, but that hasn't made it onto the stable channel yet. By the time this commit makes it onto the stable channel, the second edition of the book should be complete enough. At least the part about deref coercions is.
2017-08-13Auto merge of #43348 - kennytm:fix-24658-doc-every-platform, r=alexcrichtonbors-0/+1
Expose all OS-specific modules in libstd doc. 1. Uses the special `--cfg dox` configuration passed by rustbuild when running `rustdoc`. Changes the `#[cfg(platform)]` into `#[cfg(any(dox, platform))]` so that platform-specific API are visible to rustdoc. 2. Since platform-specific implementations often won't compile correctly on other platforms, `rustdoc` is changed to apply `everybody_loops` to the functions during documentation and doc-test harness. 3. Since platform-specific code are documented on all platforms now, it could confuse users who found a useful API but is non-portable. Also, their examples will be doc-tested, so must be excluded when not testing on the native platform. An undocumented attribute `#[doc(cfg(...))]` is introduced to serve the above purposed. Fixes #24658 (Does _not_ fully implement #1998).
2017-08-12Check #[thread_local] statics correctly in the compiler.Eduard-Mihai Burtescu-0/+1
2017-08-10Fix cross-crate global allocators on windowsAidan Hobson Sayers-4/+10
2017-08-10Exposed all platform-specific documentation.kennytm-0/+1
2017-08-07Make a disable-jemalloc build workAidan Hobson Sayers-0/+10
Fixes #43510
2017-07-26Auto merge of #43373 - alexcrichton:stabilize-1.20.0, r=aturonbors-2/+0
Stabilize more APIs for the 1.20.0 release In addition to the few stabilizations that have already landed, this cleans up the remaining APIs that are in `final-comment-period` right now to be stable by the 1.20.0 release
2017-07-25std: Stabilize the `str_{mut,box}_extras` featureAlex Crichton-1/+0
Stabilizes * `<&mut str>::as_bytes_mut` * `<Box<str>>::into_boxed_bytes` * `std::str::from_boxed_utf8_unchecked` * `std::str::from_utf8_mut` * `std::str::from_utf8_unchecked_mut` Closes #41119
2017-07-25std: Stabilize `char_escape_debug`Alex Crichton-1/+0
Stabilizes: * `<char>::escape_debug` * `std::char::EscapeDebug` Closes #35068
2017-07-25Bump master to 1.21.0Alex Crichton-2/+1
This commit bumps the master branch's version to 1.21.0 and also updates the bootstrap compiler from the freshly minted beta release.
2017-07-17Auto merge of #43055 - est31:stabilize_float_bits_conv, r=sfacklerbors-1/+0
Stabilize float_bits_conv for Rust 1.21 Stabilizes the `float_bits_conv` lib feature for the 1.20 release of Rust. I've initially implemented the feature in #39271 and later made PR #43025 to output quiet NaNs even on platforms with different encodings, which seems to have been the only unresolved issue of the API. Due to PR #43025 being only applied to master this stabilisation can't happen for Rust 1.19 through the usual "stabilisation on beta" system that is being done for library APIs. r? @BurntSushi closes #40470.
2017-07-11use :vis in thread_local!Alex Burka-0/+1
2017-07-06remove associated_consts feature gateSean McArthur-1/+1
2017-07-06Stabilize float_bits_convest31-1/+0
2017-07-05rustc: Implement the #[global_allocator] attributeAlex Crichton-8/+6
This PR is an implementation of [RFC 1974] which specifies a new method of defining a global allocator for a program. This obsoletes the old `#![allocator]` attribute and also removes support for it. [RFC 1974]: https://github.com/rust-lang/rfcs/pull/197 The new `#[global_allocator]` attribute solves many issues encountered with the `#![allocator]` attribute such as composition and restrictions on the crate graph itself. The compiler now has much more control over the ABI of the allocator and how it's implemented, allowing much more freedom in terms of how this feature is implemented. cc #27389
2017-06-20Rollup merge of #42271 - tinaun:charfromstr, r=alexcrichtonCorey Farwell-0/+1
add `FromStr` Impl for `char` fixes #24939. is it possible to use pub(restricted) instead of using a stability attribute for the internal error representation? is it needed at all?
2017-06-20added `FromStr` Impl for `char`tinaun-0/+1
2017-06-20Auto merge of #42313 - pnkfelix:allocator-integration, r=alexcrichtonbors-0/+1
Allocator integration Lets start getting some feedback on `trait Alloc`. Here is: * the `trait Alloc` itself, * the `struct Layout` and `enum AllocErr` that its API relies on * a `struct HeapAlloc` that exposes the system allocator as an instance of `Alloc` * an integration of `Alloc` with `RawVec` * ~~an integration of `Alloc` with `Vec`~~ TODO * [x] split `fn realloc_in_place` into `grow` and `shrink` variants * [x] add `# Unsafety` and `# Errors` sections to documentation for all relevant methods * [x] remove `Vec` integration with `Allocator` * [x] add `allocate_zeroed` impl to `HeapAllocator` * [x] remove typedefs e.g. `type Size = usize;` * [x] impl `trait Error` for all error types in PR * [x] make `Layout::from_size_align` public * [x] clarify docs of `fn padding_needed_for`. * [x] revise `Layout` constructors to ensure that [size+align combination is valid](https://github.com/rust-lang/rust/pull/42313#issuecomment-306845446) * [x] resolve mismatch re requirements of align on dealloc. See [comment](https://github.com/rust-lang/rust/pull/42313#issuecomment-306202489).
2017-06-16Introduce tidy lint to check for inconsistent tracking issuesest31-1/+1
This commit * Refactors the collect_lib_features function to work in a non-checking mode (no bad pointer needed, and list of lang features). * Introduces checking whether unstable/stable tags for a given feature have inconsistent tracking issues. * Fixes such inconsistencies throughout the codebase.
2017-06-15implement Error trait for error structs added in allocator API.Felix S. Klock II-0/+1
2017-06-13Merge crate `collections` into `alloc`Murarth-10/+7
2017-05-20migrate everything to using mem::needs_dropAlexis Beingessner-0/+1
2017-04-29Update stage0 bootstrap compilerAlex Crichton-1/+0
We've got a freshly minted beta compiler, let's update to use that on nightly! This has a few other changes associated with it as well * A bump to the rustc version number (to 1.19.0) * Movement of the `cargo` and `rls` submodules to their "proper" location in `src/tools/{cargo,rls}`. Now that Cargo workspaces support the `exclude` option this can work. * Updates of the `cargo` and `rls` submodules to their master branches. * Tweak to the `src/stage0.txt` format to be more amenable for Cargo version numbers. On the beta channel Cargo will bootstrap from a different version than rustc (e.g. the version numbers are different), so we need different configuration for this. * Addition of `dev` as a readable key in the `src/stage0.txt` format. If present then stage0 compilers are downloaded from `dev-static.rust-lang.org` instead of `static.rust-lang.org`. This is added to accomodate our updated release process with Travis and AppVeyor.
2017-04-20Remove float_extrasJosh Stone-1/+0
[unstable, deprecated since 1.11.0]
2017-04-20Remove num::{Zero,One}Josh Stone-1/+0
[unstable, deprecated since 1.11.0]
2017-04-20Remove RefCell::borrow_stateJosh Stone-1/+0
[unstable, deprecated since 1.15.0]