Update to rust master
This commit is contained in:
parent
0811c72bac
commit
e2f0b0d327
|
@ -15,3 +15,4 @@ rational, and complex types.
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rustc-serialize = "0.2"
|
rustc-serialize = "0.2"
|
||||||
|
rand = "0.1"
|
||||||
|
|
|
@ -41,9 +41,10 @@
|
||||||
//! It's easy to generate large random numbers:
|
//! It's easy to generate large random numbers:
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! # #![allow(unstable)]
|
//! extern crate rand;
|
||||||
|
//! extern crate num;
|
||||||
|
//! # fn main() {
|
||||||
//! use num::bigint::{ToBigInt, RandBigInt};
|
//! use num::bigint::{ToBigInt, RandBigInt};
|
||||||
//! use std::rand;
|
|
||||||
//!
|
//!
|
||||||
//! let mut rng = rand::thread_rng();
|
//! let mut rng = rand::thread_rng();
|
||||||
//! let a = rng.gen_bigint(1000);
|
//! let a = rng.gen_bigint(1000);
|
||||||
|
@ -54,6 +55,7 @@
|
||||||
//!
|
//!
|
||||||
//! // Probably an even larger number.
|
//! // Probably an even larger number.
|
||||||
//! println!("{}", a * b);
|
//! println!("{}", a * b);
|
||||||
|
//! # }
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
extern crate "rustc-serialize" as rustc_serialize;
|
extern crate "rustc-serialize" as rustc_serialize;
|
||||||
|
@ -67,12 +69,12 @@ use std::error::{Error, FromError};
|
||||||
use std::iter::repeat;
|
use std::iter::repeat;
|
||||||
use std::num::{Int, ToPrimitive, FromPrimitive, FromStrRadix};
|
use std::num::{Int, ToPrimitive, FromPrimitive, FromStrRadix};
|
||||||
use std::ops::{Add, BitAnd, BitOr, BitXor, Div, Mul, Neg, Rem, Shl, Shr, Sub};
|
use std::ops::{Add, BitAnd, BitOr, BitXor, Div, Mul, Neg, Rem, Shl, Shr, Sub};
|
||||||
use std::rand::Rng;
|
|
||||||
use std::str::{self, FromStr};
|
use std::str::{self, FromStr};
|
||||||
use std::{cmp, fmt, hash, mem};
|
use std::{cmp, fmt, hash, mem};
|
||||||
use std::cmp::Ordering::{self, Less, Greater, Equal};
|
use std::cmp::Ordering::{self, Less, Greater, Equal};
|
||||||
use std::{i64, u64};
|
use std::{i64, u64};
|
||||||
|
|
||||||
|
use rand::Rng;
|
||||||
use rustc_serialize::hex::ToHex;
|
use rustc_serialize::hex::ToHex;
|
||||||
|
|
||||||
use {Num, Unsigned, CheckedAdd, CheckedSub, CheckedMul, CheckedDiv, Signed, Zero, One};
|
use {Num, Unsigned, CheckedAdd, CheckedSub, CheckedMul, CheckedDiv, Signed, Zero, One};
|
||||||
|
@ -1785,10 +1787,10 @@ mod biguint_tests {
|
||||||
use std::iter::repeat;
|
use std::iter::repeat;
|
||||||
use std::num::FromStrRadix;
|
use std::num::FromStrRadix;
|
||||||
use std::num::{ToPrimitive, FromPrimitive};
|
use std::num::{ToPrimitive, FromPrimitive};
|
||||||
use std::rand::thread_rng;
|
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::u64;
|
use std::u64;
|
||||||
|
|
||||||
|
use rand::thread_rng;
|
||||||
use {Zero, One, CheckedAdd, CheckedSub, CheckedMul, CheckedDiv};
|
use {Zero, One, CheckedAdd, CheckedSub, CheckedMul, CheckedDiv};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -2713,10 +2715,11 @@ mod bigint_tests {
|
||||||
use std::iter::repeat;
|
use std::iter::repeat;
|
||||||
use std::num::FromStrRadix;
|
use std::num::FromStrRadix;
|
||||||
use std::num::{ToPrimitive, FromPrimitive};
|
use std::num::{ToPrimitive, FromPrimitive};
|
||||||
use std::rand::thread_rng;
|
|
||||||
use std::u64;
|
use std::u64;
|
||||||
use std::ops::{Neg};
|
use std::ops::{Neg};
|
||||||
|
|
||||||
|
use rand::thread_rng;
|
||||||
|
|
||||||
use {Zero, One, Signed};
|
use {Zero, One, Signed};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
//!
|
//!
|
||||||
//! [newt]: https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method
|
//! [newt]: https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method
|
||||||
|
|
||||||
#![feature(slicing_syntax, collections, core, hash, rand, std_misc)]
|
#![feature(slicing_syntax, collections, core, hash, std_misc)]
|
||||||
#![cfg_attr(test, deny(warnings))]
|
#![cfg_attr(test, deny(warnings))]
|
||||||
#![cfg_attr(test, feature(test))]
|
#![cfg_attr(test, feature(test))]
|
||||||
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||||
|
@ -54,6 +54,7 @@
|
||||||
|
|
||||||
extern crate "rustc-serialize" as rustc_serialize;
|
extern crate "rustc-serialize" as rustc_serialize;
|
||||||
extern crate core;
|
extern crate core;
|
||||||
|
extern crate rand;
|
||||||
|
|
||||||
pub use bigint::{BigInt, BigUint};
|
pub use bigint::{BigInt, BigUint};
|
||||||
pub use rational::{Rational, BigRational};
|
pub use rational::{Rational, BigRational};
|
||||||
|
|
Loading…
Reference in New Issue