Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate in-tree rand, std::rand and #[derive(Rand)]. #21892

Merged
merged 1 commit into from
Feb 4, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/etc/generate-deriving-span-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ def write_file(name, string):
'Encodable': (0, [], 0), # FIXME: quoting gives horrible spans
}

for (trait, supers, errs) in [('Rand', [], 1),
('Clone', [], 1),
for (trait, supers, errs) in [('Clone', [], 1),
('PartialEq', [], 2),
('PartialOrd', ['PartialEq'], 8),
('Eq', ['PartialEq'], 1),
Expand Down
1 change: 1 addition & 0 deletions src/libcollections/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#![feature(unicode)]
#![feature(unsafe_destructor, slicing_syntax)]
#![cfg_attr(test, feature(test))]
#![cfg_attr(test, allow(deprecated))] // rand

#![no_std]

Expand Down
1 change: 1 addition & 0 deletions src/libcoretest/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#![feature(int_uint)]
#![feature(unboxed_closures)]
#![feature(unsafe_destructor, slicing_syntax)]
#![allow(deprecated)] // rand

extern crate core;
extern crate test;
Expand Down
1 change: 1 addition & 0 deletions src/libflate/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ pub fn inflate_bytes_zlib(bytes: &[u8]) -> Option<Bytes> {

#[cfg(test)]
mod tests {
#![allow(deprecated)]
use super::{inflate_bytes, deflate_bytes};
use std::rand;
use std::rand::Rng;
Expand Down
4 changes: 4 additions & 0 deletions src/librand/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
#![feature(staged_api)]
#![staged_api]
#![feature(core)]
#![deprecated(reason = "use the crates.io `rand` library instead",
since = "1.0.0-alpha")]

#![allow(deprecated)]

#[macro_use]
extern crate core;
Expand Down
1 change: 1 addition & 0 deletions src/librustc_back/sha2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ static H256: [u32; 8] = [

#[cfg(test)]
mod tests {
#![allow(deprecated)]
extern crate rand;

use self::rand::Rng;
Expand Down
1 change: 1 addition & 0 deletions src/libstd/collections/hash/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1566,6 +1566,7 @@ pub struct RandomState {
impl RandomState {
/// Construct a new `RandomState` that is initialized with random keys.
#[inline]
#[allow(deprecated)]
pub fn new() -> RandomState {
let mut r = rand::thread_rng();
RandomState { k0: r.gen(), k1: r.gen() }
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ extern crate core;
#[macro_reexport(vec)]
extern crate "collections" as core_collections;

extern crate "rand" as core_rand;
#[allow(deprecated)] extern crate "rand" as core_rand;
extern crate alloc;
extern crate unicode;
extern crate libc;
Expand Down
1 change: 1 addition & 0 deletions src/libstd/num/strconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ mod tests {

#[cfg(test)]
mod bench {
#![allow(deprecated)] // rand
extern crate test;

mod uint {
Expand Down
1 change: 1 addition & 0 deletions src/libstd/old_io/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,7 @@ fn access_string(access: FileAccess) -> &'static str {
#[allow(unused_imports)]
#[allow(unused_variables)]
#[allow(unused_mut)]
#[allow(deprecated)] // rand
mod test {
use prelude::v1::*;
use old_io::{SeekSet, SeekCur, SeekEnd, Read, Open, ReadWrite, FileType};
Expand Down
1 change: 1 addition & 0 deletions src/libstd/old_io/tempfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

//! Temporary files and directories
#![allow(deprecated)] // rand

use old_io::{fs, IoError, IoErrorKind, IoResult};
use old_io;
Expand Down
2 changes: 2 additions & 0 deletions src/libstd/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1425,6 +1425,8 @@ mod arch_consts {

#[cfg(test)]
mod tests {
#![allow(deprecated)] // rand

use prelude::v1::*;

use iter::repeat;
Expand Down
3 changes: 3 additions & 0 deletions src/libstd/rand/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@
//! ```

#![unstable(feature = "rand")]
#![deprecated(reason = "use the crates.io `rand` library instead",
since = "1.0.0-alpha")]
#![allow(deprecated)]

use cell::RefCell;
use clone::Clone;
Expand Down
2 changes: 2 additions & 0 deletions src/libstd/sync/rwlock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ impl<'a, T> Drop for RwLockWriteGuard<'a, T> {

#[cfg(test)]
mod tests {
#![allow(deprecated)] // rand

use prelude::v1::*;

use rand::{self, Rng};
Expand Down
4 changes: 4 additions & 0 deletions src/libsyntax/ext/deriving/rand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ pub fn expand_deriving_rand<F>(cx: &mut ExtCtxt,
push: F) where
F: FnOnce(P<Item>),
{
cx.span_warn(span,
"`#[derive(Rand)]` is deprecated in favour of `#[derive_Rand]` from \
`rand_macros` on crates.io");

let trait_def = TraitDef {
span: span,
attributes: Vec::new(),
Expand Down
25 changes: 0 additions & 25 deletions src/test/compile-fail/deriving-span-Rand-enum-struct-variant.rs

This file was deleted.

25 changes: 0 additions & 25 deletions src/test/compile-fail/deriving-span-Rand-enum.rs

This file was deleted.

23 changes: 0 additions & 23 deletions src/test/compile-fail/deriving-span-Rand-struct.rs

This file was deleted.

23 changes: 0 additions & 23 deletions src/test/compile-fail/deriving-span-Rand-tuple-struct.rs

This file was deleted.

1 change: 1 addition & 0 deletions src/test/compile-fail/lint-unused-extern-crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#![deny(unused_extern_crates)]
#![allow(unused_variables)]
#![allow(deprecated)]
#![feature(libc)]
#![feature(collections)]
#![feature(rand)]
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/macros-nonfatal-errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#![feature(trace_macros, concat_idents)]

#[derive(Default, //~ ERROR
Rand, //~ ERROR
Zero)] //~ ERROR
enum CantDeriveThose {}

Expand Down