dependencies = [
"compiler_builtins 0.0.0",
"core 0.0.0",
- "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rand 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"rustfix 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)",
name = "core"
version = "0.0.0"
dependencies = [
- "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rand 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "linkchecker"
version = "0.1.0"
+[[package]]
+name = "lock_api"
+version = "0.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
[[package]]
name = "log"
version = "0.3.9"
"parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
+[[package]]
+name = "parking_lot"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "lock_api 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "parking_lot_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
[[package]]
name = "parking_lot_core"
version = "0.2.14"
"winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
+[[package]]
+name = "parking_lot_core"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rand 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
+ "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
[[package]]
name = "percent-encoding"
version = "1.0.1"
"jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"polonius-engine 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"proc_macro 0.0.0",
"rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
+ "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
"cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"ena 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
version = "0.0.0"
dependencies = [
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc_cratesio_shim 0.0.0",
"rustc_data_structures 0.0.0",
"serialize 0.0.0",
"syntax_pos 0.0.0",
- "termcolor 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "termcolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
dependencies = [
"graphviz 0.0.0",
"log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rand 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc 0.0.0",
"rustc_data_structures 0.0.0",
"rustc_fs_util 0.0.0",
"panic_abort 0.0.0",
"panic_unwind 0.0.0",
"profiler_builtins 0.0.0",
- "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rand 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_asan 0.0.0",
"rustc_lsan 0.0.0",
"rustc_msan 0.0.0",
"checksum libgit2-sys 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6ab62b46003ba97701554631fa570d9f7e7947e2480ae3d941e555a54a2c0f05"
"checksum libssh2-sys 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "10dbc0957a27626444f5a3f523e6b97a70c3d702999bf1c7161cfbe7a25a9368"
"checksum libz-sys 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)" = "f5f9aba969b3c45fe9c94bec65895868a9ceca9a600699f4054b75747a19c7c6"
+"checksum lock_api 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "949826a5ccf18c1b3a7c3d57692778d21768b79e46eb9dd07bfc4c2160036c54"
"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
"checksum log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cba860f648db8e6f269df990180c2217f333472b4a6e901e97446858487971e2"
"checksum log_settings 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19af41f0565d7c19b2058153ad0b42d4d5ce89ec4dbf06ed6741114a8b63e7cd"
"checksum ordslice 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dd20eec3dbe4376829cb7d80ae6ac45e0a766831dca50202ff2d40db46a8a024"
"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37"
"checksum parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4d05f1349491390b1730afba60bb20d55761bef489a954546b58b4b34e1e2ac"
+"checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5"
"checksum parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4db1a8ccf734a7bce794cc19b3df06ed87ab2f3907036b693c68f56b4d4537fa"
+"checksum parking_lot_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "06a2b6aae052309c2fd2161ef58f5067bc17bb758377a0de9d4b279d603fdd8a"
"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
"checksum pest 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0fce5d8b5cc33983fc74f78ad552b5522ab41442c4ca91606e4236eb4b5ceefc"
"checksum pest_derive 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ab94faafeb93f4c5e3ce81ca0e5a779529a602ad5d09ae6d21996bfb8b6a52bf"
compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
[dev-dependencies]
-rand = "0.4"
+rand = "0.5"
[[test]]
name = "collectionstests"
use std::thread;
use std::vec::Vec;
- use rand::{thread_rng, Rng};
+ use rand::{thread_rng, RngCore};
use super::{LinkedList, Node};
use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize};
use std::thread;
-use rand::{Rng, thread_rng};
+use rand::{Rng, RngCore, thread_rng};
+use rand::distributions::Standard;
fn square(n: usize) -> usize {
n * n
for len in (2..25).chain(500..510) {
for &modulus in &[5, 10, 100, 1000] {
for _ in 0..10 {
- let orig: Vec<_> = rng.gen_iter::<i32>()
+ let orig: Vec<_> = rng.sample_iter::<i32, _>(&Standard)
.map(|x| x % modulus)
.take(len)
.collect();
path = "../libcore/benches/lib.rs"
[dev-dependencies]
-rand = "0.4"
+rand = "0.5"
use core::num::flt2dec::strategy::grisu::format_shortest_opt;
use core::num::flt2dec::{decode, DecodableFloat, FullDecoded, Decoded};
-use rand::{self, Rand, XorShiftRng};
-use rand::distributions::{IndependentSample, Range};
+use rand::{FromEntropy, XorShiftRng};
+use rand::distributions::{Distribution, Uniform};
pub fn decode_finite<T: DecodableFloat>(v: T) -> Decoded {
match decode(v).1 {
pub fn f32_random_equivalence_test<F, G>(f: F, g: G, k: usize, n: usize)
where F: FnMut(&Decoded, &mut [u8]) -> Option<(usize, i16)>,
G: FnMut(&Decoded, &mut [u8]) -> (usize, i16) {
- let mut rng: XorShiftRng = Rand::rand(&mut rand::thread_rng());
- let f32_range = Range::new(0x0000_0001u32, 0x7f80_0000);
+ let mut rng = XorShiftRng::from_entropy();
+ let f32_range = Uniform::new(0x0000_0001u32, 0x7f80_0000);
iterate("f32_random_equivalence_test", k, n, f, g, |_| {
- let x = f32::from_bits(f32_range.ind_sample(&mut rng));
+ let x = f32::from_bits(f32_range.sample(&mut rng));
decode_finite(x)
});
}
pub fn f64_random_equivalence_test<F, G>(f: F, g: G, k: usize, n: usize)
where F: FnMut(&Decoded, &mut [u8]) -> Option<(usize, i16)>,
G: FnMut(&Decoded, &mut [u8]) -> (usize, i16) {
- let mut rng: XorShiftRng = Rand::rand(&mut rand::thread_rng());
- let f64_range = Range::new(0x0000_0000_0000_0001u64, 0x7ff0_0000_0000_0000);
+ let mut rng = XorShiftRng::from_entropy();
+ let f64_range = Uniform::new(0x0000_0000_0000_0001u64, 0x7ff0_0000_0000_0000);
iterate("f64_random_equivalence_test", k, n, f, g, |_| {
- let x = f64::from_bits(f64_range.ind_sample(&mut rng));
+ let x = f64::from_bits(f64_range.sample(&mut rng));
decode_finite(x)
});
}
fn sort_unstable() {
use core::cmp::Ordering::{Equal, Greater, Less};
use core::slice::heapsort;
- use rand::{Rng, XorShiftRng};
+ use rand::{FromEntropy, Rng, XorShiftRng};
let mut v = [0; 600];
let mut tmp = [0; 600];
- let mut rng = XorShiftRng::new_unseeded();
+ let mut rng = XorShiftRng::from_entropy();
for len in (2..25).chain(500..510) {
let v = &mut v[0..len];
syntax = { path = "../libsyntax" }
syntax_pos = { path = "../libsyntax_pos" }
backtrace = "0.3.3"
-parking_lot = "0.5.5"
+parking_lot = "0.6"
byteorder = { version = "1.1", features = ["i128"]}
chalk-engine = { version = "0.7.0", default-features=false }
rustc_fs_util = { path = "../librustc_fs_util" }
// except according to those terms.
use rustc_data_structures::indexed_vec::IndexVec;
-use rustc_data_structures::sync::{RwLock, ReadGuard};
+use rustc_data_structures::sync::{RwLock, MappedReadGuard, ReadGuard};
use rustc_data_structures::stable_hasher::{HashStable, StableHasher,
StableHasherResult};
use ich::StableHashingContext;
*self.predecessors.borrow_mut() = None;
}
- pub fn predecessors(&self, mir: &Mir) -> ReadGuard<IndexVec<BasicBlock, Vec<BasicBlock>>> {
+ pub fn predecessors(
+ &self,
+ mir: &Mir
+ ) -> MappedReadGuard<IndexVec<BasicBlock, Vec<BasicBlock>>> {
if self.predecessors.borrow().is_none() {
*self.predecessors.borrow_mut() = Some(calculate_predecessors(mir));
}
use rustc_data_structures::graph::{self, GraphPredecessors, GraphSuccessors};
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
use rustc_data_structures::sync::Lrc;
-use rustc_data_structures::sync::ReadGuard;
+use rustc_data_structures::sync::MappedReadGuard;
use rustc_serialize as serialize;
use smallvec::SmallVec;
use std::borrow::Cow;
}
#[inline]
- pub fn predecessors(&self) -> ReadGuard<'_, IndexVec<BasicBlock, Vec<BasicBlock>>> {
+ pub fn predecessors(&self) -> MappedReadGuard<'_, IndexVec<BasicBlock, Vec<BasicBlock>>> {
self.cache.predecessors(self)
}
#[inline]
- pub fn predecessors_for(&self, bb: BasicBlock) -> ReadGuard<'_, Vec<BasicBlock>> {
- ReadGuard::map(self.predecessors(), |p| &p[bb])
+ pub fn predecessors_for(&self, bb: BasicBlock) -> MappedReadGuard<'_, Vec<BasicBlock>> {
+ MappedReadGuard::map(self.predecessors(), |p| &p[bb])
}
#[inline]
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use rustc_data_structures::sync::{RwLock, ReadGuard};
+use rustc_data_structures::sync::{RwLock, ReadGuard, MappedReadGuard};
use std::mem;
/// The `Steal` struct is intended to used as the value for a query.
}
}
- pub fn borrow(&self) -> ReadGuard<T> {
+ pub fn borrow(&self) -> MappedReadGuard<T> {
ReadGuard::map(self.value.borrow(), |opt| match *opt {
None => bug!("attempted to read from stolen value"),
Some(ref v) => v
[dependencies]
bitflags = "1.0"
log = "0.4"
+unicode-width = "0.1.4"
extern crate bitflags;
extern crate log;
+extern crate unicode_width;
smallvec = { version = "0.6.5", features = ["union"] }
[dependencies.parking_lot]
-version = "0.5"
+version = "0.6"
features = ["nightly"]
pub use std::rc::Rc as Lrc;
pub use std::rc::Weak as Weak;
pub use std::cell::Ref as ReadGuard;
+ pub use std::cell::Ref as MappedReadGuard;
pub use std::cell::RefMut as WriteGuard;
+ pub use std::cell::RefMut as MappedWriteGuard;
pub use std::cell::RefMut as LockGuard;
+ pub use std::cell::RefMut as MappedLockGuard;
use std::cell::RefCell as InnerRwLock;
use std::cell::RefCell as InnerLock;
pub use std::marker::Sync as Sync;
pub use parking_lot::RwLockReadGuard as ReadGuard;
+ pub use parking_lot::MappedRwLockReadGuard as MappedReadGuard;
pub use parking_lot::RwLockWriteGuard as WriteGuard;
+ pub use parking_lot::MappedRwLockWriteGuard as MappedWriteGuard;
pub use parking_lot::MutexGuard as LockGuard;
+ pub use parking_lot::MappedMutexGuard as MappedLockGuard;
pub use std::sync::Arc as Lrc;
pub use std::sync::Weak as Weak;
serialize = { path = "../libserialize" }
syntax_pos = { path = "../libsyntax_pos" }
rustc_data_structures = { path = "../librustc_data_structures" }
+rustc_cratesio_shim = { path = "../librustc_cratesio_shim" }
unicode-width = "0.1.4"
atty = "0.2"
-termcolor = "0.3"
+termcolor = "1.0"
[dependencies]
graphviz = { path = "../libgraphviz" }
log = "0.4"
-rand = "0.4"
+rand = "0.5"
rustc = { path = "../librustc" }
rustc_data_structures = { path = "../librustc_data_structures" }
serialize = { path = "../libserialize" }
use std::path::{Path, PathBuf};
use std::time::{UNIX_EPOCH, SystemTime, Duration};
-use rand::{thread_rng, Rng};
+use rand::{RngCore, thread_rng};
const LOCK_FILE_EXT: &'static str = ".lock";
const DEP_GRAPH_FILENAME: &'static str = "dep-graph.bin";
unwind = { path = "../libunwind" }
[dev-dependencies]
-rand = "0.4"
+rand = "0.5"
[target.x86_64-apple-darwin.dependencies]
rustc_asan = { path = "../librustc_asan" }
use fs::{self, File, OpenOptions};
use io::{ErrorKind, SeekFrom};
use path::Path;
- use rand::{StdRng, Rng};
+ use rand::{StdRng, FromEntropy, RngCore};
use str;
use sys_common::io::test::{TempDir, tmpdir};
use thread;
#[test]
fn binary_file() {
let mut bytes = [0; 1024];
- StdRng::new().unwrap().fill_bytes(&mut bytes);
+ StdRng::from_entropy().fill_bytes(&mut bytes);
let tmpdir = tmpdir();
#[test]
fn write_then_read() {
let mut bytes = [0; 1024];
- StdRng::new().unwrap().fill_bytes(&mut bytes);
+ StdRng::from_entropy().fill_bytes(&mut bytes);
let tmpdir = tmpdir();
thread::spawn(move || {
let mut rng = rand::thread_rng();
for _ in 0..M {
- if rng.gen_weighted_bool(N) {
+ if rng.gen_bool(1.0 / (N as f64)) {
drop(r.write().unwrap());
} else {
drop(r.read().unwrap());
pub mod test {
use path::{Path, PathBuf};
use env;
- use rand::{self, Rng};
+ use rand::{self, RngCore};
use fs;
pub struct TempDir(PathBuf);
use std::env::*;
use std::ffi::{OsString, OsStr};
-use rand::Rng;
+use rand::{thread_rng, Rng};
+use rand::distributions::Alphanumeric;
fn make_rand_name() -> OsString {
- let mut rng = rand::thread_rng();
- let n = format!("TEST{}", rng.gen_ascii_chars().take(10)
+ let mut rng = thread_rng();
+ let n = format!("TEST{}", rng.sample_iter(&Alphanumeric).take(10)
.collect::<String>());
let n = OsString::from(n);
assert!(var_os(&n).is_none());
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::stable_hasher::StableHasher;
-use rustc_data_structures::sync::{Lrc, Lock, LockGuard};
+use rustc_data_structures::sync::{Lrc, Lock, LockGuard, MappedLockGuard};
use std::cmp;
use std::hash::Hash;
use std::path::{Path, PathBuf};
Ok(self.new_source_file(filename, src))
}
- pub fn files(&self) -> LockGuard<Vec<Lrc<SourceFile>>> {
+ pub fn files(&self) -> MappedLockGuard<Vec<Lrc<SourceFile>>> {
LockGuard::map(self.files.borrow(), |files| &mut files.file_maps)
}
filetime = "0.2"
getopts = "0.2"
log = "0.4"
-regex = "0.2"
+regex = "1.0"
serde = "1.0"
serde_json = "1.0"
serde_derive = "1.0"
Crate("kernel32-sys"),
Crate("lazy_static"),
Crate("libc"),
+ Crate("lock_api"),
Crate("log"),
Crate("log_settings"),
Crate("memchr"),
Crate("owning_ref"),
Crate("parking_lot"),
Crate("parking_lot_core"),
- Crate("polonius-engine"),
Crate("pkg-config"),
+ Crate("polonius-engine"),
Crate("quick-error"),
Crate("rand"),
Crate("rand_core"),
Crate("winapi"),
Crate("winapi-build"),
Crate("winapi-i686-pc-windows-gnu"),
+ Crate("winapi-util"),
Crate("winapi-x86_64-pc-windows-gnu"),
Crate("wincolor"),
];