From 9ec5ef541ad17986bfe6ae067a84ea8f7b7ae133 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Sat, 4 Aug 2018 16:24:39 -0600 Subject: [PATCH] Breaking change upgrades --- src/Cargo.lock | 50 +++++++++++++++++++++---- src/liballoc/Cargo.toml | 2 +- src/liballoc/collections/linked_list.rs | 2 +- src/liballoc/tests/slice.rs | 5 ++- src/libcore/Cargo.toml | 2 +- src/libcore/tests/num/flt2dec/random.rs | 16 ++++---- src/libcore/tests/slice.rs | 4 +- src/librustc/Cargo.toml | 2 +- src/librustc/mir/cache.rs | 7 +++- src/librustc/mir/mod.rs | 8 ++-- src/librustc/ty/steal.rs | 4 +- src/librustc_cratesio_shim/Cargo.toml | 1 + src/librustc_cratesio_shim/src/lib.rs | 1 + src/librustc_data_structures/Cargo.toml | 2 +- src/librustc_data_structures/sync.rs | 6 +++ src/librustc_errors/Cargo.toml | 3 +- src/librustc_incremental/Cargo.toml | 2 +- src/librustc_incremental/persist/fs.rs | 2 +- src/libstd/Cargo.toml | 2 +- src/libstd/fs.rs | 6 +-- src/libstd/sync/rwlock.rs | 2 +- src/libstd/sys_common/io.rs | 2 +- src/libstd/tests/env.rs | 7 ++-- src/libsyntax/source_map.rs | 4 +- src/tools/compiletest/Cargo.toml | 2 +- src/tools/tidy/src/deps.rs | 4 +- 26 files changed, 99 insertions(+), 49 deletions(-) diff --git a/src/Cargo.lock b/src/Cargo.lock index 2239f8b9478..951745bf5bb 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -12,7 +12,7 @@ version = "0.0.0" 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]] @@ -391,7 +391,7 @@ dependencies = [ "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)", @@ -421,7 +421,7 @@ dependencies = [ 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]] @@ -1092,6 +1092,15 @@ dependencies = [ 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" @@ -1397,6 +1406,15 @@ dependencies = [ "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" @@ -1408,6 +1426,17 @@ dependencies = [ "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" @@ -1821,7 +1850,7 @@ dependencies = [ "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)", @@ -2072,6 +2101,7 @@ version = "0.0.0" 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]] @@ -2081,7 +2111,7 @@ dependencies = [ "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)", @@ -2131,10 +2161,11 @@ name = "rustc_errors" 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)", ] @@ -2148,7 +2179,7 @@ version = "0.0.0" 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", @@ -2580,7 +2611,7 @@ dependencies = [ "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", @@ -3156,6 +3187,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "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" @@ -3188,7 +3220,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "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" diff --git a/src/liballoc/Cargo.toml b/src/liballoc/Cargo.toml index 1dad323769a..642a43d4d9c 100644 --- a/src/liballoc/Cargo.toml +++ b/src/liballoc/Cargo.toml @@ -14,7 +14,7 @@ core = { path = "../libcore" } compiler_builtins = { path = "../rustc/compiler_builtins_shim" } [dev-dependencies] -rand = "0.4" +rand = "0.5" [[test]] name = "collectionstests" diff --git a/src/liballoc/collections/linked_list.rs b/src/liballoc/collections/linked_list.rs index 9844de9a57d..2ef84dbade0 100644 --- a/src/liballoc/collections/linked_list.rs +++ b/src/liballoc/collections/linked_list.rs @@ -1222,7 +1222,7 @@ mod tests { use std::thread; use std::vec::Vec; - use rand::{thread_rng, Rng}; + use rand::{thread_rng, RngCore}; use super::{LinkedList, Node}; diff --git a/src/liballoc/tests/slice.rs b/src/liballoc/tests/slice.rs index df5e18a9a18..f33bf64d40b 100644 --- a/src/liballoc/tests/slice.rs +++ b/src/liballoc/tests/slice.rs @@ -18,7 +18,8 @@ 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 @@ -405,7 +406,7 @@ fn test_sort() { 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::() + let orig: Vec<_> = rng.sample_iter::(&Standard) .map(|x| x % modulus) .take(len) .collect(); diff --git a/src/libcore/Cargo.toml b/src/libcore/Cargo.toml index 321ed892ea9..0b01cfc488b 100644 --- a/src/libcore/Cargo.toml +++ b/src/libcore/Cargo.toml @@ -20,4 +20,4 @@ name = "corebenches" path = "../libcore/benches/lib.rs" [dev-dependencies] -rand = "0.4" +rand = "0.5" diff --git a/src/libcore/tests/num/flt2dec/random.rs b/src/libcore/tests/num/flt2dec/random.rs index a1928657dab..ab619093d9d 100644 --- a/src/libcore/tests/num/flt2dec/random.rs +++ b/src/libcore/tests/num/flt2dec/random.rs @@ -18,8 +18,8 @@ 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(v: T) -> Decoded { match decode(v).1 { @@ -71,10 +71,10 @@ fn iterate(func: &str, k: usize, n: usize, mut f: F, mut g: G, mut v: V pub fn f32_random_equivalence_test(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) }); } @@ -82,10 +82,10 @@ pub fn f32_random_equivalence_test(f: F, g: G, k: usize, n: usize) pub fn f64_random_equivalence_test(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) }); } diff --git a/src/libcore/tests/slice.rs b/src/libcore/tests/slice.rs index b087ec81f59..012dc9bf5e0 100644 --- a/src/libcore/tests/slice.rs +++ b/src/libcore/tests/slice.rs @@ -802,11 +802,11 @@ fn test_rotate_right() { 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]; diff --git a/src/librustc/Cargo.toml b/src/librustc/Cargo.toml index fc5d4a9c923..6c3b52196a3 100644 --- a/src/librustc/Cargo.toml +++ b/src/librustc/Cargo.toml @@ -29,7 +29,7 @@ serialize = { path = "../libserialize" } 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" } diff --git a/src/librustc/mir/cache.rs b/src/librustc/mir/cache.rs index 41ba526b73f..d1f050fcd42 100644 --- a/src/librustc/mir/cache.rs +++ b/src/librustc/mir/cache.rs @@ -9,7 +9,7 @@ // 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; @@ -55,7 +55,10 @@ pub fn invalidate(&self) { *self.predecessors.borrow_mut() = None; } - pub fn predecessors(&self, mir: &Mir) -> ReadGuard>> { + pub fn predecessors( + &self, + mir: &Mir + ) -> MappedReadGuard>> { if self.predecessors.borrow().is_none() { *self.predecessors.borrow_mut() = Some(calculate_predecessors(mir)); } diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 44730c19dd3..f66be6dc54d 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -25,7 +25,7 @@ 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; @@ -194,13 +194,13 @@ pub fn basic_blocks_and_local_decls_mut( } #[inline] - pub fn predecessors(&self) -> ReadGuard<'_, IndexVec>> { + pub fn predecessors(&self) -> MappedReadGuard<'_, IndexVec>> { self.cache.predecessors(self) } #[inline] - pub fn predecessors_for(&self, bb: BasicBlock) -> ReadGuard<'_, Vec> { - ReadGuard::map(self.predecessors(), |p| &p[bb]) + pub fn predecessors_for(&self, bb: BasicBlock) -> MappedReadGuard<'_, Vec> { + MappedReadGuard::map(self.predecessors(), |p| &p[bb]) } #[inline] diff --git a/src/librustc/ty/steal.rs b/src/librustc/ty/steal.rs index 842c0d65734..3ff3cb4cae1 100644 --- a/src/librustc/ty/steal.rs +++ b/src/librustc/ty/steal.rs @@ -8,7 +8,7 @@ // 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. @@ -42,7 +42,7 @@ pub fn new(value: T) -> Self { } } - pub fn borrow(&self) -> ReadGuard { + pub fn borrow(&self) -> MappedReadGuard { ReadGuard::map(self.value.borrow(), |opt| match *opt { None => bug!("attempted to read from stolen value"), Some(ref v) => v diff --git a/src/librustc_cratesio_shim/Cargo.toml b/src/librustc_cratesio_shim/Cargo.toml index 342c7d1b678..b8e494e4040 100644 --- a/src/librustc_cratesio_shim/Cargo.toml +++ b/src/librustc_cratesio_shim/Cargo.toml @@ -22,3 +22,4 @@ crate-type = ["dylib"] [dependencies] bitflags = "1.0" log = "0.4" +unicode-width = "0.1.4" diff --git a/src/librustc_cratesio_shim/src/lib.rs b/src/librustc_cratesio_shim/src/lib.rs index 481f2f54c5e..ebceb00cca8 100644 --- a/src/librustc_cratesio_shim/src/lib.rs +++ b/src/librustc_cratesio_shim/src/lib.rs @@ -16,3 +16,4 @@ extern crate bitflags; extern crate log; +extern crate unicode_width; diff --git a/src/librustc_data_structures/Cargo.toml b/src/librustc_data_structures/Cargo.toml index 0376cf81157..5a72fde6a2c 100644 --- a/src/librustc_data_structures/Cargo.toml +++ b/src/librustc_data_structures/Cargo.toml @@ -22,5 +22,5 @@ rustc-hash = "1.0.1" smallvec = { version = "0.6.5", features = ["union"] } [dependencies.parking_lot] -version = "0.5" +version = "0.6" features = ["nightly"] diff --git a/src/librustc_data_structures/sync.rs b/src/librustc_data_structures/sync.rs index 6989cdc0a9a..a2893a60cb6 100644 --- a/src/librustc_data_structures/sync.rs +++ b/src/librustc_data_structures/sync.rs @@ -93,8 +93,11 @@ pub fn par_iter(t: T) -> T::IntoIter { 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; @@ -213,9 +216,12 @@ pub fn take(&self) -> Option { 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; diff --git a/src/librustc_errors/Cargo.toml b/src/librustc_errors/Cargo.toml index e412d1749d1..101ca0650c8 100644 --- a/src/librustc_errors/Cargo.toml +++ b/src/librustc_errors/Cargo.toml @@ -12,6 +12,7 @@ crate-type = ["dylib"] 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" diff --git a/src/librustc_incremental/Cargo.toml b/src/librustc_incremental/Cargo.toml index c3f6062e799..b8519ee1ab1 100644 --- a/src/librustc_incremental/Cargo.toml +++ b/src/librustc_incremental/Cargo.toml @@ -11,7 +11,7 @@ crate-type = ["dylib"] [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" } diff --git a/src/librustc_incremental/persist/fs.rs b/src/librustc_incremental/persist/fs.rs index 28d53dc7fb3..ec25aef8080 100644 --- a/src/librustc_incremental/persist/fs.rs +++ b/src/librustc_incremental/persist/fs.rs @@ -126,7 +126,7 @@ 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"; diff --git a/src/libstd/Cargo.toml b/src/libstd/Cargo.toml index 5348c9a0f34..bcdd1b4b088 100644 --- a/src/libstd/Cargo.toml +++ b/src/libstd/Cargo.toml @@ -25,7 +25,7 @@ profiler_builtins = { path = "../libprofiler_builtins", optional = true } unwind = { path = "../libunwind" } [dev-dependencies] -rand = "0.4" +rand = "0.5" [target.x86_64-apple-darwin.dependencies] rustc_asan = { path = "../librustc_asan" } diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 7632fbc41f5..e177d4a988a 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -2076,7 +2076,7 @@ mod tests { 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; @@ -3110,7 +3110,7 @@ fn _assert_send_sync() {} #[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(); @@ -3123,7 +3123,7 @@ fn binary_file() { #[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(); diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index e3db60cff84..ed3a3865a6c 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -597,7 +597,7 @@ fn frob() { 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()); diff --git a/src/libstd/sys_common/io.rs b/src/libstd/sys_common/io.rs index ab23936358e..a96fb192139 100644 --- a/src/libstd/sys_common/io.rs +++ b/src/libstd/sys_common/io.rs @@ -14,7 +14,7 @@ pub mod test { use path::{Path, PathBuf}; use env; - use rand::{self, Rng}; + use rand::{self, RngCore}; use fs; pub struct TempDir(PathBuf); diff --git a/src/libstd/tests/env.rs b/src/libstd/tests/env.rs index 8acb8a46d7b..7302a794480 100644 --- a/src/libstd/tests/env.rs +++ b/src/libstd/tests/env.rs @@ -13,11 +13,12 @@ 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::()); let n = OsString::from(n); assert!(var_os(&n).is_none()); diff --git a/src/libsyntax/source_map.rs b/src/libsyntax/source_map.rs index 8f91db8efa7..95839f94b9e 100644 --- a/src/libsyntax/source_map.rs +++ b/src/libsyntax/source_map.rs @@ -24,7 +24,7 @@ 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}; @@ -194,7 +194,7 @@ pub fn load_file(&self, path: &Path) -> io::Result> { Ok(self.new_source_file(filename, src)) } - pub fn files(&self) -> LockGuard>> { + pub fn files(&self) -> MappedLockGuard>> { LockGuard::map(self.files.borrow(), |files| &mut files.file_maps) } diff --git a/src/tools/compiletest/Cargo.toml b/src/tools/compiletest/Cargo.toml index 6639ba51b12..7fec2e003a4 100644 --- a/src/tools/compiletest/Cargo.toml +++ b/src/tools/compiletest/Cargo.toml @@ -9,7 +9,7 @@ env_logger = { version = "0.5", default-features = false } 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" diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index b9549968db4..d6a2c17d6f6 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -91,6 +91,7 @@ Crate("kernel32-sys"), Crate("lazy_static"), Crate("libc"), + Crate("lock_api"), Crate("log"), Crate("log_settings"), Crate("memchr"), @@ -102,8 +103,8 @@ 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"), @@ -134,6 +135,7 @@ Crate("winapi"), Crate("winapi-build"), Crate("winapi-i686-pc-windows-gnu"), + Crate("winapi-util"), Crate("winapi-x86_64-pc-windows-gnu"), Crate("wincolor"), ]; -- 2.44.0