about summary refs log tree commit diff
path: root/src/libstd/rand
AgeCommit message (Collapse)AuthorLines
2018-01-14Remove leftover Rand stuffFenrir-108/+0
2017-11-08std: Remove `rand` crate and moduleAlex Crichton-286/+0
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-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-03-12Update usages of 'OSX' (and other old names) to 'macOS'.Corey Farwell-2/+2
As of last year with version 'Sierra', the Mac operating system is now called 'macOS'.
2016-12-18Implement `fmt::Debug` for all structures in libstd.Corey Farwell-0/+7
Part of https://github.com/rust-lang/rust/issues/31869. Also turn on the `missing_debug_implementations` lint at the crate level.
2016-10-31Changed most vec! invocations to use square bracesiirelu-1/+1
Most of the Rust community agrees that the vec! macro is clearer when called using square brackets [] instead of regular brackets (). Most of these ocurrences are from before macros allowed using different types of brackets. There is one left unchanged in a pretty-print test, as the pretty printer still wants it to have regular brackets.
2016-09-30Ignore lots and lots of std tests on emscriptenBrian Anderson-0/+1
2016-02-17std: restructure rand os code into sys modulesSean McArthur-441/+93
2016-02-11bootstrap: Add directives to not double-link libsAlex Crichton-1/+4
Have all Cargo-built crates pass `--cfg cargobuild` and then add appropriate `#[cfg]` definitions to all crates to avoid linking anything if this is passed. This should help allow libstd to compile with both the makefiles and with Cargo.
2016-02-01Remove "powerpc64le" and "mipsel" target_archAlex Crichton-10/+5
Currently the `mipsel-unknown-linux-gnu` target doesn't actually set the `target_arch` value to `mipsel` but it rather uses `mips`. Alternatively the `powerpc64le` target does indeed set the `target_arch` as `powerpc64le`, causing a bit of inconsistency between theset two. As these are just the same instance of one instruction set, let's use `target_endian` to switch between them and only set the `target_arch` as one value. This should cut down on the number of `#[cfg]` annotations necessary and all around be a little more ergonomic.
2016-01-15Rollup merge of #30776 - antonblanchard:powerpc64_merge, r=alexcrichtonManish Goregaokar-5/+16
This adds support for big endian and little endian PowerPC64. make check runs clean apart from one big endian backtrace issue.
2016-01-13Incorrect getrandom() system call for PowerPC LinuxAnton Blanchard-2/+4
Michael Ellerman pointed out that the system call for getrandom() on PowerPC Linux is incorrect. This bug was in the powerpc32 port, and was carried over to the powerpc64 port too.
2016-01-13Add powerpc64 and powerpc64le supportAnton Blanchard-5/+14
This adds support for big endian and little endian PowerPC64. make check runs clean apart from one big endian backtrace issue.
2016-01-12switch from syscall(2) to getentropy(2)Sébastien Marie-1/+1
use the `getentropy()` function instead of `syscall()` and syscall-numbers.
2015-12-30Auto merge of #30458 - fhahn:fix-warnings-tests-stdlib, r=sanxiynbors-4/+0
This PR siliences some warnings when compiling stdlib with --test. Mostly remove some unused imports and added a few `#[allow(..)]`. I also marked some signal handling functions with `#[cfg(not(test))]`, because they are only called through `rt::lang_start`, which is also marked as `#[cfg(not(test))]`
2015-12-29Fix warnings when compiling stdlib with --testFlorian Hahn-4/+0
2015-12-23Use libc's Linux syscall()Michael McConville-5/+1
There's no need for us to redeclare it in an extern block.
2015-12-21Auto merge of #30352 - alexcrichton:new-snashots, r=nikomatsakisbors-2/+0
Lots of cruft to remove!
2015-12-21Register new snapshotsAlex Crichton-2/+0
Lots of cruft to remove!
2015-12-21unbreak openbsd codeSébastien Marie-1/+1
- upgrades libc to version with si_addr support in openbsd - declares libc use for getentropy
2015-12-18Use libc's syscall() and NR_GETENTROPY constMichael McConville-7/+1
2015-12-18Fix build by removing needless type prefixMichael McConville-1/+1
2015-12-18Simplify logic checking getentropy's return valueMichael McConville-5/+3
2015-12-18Use a const for getentropy(2)'s syscall numberMichael McConville-1/+5
Reported by Sebastien Marie.
2015-12-18Use the correct syscall name in panic messageMichael McConville-1/+1
I copied it from the getrandom code but forgot to change the name. Reported by Sebastien Marie.
2015-12-18Use the getentropy(2) syscall on OpenBSDMichael McConville-1/+66
Rust already supports Linux's getrandom(2), which is very similar and was based on getentropy(2). This is a pretty clean, simple addition that uses the same approach as the iOS randomness API support.
2015-12-17Trivial cleanupMichael McConville-3/+2
Remove a needless variable and simply a cfg().
2015-11-09std: Migrate to the new libcAlex Crichton-29/+8
* Delete `sys::unix::{c, sync}` as these are now all folded into libc itself * Update all references to use `libc` as a result. * Update all references to the new flat namespace. * Moves all windows bindings into sys::c
2015-09-03Use `null()`/`null_mut()` instead of `0 as *const T`/`0 as *mut T`Vadim Petrochenkov-1/+2
2015-08-15std: Add issues to all unstable featuresAlex Crichton-1/+1
2015-08-11rollup merge of #27678: alexcrichton/snapshotsAlex Crichton-8/+0
* Lots of core prelude imports removed * Makefile support for MSVC env vars and Rust crates removed * Makefile support for morestack removed
2015-08-11Register new snapshotsAlex Crichton-8/+0
* Lots of core prelude imports removed * Makefile support for MSVC env vars and Rust crates removed * Makefile support for morestack removed
2015-08-11std: Fix imports for ios targetMichael Macias-2/+2
2015-08-09Replace many uses of `mem::transmute` with more specific functionsTobias Bucher-2/+2
The replacements are functions that usually use a single `mem::transmute` in their body and restrict input and output via more concrete types than `T` and `U`. Worth noting are the `transmute` functions for slices and the `from_utf8*` family for mutable slices. Additionally, `mem::transmute` was often used for casting raw pointers, when you can already cast raw pointers just fine with `as`.
2015-08-05Better FFI disciplineTamir Duberstein-3/+1
2015-08-03syntax: Implement #![no_core]Alex Crichton-2/+4
This commit is an implementation of [RFC 1184][rfc] which tweaks the behavior of the `#![no_std]` attribute and adds a new `#![no_core]` attribute. The `#![no_std]` attribute now injects `extern crate core` at the top of the crate as well as the libcore prelude into all modules (in the same manner as the standard library's prelude). The `#![no_core]` attribute disables both std and core injection. [rfc]: https://github.com/rust-lang/rfcs/pull/1184
2015-07-27Auto merge of #27310 - akiss77:fix-aarch64-getrandom, r=alexcrichtonbors-1/+3
2015-07-26Fix getrandom syscall number for aarch64-unknown-linux-gnuAkos Kiss-1/+3
2015-07-24Fix `improper_ctypes` falloutTamir Duberstein-3/+4
2015-06-25libstd/rand/os.rs: Remove a tiny bit of duplicated codeCruz Julian Bishop-3/+1
It's nearly midnight. I'm tired. I'll look for something worth doing in the morning :)
2015-05-28remove references to IoResultSteve Klabnik-1/+1
This is now std::io::Result
2015-05-27Use `const fn` to abstract away the contents of UnsafeCell & friends.Eduard Burtescu-4/+4
2015-05-12Very hacky MSVC hacks.Ricky Taylor-0/+1
Conflicts: mk/platform.mk src/librustc/session/config.rs src/librustc_back/target/aarch64_apple_ios.rs src/librustc_back/target/aarch64_linux_android.rs src/librustc_back/target/arm_linux_androideabi.rs src/librustc_back/target/arm_unknown_linux_gnueabi.rs src/librustc_back/target/arm_unknown_linux_gnueabihf.rs src/librustc_back/target/armv7_apple_ios.rs src/librustc_back/target/armv7s_apple_ios.rs src/librustc_back/target/i386_apple_ios.rs src/librustc_back/target/i686_apple_darwin.rs src/librustc_back/target/i686_pc_windows_gnu.rs src/librustc_back/target/i686_unknown_dragonfly.rs src/librustc_back/target/i686_unknown_linux_gnu.rs src/librustc_back/target/mips_unknown_linux_gnu.rs src/librustc_back/target/mipsel_unknown_linux_gnu.rs src/librustc_back/target/mod.rs src/librustc_back/target/powerpc_unknown_linux_gnu.rs src/librustc_back/target/x86_64_apple_darwin.rs src/librustc_back/target/x86_64_apple_ios.rs src/librustc_back/target/x86_64_pc_windows_gnu.rs src/librustc_back/target/x86_64_unknown_dragonfly.rs src/librustc_back/target/x86_64_unknown_freebsd.rs src/librustc_back/target/x86_64_unknown_linux_gnu.rs src/librustc_back/target/x86_64_unknown_openbsd.rs src/librustc_llvm/lib.rs src/librustc_trans/back/link.rs src/librustc_trans/trans/base.rs src/libstd/os.rs src/rustllvm/RustWrapper.cpp
2015-05-09Squeeze the last bits of `task`s in documentation in favor of `thread`Barosl Lee-2/+2
An automated script was run against the `.rs` and `.md` files, subsituting every occurrence of `task` with `thread`. In the `.rs` files, only the texts in the comment blocks were affected.
2015-04-24Change name of unit test sub-module to "tests".Johannes Oertel-2/+2
Changes the style guidelines regarding unit tests to recommend using a sub-module named "tests" instead of "test" for unit tests as "test" might clash with imports of libtest.
2015-04-21std: Bring back f32::from_str_radix as an unstable APIAlex Crichton-7/+6
This API was exercised in a few tests and mirrors the `from_str_radix` functionality of the integer types.
2015-04-19std::rand::os: Fix race condition of atomicsklutzy-11/+10
Fixes #21538.
2015-04-14Negative case of `len()` -> `is_empty()`Tamir Duberstein-1/+1
`s/([^\(\s]+\.)len\(\) [(?:!=)>] 0/!$1is_empty()/g`
2015-04-14rand: Delete all doc testsAlex Crichton-168/+0
None of these actually compile any more!
2015-04-14test: Fixup many library unit testsAlex Crichton-267/+8