Skip to content

Commit c3e1f77

Browse files
committedFeb 4, 2015
Auto merge of #21892 - huonw:deprecate-rand, r=alexcrichton
Use [`rand`](https://crates.io/crates/rand) and [`derive_rand`](https://crates.io/crates/derive_rand) from crates.io. [breaking-change]
2 parents d6c15d9 + df1ac7a commit c3e1f77

21 files changed

+26
-100
lines changed
 

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

+1-2
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

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#![feature(unicode)]
3333
#![feature(unsafe_destructor, slicing_syntax)]
3434
#![cfg_attr(test, feature(test))]
35+
#![cfg_attr(test, allow(deprecated))] // rand
3536

3637
#![no_std]
3738

‎src/libcoretest/lib.rs

+1
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

+1
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

+4
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

+1
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

+1
Original file line numberDiff line numberDiff line change
@@ -1593,6 +1593,7 @@ pub struct RandomState {
15931593
impl RandomState {
15941594
/// Construct a new `RandomState` that is initialized with random keys.
15951595
#[inline]
1596+
#[allow(deprecated)]
15961597
pub fn new() -> RandomState {
15971598
let mut r = rand::thread_rng();
15981599
RandomState { k0: r.gen(), k1: r.gen() }

‎src/libstd/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ extern crate core;
140140
#[macro_reexport(vec)]
141141
extern crate "collections" as core_collections;
142142

143-
extern crate "rand" as core_rand;
143+
#[allow(deprecated)] extern crate "rand" as core_rand;
144144
extern crate alloc;
145145
extern crate unicode;
146146
extern crate libc;

‎src/libstd/num/strconv.rs

+1
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

+1
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};

‎src/libstd/old_io/tempfile.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
//! Temporary files and directories
12+
#![allow(deprecated)] // rand
1213

1314
use env;
1415
use iter::{IteratorExt};

‎src/libstd/os.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1422,6 +1422,8 @@ mod arch_consts {
14221422

14231423
#[cfg(test)]
14241424
mod tests {
1425+
#![allow(deprecated)] // rand
1426+
14251427
use prelude::v1::*;
14261428

14271429
use iter::repeat;

‎src/libstd/rand/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@
220220
//! ```
221221
222222
#![unstable(feature = "rand")]
223+
#![deprecated(reason = "use the crates.io `rand` library instead",
224+
since = "1.0.0-alpha")]
225+
#![allow(deprecated)]
223226

224227
use cell::RefCell;
225228
use clone::Clone;

‎src/libstd/sync/rwlock.rs

+2
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,8 @@ impl<'a, T> Drop for RwLockWriteGuard<'a, T> {
383383

384384
#[cfg(test)]
385385
mod tests {
386+
#![allow(deprecated)] // rand
387+
386388
use prelude::v1::*;
387389

388390
use rand::{self, Rng};

‎src/libsyntax/ext/deriving/rand.rs

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ pub fn expand_deriving_rand<F>(cx: &mut ExtCtxt,
2424
push: F) where
2525
F: FnOnce(P<Item>),
2626
{
27+
cx.span_warn(span,
28+
"`#[derive(Rand)]` is deprecated in favour of `#[derive_Rand]` from \
29+
`rand_macros` on crates.io");
30+
2731
let trait_def = TraitDef {
2832
span: span,
2933
attributes: Vec::new(),

‎src/test/compile-fail/deriving-span-Rand-enum-struct-variant.rs

-25
This file was deleted.

‎src/test/compile-fail/deriving-span-Rand-enum.rs

-25
This file was deleted.

‎src/test/compile-fail/deriving-span-Rand-struct.rs

-23
This file was deleted.

‎src/test/compile-fail/deriving-span-Rand-tuple-struct.rs

-23
This file was deleted.

‎src/test/compile-fail/lint-unused-extern-crate.rs

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#![deny(unused_extern_crates)]
1414
#![allow(unused_variables)]
15+
#![allow(deprecated)]
1516
#![feature(libc)]
1617
#![feature(collections)]
1718
#![feature(rand)]

‎src/test/compile-fail/macros-nonfatal-errors.rs

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#![feature(trace_macros, concat_idents)]
1616

1717
#[derive(Default, //~ ERROR
18-
Rand, //~ ERROR
1918
Zero)] //~ ERROR
2019
enum CantDeriveThose {}
2120

0 commit comments

Comments
 (0)