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]
This commit is contained in:
bors 2015-02-04 08:47:27 +00:00
commit c3e1f77291
21 changed files with 26 additions and 100 deletions

View File

@ -114,8 +114,7 @@ traits = {
'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),

View File

@ -32,6 +32,7 @@
#![feature(unicode)]
#![feature(unsafe_destructor, slicing_syntax)]
#![cfg_attr(test, feature(test))]
#![cfg_attr(test, allow(deprecated))] // rand
#![no_std]

View File

@ -12,6 +12,7 @@
#![feature(int_uint)]
#![feature(unboxed_closures)]
#![feature(unsafe_destructor, slicing_syntax)]
#![allow(deprecated)] // rand
extern crate core;
extern crate test;

View File

@ -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;

View File

@ -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;

View File

@ -528,6 +528,7 @@ static H256: [u32; 8] = [
#[cfg(test)]
mod tests {
#![allow(deprecated)]
extern crate rand;
use self::rand::Rng;

View File

@ -1593,6 +1593,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() }

View File

@ -140,7 +140,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;

View File

@ -459,6 +459,7 @@ mod tests {
#[cfg(test)]
mod bench {
#![allow(deprecated)] // rand
extern crate test;
mod uint {

View File

@ -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};

View File

@ -9,6 +9,7 @@
// except according to those terms.
//! Temporary files and directories
#![allow(deprecated)] // rand
use env;
use iter::{IteratorExt};

View File

@ -1422,6 +1422,8 @@ mod arch_consts {
#[cfg(test)]
mod tests {
#![allow(deprecated)] // rand
use prelude::v1::*;
use iter::repeat;

View File

@ -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;

View File

@ -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};

View File

@ -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(),

View File

@ -1,25 +0,0 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
struct Error;
#[derive(Rand)]
enum Enum {
A {
x: Error //~ ERROR
}
}
fn main() {}

View File

@ -1,25 +0,0 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
struct Error;
#[derive(Rand)]
enum Enum {
A(
Error //~ ERROR
)
}
fn main() {}

View File

@ -1,23 +0,0 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
struct Error;
#[derive(Rand)]
struct Struct {
x: Error //~ ERROR
}
fn main() {}

View File

@ -1,23 +0,0 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
extern crate rand;
struct Error;
#[derive(Rand)]
struct Struct(
Error //~ ERROR
);
fn main() {}

View File

@ -12,6 +12,7 @@
#![deny(unused_extern_crates)]
#![allow(unused_variables)]
#![allow(deprecated)]
#![feature(libc)]
#![feature(collections)]
#![feature(rand)]

View File

@ -15,7 +15,6 @@
#![feature(trace_macros, concat_idents)]
#[derive(Default, //~ ERROR
Rand, //~ ERROR
Zero)] //~ ERROR
enum CantDeriveThose {}