mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-29 17:05:41 +00:00
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:
commit
c3e1f77291
@ -114,8 +114,7 @@ traits = {
|
|||||||
'Encodable': (0, [], 0), # FIXME: quoting gives horrible spans
|
'Encodable': (0, [], 0), # FIXME: quoting gives horrible spans
|
||||||
}
|
}
|
||||||
|
|
||||||
for (trait, supers, errs) in [('Rand', [], 1),
|
for (trait, supers, errs) in [('Clone', [], 1),
|
||||||
('Clone', [], 1),
|
|
||||||
('PartialEq', [], 2),
|
('PartialEq', [], 2),
|
||||||
('PartialOrd', ['PartialEq'], 8),
|
('PartialOrd', ['PartialEq'], 8),
|
||||||
('Eq', ['PartialEq'], 1),
|
('Eq', ['PartialEq'], 1),
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#![feature(unicode)]
|
#![feature(unicode)]
|
||||||
#![feature(unsafe_destructor, slicing_syntax)]
|
#![feature(unsafe_destructor, slicing_syntax)]
|
||||||
#![cfg_attr(test, feature(test))]
|
#![cfg_attr(test, feature(test))]
|
||||||
|
#![cfg_attr(test, allow(deprecated))] // rand
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#![feature(int_uint)]
|
#![feature(int_uint)]
|
||||||
#![feature(unboxed_closures)]
|
#![feature(unboxed_closures)]
|
||||||
#![feature(unsafe_destructor, slicing_syntax)]
|
#![feature(unsafe_destructor, slicing_syntax)]
|
||||||
|
#![allow(deprecated)] // rand
|
||||||
|
|
||||||
extern crate core;
|
extern crate core;
|
||||||
extern crate test;
|
extern crate test;
|
||||||
|
@ -130,6 +130,7 @@ pub fn inflate_bytes_zlib(bytes: &[u8]) -> Option<Bytes> {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
#![allow(deprecated)]
|
||||||
use super::{inflate_bytes, deflate_bytes};
|
use super::{inflate_bytes, deflate_bytes};
|
||||||
use std::rand;
|
use std::rand;
|
||||||
use std::rand::Rng;
|
use std::rand::Rng;
|
||||||
|
@ -28,6 +28,10 @@
|
|||||||
#![feature(staged_api)]
|
#![feature(staged_api)]
|
||||||
#![staged_api]
|
#![staged_api]
|
||||||
#![feature(core)]
|
#![feature(core)]
|
||||||
|
#![deprecated(reason = "use the crates.io `rand` library instead",
|
||||||
|
since = "1.0.0-alpha")]
|
||||||
|
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate core;
|
extern crate core;
|
||||||
|
@ -528,6 +528,7 @@ static H256: [u32; 8] = [
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
#![allow(deprecated)]
|
||||||
extern crate rand;
|
extern crate rand;
|
||||||
|
|
||||||
use self::rand::Rng;
|
use self::rand::Rng;
|
||||||
|
@ -1593,6 +1593,7 @@ pub struct RandomState {
|
|||||||
impl RandomState {
|
impl RandomState {
|
||||||
/// Construct a new `RandomState` that is initialized with random keys.
|
/// Construct a new `RandomState` that is initialized with random keys.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[allow(deprecated)]
|
||||||
pub fn new() -> RandomState {
|
pub fn new() -> RandomState {
|
||||||
let mut r = rand::thread_rng();
|
let mut r = rand::thread_rng();
|
||||||
RandomState { k0: r.gen(), k1: r.gen() }
|
RandomState { k0: r.gen(), k1: r.gen() }
|
||||||
|
@ -140,7 +140,7 @@ extern crate core;
|
|||||||
#[macro_reexport(vec)]
|
#[macro_reexport(vec)]
|
||||||
extern crate "collections" as core_collections;
|
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 alloc;
|
||||||
extern crate unicode;
|
extern crate unicode;
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
|
@ -459,6 +459,7 @@ mod tests {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod bench {
|
mod bench {
|
||||||
|
#![allow(deprecated)] // rand
|
||||||
extern crate test;
|
extern crate test;
|
||||||
|
|
||||||
mod uint {
|
mod uint {
|
||||||
|
@ -822,6 +822,7 @@ fn access_string(access: FileAccess) -> &'static str {
|
|||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
#[allow(unused_mut)]
|
#[allow(unused_mut)]
|
||||||
|
#[allow(deprecated)] // rand
|
||||||
mod test {
|
mod test {
|
||||||
use prelude::v1::*;
|
use prelude::v1::*;
|
||||||
use old_io::{SeekSet, SeekCur, SeekEnd, Read, Open, ReadWrite, FileType};
|
use old_io::{SeekSet, SeekCur, SeekEnd, Read, Open, ReadWrite, FileType};
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
//! Temporary files and directories
|
//! Temporary files and directories
|
||||||
|
#![allow(deprecated)] // rand
|
||||||
|
|
||||||
use env;
|
use env;
|
||||||
use iter::{IteratorExt};
|
use iter::{IteratorExt};
|
||||||
|
@ -1422,6 +1422,8 @@ mod arch_consts {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
#![allow(deprecated)] // rand
|
||||||
|
|
||||||
use prelude::v1::*;
|
use prelude::v1::*;
|
||||||
|
|
||||||
use iter::repeat;
|
use iter::repeat;
|
||||||
|
@ -220,6 +220,9 @@
|
|||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
#![unstable(feature = "rand")]
|
#![unstable(feature = "rand")]
|
||||||
|
#![deprecated(reason = "use the crates.io `rand` library instead",
|
||||||
|
since = "1.0.0-alpha")]
|
||||||
|
#![allow(deprecated)]
|
||||||
|
|
||||||
use cell::RefCell;
|
use cell::RefCell;
|
||||||
use clone::Clone;
|
use clone::Clone;
|
||||||
|
@ -383,6 +383,8 @@ impl<'a, T> Drop for RwLockWriteGuard<'a, T> {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
#![allow(deprecated)] // rand
|
||||||
|
|
||||||
use prelude::v1::*;
|
use prelude::v1::*;
|
||||||
|
|
||||||
use rand::{self, Rng};
|
use rand::{self, Rng};
|
||||||
|
@ -24,6 +24,10 @@ pub fn expand_deriving_rand<F>(cx: &mut ExtCtxt,
|
|||||||
push: F) where
|
push: F) where
|
||||||
F: FnOnce(P<Item>),
|
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 {
|
let trait_def = TraitDef {
|
||||||
span: span,
|
span: span,
|
||||||
attributes: Vec::new(),
|
attributes: Vec::new(),
|
||||||
|
@ -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() {}
|
|
@ -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() {}
|
|
@ -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() {}
|
|
@ -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() {}
|
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#![deny(unused_extern_crates)]
|
#![deny(unused_extern_crates)]
|
||||||
#![allow(unused_variables)]
|
#![allow(unused_variables)]
|
||||||
|
#![allow(deprecated)]
|
||||||
#![feature(libc)]
|
#![feature(libc)]
|
||||||
#![feature(collections)]
|
#![feature(collections)]
|
||||||
#![feature(rand)]
|
#![feature(rand)]
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
#![feature(trace_macros, concat_idents)]
|
#![feature(trace_macros, concat_idents)]
|
||||||
|
|
||||||
#[derive(Default, //~ ERROR
|
#[derive(Default, //~ ERROR
|
||||||
Rand, //~ ERROR
|
|
||||||
Zero)] //~ ERROR
|
Zero)] //~ ERROR
|
||||||
enum CantDeriveThose {}
|
enum CantDeriveThose {}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user