Skip to content

Commit df1ac7a

Browse files
committed
Deprecate in-tree rand, std::rand and #[derive(Rand)].
Use the crates.io crate `rand` (version 0.1 should be a drop in replacement for `std::rand`) and `rand_macros` (`#[derive_Rand]` should be a drop-in replacement). [breaking-change]
1 parent eaf4c5c commit df1ac7a

File tree

21 files changed

+26
-100
lines changed

21 files changed

+26
-100
lines changed

src/etc/generate-deriving-span-tests.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ def write_file(name, string):
114114
'Encodable': (0, [], 0), # FIXME: quoting gives horrible spans
115115
}
116116

117-
for (trait, supers, errs) in [('Rand', [], 1),
118-
('Clone', [], 1),
117+
for (trait, supers, errs) in [('Clone', [], 1),
119118
('PartialEq', [], 2),
120119
('PartialOrd', ['PartialEq'], 8),
121120
('Eq', ['PartialEq'], 1),

src/libcollections/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#![feature(unicode)]
3535
#![feature(unsafe_destructor, slicing_syntax)]
3636
#![cfg_attr(test, feature(test))]
37+
#![cfg_attr(test, allow(deprecated))] // rand
3738

3839
#![no_std]
3940

src/libcoretest/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#![feature(int_uint)]
1313
#![feature(unboxed_closures)]
1414
#![feature(unsafe_destructor, slicing_syntax)]
15+
#![allow(deprecated)] // rand
1516

1617
extern crate core;
1718
extern crate test;

src/libflate/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ pub fn inflate_bytes_zlib(bytes: &[u8]) -> Option<Bytes> {
130130

131131
#[cfg(test)]
132132
mod tests {
133+
#![allow(deprecated)]
133134
use super::{inflate_bytes, deflate_bytes};
134135
use std::rand;
135136
use std::rand::Rng;

src/librand/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
#![feature(staged_api)]
2929
#![staged_api]
3030
#![feature(core)]
31+
#![deprecated(reason = "use the crates.io `rand` library instead",
32+
since = "1.0.0-alpha")]
33+
34+
#![allow(deprecated)]
3135

3236
#[macro_use]
3337
extern crate core;

src/librustc_back/sha2.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,7 @@ static H256: [u32; 8] = [
528528

529529
#[cfg(test)]
530530
mod tests {
531+
#![allow(deprecated)]
531532
extern crate rand;
532533

533534
use self::rand::Rng;

src/libstd/collections/hash/map.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,6 +1566,7 @@ pub struct RandomState {
15661566
impl RandomState {
15671567
/// Construct a new `RandomState` that is initialized with random keys.
15681568
#[inline]
1569+
#[allow(deprecated)]
15691570
pub fn new() -> RandomState {
15701571
let mut r = rand::thread_rng();
15711572
RandomState { k0: r.gen(), k1: r.gen() }

src/libstd/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ extern crate core;
142142
#[macro_reexport(vec)]
143143
extern crate "collections" as core_collections;
144144

145-
extern crate "rand" as core_rand;
145+
#[allow(deprecated)] extern crate "rand" as core_rand;
146146
extern crate alloc;
147147
extern crate unicode;
148148
extern crate libc;

src/libstd/num/strconv.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ mod tests {
459459

460460
#[cfg(test)]
461461
mod bench {
462+
#![allow(deprecated)] // rand
462463
extern crate test;
463464

464465
mod uint {

src/libstd/old_io/fs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,7 @@ fn access_string(access: FileAccess) -> &'static str {
822822
#[allow(unused_imports)]
823823
#[allow(unused_variables)]
824824
#[allow(unused_mut)]
825+
#[allow(deprecated)] // rand
825826
mod test {
826827
use prelude::v1::*;
827828
use old_io::{SeekSet, SeekCur, SeekEnd, Read, Open, ReadWrite, FileType};

0 commit comments

Comments
 (0)