rollup merge of #20264: nagisa/threadrng
Since runtime is removed, rust has no tasks anymore and everything is moving from being task-* to thread-*. Let’s rename TaskRng as well! This is a breaking change. If a breaking change for consistency is not desired, feel free to close.
This commit is contained in:
commit
9cbbfee8a4
21 changed files with 97 additions and 97 deletions
|
|
@ -83,7 +83,7 @@ fn read_line() {
|
|||
}
|
||||
|
||||
fn vec_plus() {
|
||||
let mut r = rand::task_rng();
|
||||
let mut r = rand::thread_rng();
|
||||
|
||||
let mut v = Vec::new();
|
||||
let mut i = 0;
|
||||
|
|
@ -101,7 +101,7 @@ fn vec_plus() {
|
|||
}
|
||||
|
||||
fn vec_append() {
|
||||
let mut r = rand::task_rng();
|
||||
let mut r = rand::thread_rng();
|
||||
|
||||
let mut v = Vec::new();
|
||||
let mut i = 0;
|
||||
|
|
@ -122,7 +122,7 @@ fn vec_append() {
|
|||
}
|
||||
|
||||
fn vec_push_all() {
|
||||
let mut r = rand::task_rng();
|
||||
let mut r = rand::thread_rng();
|
||||
|
||||
let mut v = Vec::new();
|
||||
for i in range(0u, 1500) {
|
||||
|
|
|
|||
|
|
@ -8,14 +8,14 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ensure that the TaskRng isn't/doesn't become accidentally sendable.
|
||||
// ensure that the ThreadRng isn't/doesn't become accidentally sendable.
|
||||
|
||||
use std::rand;
|
||||
|
||||
fn test_send<S: Send>() {}
|
||||
|
||||
pub fn main() {
|
||||
test_send::<rand::TaskRng>();
|
||||
test_send::<rand::ThreadRng>();
|
||||
//~^ ERROR `core::kinds::Send` is not implemented
|
||||
//~^^ ERROR `core::kinds::Send` is not implemented
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
use std::{char, os};
|
||||
use std::io::{File, Command};
|
||||
use std::rand::{task_rng, Rng};
|
||||
use std::rand::{thread_rng, Rng};
|
||||
|
||||
// creates unicode_input_multiple_files_{main,chars}.rs, where the
|
||||
// former imports the latter. `_chars` just contains an identifier
|
||||
|
|
@ -19,7 +19,7 @@ use std::rand::{task_rng, Rng};
|
|||
// this span used to upset the compiler).
|
||||
|
||||
fn random_char() -> char {
|
||||
let mut rng = task_rng();
|
||||
let mut rng = thread_rng();
|
||||
// a subset of the XID_start Unicode table (ensuring that the
|
||||
// compiler doesn't fail with an "unrecognised token" error)
|
||||
let (lo, hi): (u32, u32) = match rng.gen_range(1u32, 4u32 + 1) {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
use std::{char, os};
|
||||
use std::io::{File, Command};
|
||||
use std::rand::{task_rng, Rng};
|
||||
use std::rand::{thread_rng, Rng};
|
||||
|
||||
// creates a file with `fn main() { <random ident> }` and checks the
|
||||
// compiler emits a span of the appropriate length (for the
|
||||
|
|
@ -18,7 +18,7 @@ use std::rand::{task_rng, Rng};
|
|||
// points, but should be the number of graphemes (FIXME #7043)
|
||||
|
||||
fn random_char() -> char {
|
||||
let mut rng = task_rng();
|
||||
let mut rng = thread_rng();
|
||||
// a subset of the XID_start Unicode table (ensuring that the
|
||||
// compiler doesn't fail with an "unrecognised token" error)
|
||||
let (lo, hi): (u32, u32) = match rng.gen_range(1u32, 4u32 + 1) {
|
||||
|
|
@ -38,7 +38,7 @@ fn main() {
|
|||
let main_file = tmpdir.join("span_main.rs");
|
||||
|
||||
for _ in range(0u, 100) {
|
||||
let n = task_rng().gen_range(3u, 20);
|
||||
let n = thread_rng().gen_range(3u, 20);
|
||||
|
||||
{
|
||||
let _ = write!(&mut File::create(&main_file).unwrap(),
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
use std::task;
|
||||
use std::sync::atomic::{AtomicUint, INIT_ATOMIC_UINT, Relaxed};
|
||||
use std::rand::{task_rng, Rng, Rand};
|
||||
use std::rand::{thread_rng, Rng, Rand};
|
||||
|
||||
const REPEATS: uint = 5;
|
||||
const MAX_LEN: uint = 32;
|
||||
|
|
@ -59,7 +59,7 @@ pub fn main() {
|
|||
// IDs start from 0.
|
||||
creation_count.store(0, Relaxed);
|
||||
|
||||
let main = task_rng().gen_iter::<DropCounter>()
|
||||
let main = thread_rng().gen_iter::<DropCounter>()
|
||||
.take(len)
|
||||
.collect::<Vec<DropCounter>>();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue