Skip to content

Mini Rollup #17742

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

Merged
merged 20 commits into from
Oct 3, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
5615ace
Include ChaCha pseudorandom generator
sneves Sep 19, 2014
06a6ba1
test: Don't depend on /bin/bash
alexcrichton Oct 3, 2014
7e22af3
syntax: Enable parsing of `const` globals
alexcrichton Oct 2, 2014
94bcd35
Set the `non_uppercase_statics` lint to warn by default
ftxqxd Sep 13, 2014
333592e
Update the `unused` lint group to include more lints
ftxqxd Sep 13, 2014
4504412
Improve the `non_snake_case` lint to give better suggestions
ftxqxd Sep 13, 2014
042cdee
Correct error message for invalid `ref`/`mut` bindings
ftxqxd Sep 13, 2014
073a1ab
Report trait/impl sig inconsistency before method/body inconsistency
ftxqxd Sep 13, 2014
f56c67b
Change rustc pretty-printing to print [T, ..n] instead of [T, .. n]
ftxqxd Sep 13, 2014
a667a69
Move the lint for the stability lints to the method name only
ftxqxd Sep 17, 2014
da7dcee
tests: remove old compile-fail test asserting the removal of `const`.
eddyb Oct 3, 2014
ef69388
Fix a race condition between remove_from_env and other io::process te…
eddyb Oct 3, 2014
7b6ecc0
travis: Fix for real this time
alexcrichton Oct 3, 2014
2a11f2b
rollup merge of #17215 : P1start/lints
alexcrichton Oct 3, 2014
61c4f6d
rollup merge of #17387 : sneves/master
alexcrichton Oct 3, 2014
79d0e82
rollup merge of #17729 : alexcrichton/issue-17718-start
alexcrichton Oct 3, 2014
8993a0a
rollup merge of #17730 : alexcrichton/snapshot
alexcrichton Oct 3, 2014
4b6733e
rollup merge of #17741 : alexcrichton/travis-again
alexcrichton Oct 3, 2014
48cdb55
rollup merge of #17739 : eddyb/fix-process-test
alexcrichton Oct 3, 2014
39f4bf7
Test fixes from the rollup
alexcrichton Oct 3, 2014
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
9 changes: 1 addition & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@
# downloads a rust/cargo snapshot, which we don't really want for building rust.
language: c

# Make sure we've got an up-to-date g++ compiler to get past the LLVM configure
# script.
install:
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt-get update -qq
- sudo apt-get install g++-4.7

# The test suite is in general way too stressful for travis, especially in
# terms of time limit and reliability. In the past we've tried to scale things
# back to only build the stage1 compiler and run a subset of tests, but this
Expand All @@ -18,7 +11,7 @@ install:
# As a result, we're just using travis to run `make tidy` now. It'll help
# everyone find out about their trailing spaces early on!
before_script:
- ./configure
- ./configure --llvm-root=path/to/nowhere
script:
- make tidy

Expand Down
2 changes: 1 addition & 1 deletion src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1412,7 +1412,7 @@ struct BitsNStrings<'a> {
mystring: &'a str
}

static bits_n_strings: BitsNStrings<'static> = BitsNStrings {
static BITS_N_STRINGS: BitsNStrings<'static> = BitsNStrings {
mybits: BITS,
mystring: STRING
};
Expand Down
63 changes: 33 additions & 30 deletions src/libnum/bigint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,12 @@ pub mod BigDigit {
use super::DoubleBigDigit;

// `DoubleBigDigit` size dependent
#[allow(non_uppercase_statics)]
pub static bits: uint = 32;

#[allow(non_uppercase_statics)]
pub static base: DoubleBigDigit = 1 << bits;
#[allow(non_uppercase_statics)]
static lo_mask: DoubleBigDigit = (-1 as DoubleBigDigit) >> bits;

#[inline]
Expand Down Expand Up @@ -1841,7 +1844,7 @@ mod biguint_tests {
BigInt::from_biguint(Plus, BigUint::new(vec!(1,2,3))));
}

static sum_triples: &'static [(&'static [BigDigit],
static SUM_TRIPLES: &'static [(&'static [BigDigit],
&'static [BigDigit],
&'static [BigDigit])] = &[
(&[], &[], &[]),
Expand All @@ -1857,7 +1860,7 @@ mod biguint_tests {

#[test]
fn test_add() {
for elm in sum_triples.iter() {
for elm in SUM_TRIPLES.iter() {
let (a_vec, b_vec, c_vec) = *elm;
let a = BigUint::from_slice(a_vec);
let b = BigUint::from_slice(b_vec);
Expand All @@ -1870,7 +1873,7 @@ mod biguint_tests {

#[test]
fn test_sub() {
for elm in sum_triples.iter() {
for elm in SUM_TRIPLES.iter() {
let (a_vec, b_vec, c_vec) = *elm;
let a = BigUint::from_slice(a_vec);
let b = BigUint::from_slice(b_vec);
Expand All @@ -1888,7 +1891,7 @@ mod biguint_tests {
a - b;
}

static mul_triples: &'static [(&'static [BigDigit],
static MUL_TRIPLES: &'static [(&'static [BigDigit],
&'static [BigDigit],
&'static [BigDigit])] = &[
(&[], &[], &[]),
Expand All @@ -1914,7 +1917,7 @@ mod biguint_tests {
(&[ 0, 0, 1], &[ 0, 0, 0, 1], &[0, 0, 0, 0, 0, 1])
];

static div_rem_quadruples: &'static [(&'static [BigDigit],
static DIV_REM_QUADRUPLES: &'static [(&'static [BigDigit],
&'static [BigDigit],
&'static [BigDigit],
&'static [BigDigit])]
Expand All @@ -1928,7 +1931,7 @@ mod biguint_tests {

#[test]
fn test_mul() {
for elm in mul_triples.iter() {
for elm in MUL_TRIPLES.iter() {
let (a_vec, b_vec, c_vec) = *elm;
let a = BigUint::from_slice(a_vec);
let b = BigUint::from_slice(b_vec);
Expand All @@ -1938,7 +1941,7 @@ mod biguint_tests {
assert!(b * a == c);
}

for elm in div_rem_quadruples.iter() {
for elm in DIV_REM_QUADRUPLES.iter() {
let (a_vec, b_vec, c_vec, d_vec) = *elm;
let a = BigUint::from_slice(a_vec);
let b = BigUint::from_slice(b_vec);
Expand All @@ -1952,7 +1955,7 @@ mod biguint_tests {

#[test]
fn test_div_rem() {
for elm in mul_triples.iter() {
for elm in MUL_TRIPLES.iter() {
let (a_vec, b_vec, c_vec) = *elm;
let a = BigUint::from_slice(a_vec);
let b = BigUint::from_slice(b_vec);
Expand All @@ -1966,7 +1969,7 @@ mod biguint_tests {
}
}

for elm in div_rem_quadruples.iter() {
for elm in DIV_REM_QUADRUPLES.iter() {
let (a_vec, b_vec, c_vec, d_vec) = *elm;
let a = BigUint::from_slice(a_vec);
let b = BigUint::from_slice(b_vec);
Expand All @@ -1979,7 +1982,7 @@ mod biguint_tests {

#[test]
fn test_checked_add() {
for elm in sum_triples.iter() {
for elm in SUM_TRIPLES.iter() {
let (a_vec, b_vec, c_vec) = *elm;
let a = BigUint::from_slice(a_vec);
let b = BigUint::from_slice(b_vec);
Expand All @@ -1992,7 +1995,7 @@ mod biguint_tests {

#[test]
fn test_checked_sub() {
for elm in sum_triples.iter() {
for elm in SUM_TRIPLES.iter() {
let (a_vec, b_vec, c_vec) = *elm;
let a = BigUint::from_slice(a_vec);
let b = BigUint::from_slice(b_vec);
Expand All @@ -2012,7 +2015,7 @@ mod biguint_tests {

#[test]
fn test_checked_mul() {
for elm in mul_triples.iter() {
for elm in MUL_TRIPLES.iter() {
let (a_vec, b_vec, c_vec) = *elm;
let a = BigUint::from_slice(a_vec);
let b = BigUint::from_slice(b_vec);
Expand All @@ -2022,7 +2025,7 @@ mod biguint_tests {
assert!(b.checked_mul(&a).unwrap() == c);
}

for elm in div_rem_quadruples.iter() {
for elm in DIV_REM_QUADRUPLES.iter() {
let (a_vec, b_vec, c_vec, d_vec) = *elm;
let a = BigUint::from_slice(a_vec);
let b = BigUint::from_slice(b_vec);
Expand All @@ -2036,7 +2039,7 @@ mod biguint_tests {

#[test]
fn test_checked_div() {
for elm in mul_triples.iter() {
for elm in MUL_TRIPLES.iter() {
let (a_vec, b_vec, c_vec) = *elm;
let a = BigUint::from_slice(a_vec);
let b = BigUint::from_slice(b_vec);
Expand Down Expand Up @@ -2440,7 +2443,7 @@ mod bigint_tests {
assert_eq!(negative.to_biguint(), None);
}

static sum_triples: &'static [(&'static [BigDigit],
static SUM_TRIPLES: &'static [(&'static [BigDigit],
&'static [BigDigit],
&'static [BigDigit])] = &[
(&[], &[], &[]),
Expand All @@ -2456,7 +2459,7 @@ mod bigint_tests {

#[test]
fn test_add() {
for elm in sum_triples.iter() {
for elm in SUM_TRIPLES.iter() {
let (a_vec, b_vec, c_vec) = *elm;
let a = BigInt::from_slice(Plus, a_vec);
let b = BigInt::from_slice(Plus, b_vec);
Expand All @@ -2475,7 +2478,7 @@ mod bigint_tests {

#[test]
fn test_sub() {
for elm in sum_triples.iter() {
for elm in SUM_TRIPLES.iter() {
let (a_vec, b_vec, c_vec) = *elm;
let a = BigInt::from_slice(Plus, a_vec);
let b = BigInt::from_slice(Plus, b_vec);
Expand All @@ -2492,7 +2495,7 @@ mod bigint_tests {
}
}

static mul_triples: &'static [(&'static [BigDigit],
static MUL_TRIPLES: &'static [(&'static [BigDigit],
&'static [BigDigit],
&'static [BigDigit])] = &[
(&[], &[], &[]),
Expand All @@ -2518,7 +2521,7 @@ mod bigint_tests {
(&[ 0, 0, 1], &[ 0, 0, 0, 1], &[0, 0, 0, 0, 0, 1])
];

static div_rem_quadruples: &'static [(&'static [BigDigit],
static DIV_REM_QUADRUPLES: &'static [(&'static [BigDigit],
&'static [BigDigit],
&'static [BigDigit],
&'static [BigDigit])]
Expand All @@ -2532,7 +2535,7 @@ mod bigint_tests {

#[test]
fn test_mul() {
for elm in mul_triples.iter() {
for elm in MUL_TRIPLES.iter() {
let (a_vec, b_vec, c_vec) = *elm;
let a = BigInt::from_slice(Plus, a_vec);
let b = BigInt::from_slice(Plus, b_vec);
Expand All @@ -2545,7 +2548,7 @@ mod bigint_tests {
assert!((-b) * a == -c);
}

for elm in div_rem_quadruples.iter() {
for elm in DIV_REM_QUADRUPLES.iter() {
let (a_vec, b_vec, c_vec, d_vec) = *elm;
let a = BigInt::from_slice(Plus, a_vec);
let b = BigInt::from_slice(Plus, b_vec);
Expand Down Expand Up @@ -2584,7 +2587,7 @@ mod bigint_tests {
}
}

for elm in mul_triples.iter() {
for elm in MUL_TRIPLES.iter() {
let (a_vec, b_vec, c_vec) = *elm;
let a = BigInt::from_slice(Plus, a_vec);
let b = BigInt::from_slice(Plus, b_vec);
Expand All @@ -2594,7 +2597,7 @@ mod bigint_tests {
if !b.is_zero() { check(&c, &b, &a, &Zero::zero()); }
}

for elm in div_rem_quadruples.iter() {
for elm in DIV_REM_QUADRUPLES.iter() {
let (a_vec, b_vec, c_vec, d_vec) = *elm;
let a = BigInt::from_slice(Plus, a_vec);
let b = BigInt::from_slice(Plus, b_vec);
Expand Down Expand Up @@ -2627,7 +2630,7 @@ mod bigint_tests {
check_sub(&a.neg(), b, &q.neg(), &r.neg());
check_sub(&a.neg(), &b.neg(), q, &r.neg());
}
for elm in mul_triples.iter() {
for elm in MUL_TRIPLES.iter() {
let (a_vec, b_vec, c_vec) = *elm;
let a = BigInt::from_slice(Plus, a_vec);
let b = BigInt::from_slice(Plus, b_vec);
Expand All @@ -2637,7 +2640,7 @@ mod bigint_tests {
if !b.is_zero() { check(&c, &b, &a, &Zero::zero()); }
}

for elm in div_rem_quadruples.iter() {
for elm in DIV_REM_QUADRUPLES.iter() {
let (a_vec, b_vec, c_vec, d_vec) = *elm;
let a = BigInt::from_slice(Plus, a_vec);
let b = BigInt::from_slice(Plus, b_vec);
Expand All @@ -2652,7 +2655,7 @@ mod bigint_tests {

#[test]
fn test_checked_add() {
for elm in sum_triples.iter() {
for elm in SUM_TRIPLES.iter() {
let (a_vec, b_vec, c_vec) = *elm;
let a = BigInt::from_slice(Plus, a_vec);
let b = BigInt::from_slice(Plus, b_vec);
Expand All @@ -2671,7 +2674,7 @@ mod bigint_tests {

#[test]
fn test_checked_sub() {
for elm in sum_triples.iter() {
for elm in SUM_TRIPLES.iter() {
let (a_vec, b_vec, c_vec) = *elm;
let a = BigInt::from_slice(Plus, a_vec);
let b = BigInt::from_slice(Plus, b_vec);
Expand All @@ -2690,7 +2693,7 @@ mod bigint_tests {

#[test]
fn test_checked_mul() {
for elm in mul_triples.iter() {
for elm in MUL_TRIPLES.iter() {
let (a_vec, b_vec, c_vec) = *elm;
let a = BigInt::from_slice(Plus, a_vec);
let b = BigInt::from_slice(Plus, b_vec);
Expand All @@ -2703,7 +2706,7 @@ mod bigint_tests {
assert!((-b).checked_mul(&a).unwrap() == -c);
}

for elm in div_rem_quadruples.iter() {
for elm in DIV_REM_QUADRUPLES.iter() {
let (a_vec, b_vec, c_vec, d_vec) = *elm;
let a = BigInt::from_slice(Plus, a_vec);
let b = BigInt::from_slice(Plus, b_vec);
Expand All @@ -2716,7 +2719,7 @@ mod bigint_tests {
}
#[test]
fn test_checked_div() {
for elm in mul_triples.iter() {
for elm in MUL_TRIPLES.iter() {
let (a_vec, b_vec, c_vec) = *elm;
let a = BigInt::from_slice(Plus, a_vec);
let b = BigInt::from_slice(Plus, b_vec);
Expand Down
3 changes: 3 additions & 0 deletions src/libnum/rational.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,10 +406,13 @@ mod test {
pub static _2: Rational = Ratio { numer: 2, denom: 1};
pub static _1_2: Rational = Ratio { numer: 1, denom: 2};
pub static _3_2: Rational = Ratio { numer: 3, denom: 2};
#[allow(non_uppercase_statics)]
pub static _neg1_2: Rational = Ratio { numer: -1, denom: 2};
pub static _1_3: Rational = Ratio { numer: 1, denom: 3};
#[allow(non_uppercase_statics)]
pub static _neg1_3: Rational = Ratio { numer: -1, denom: 3};
pub static _2_3: Rational = Ratio { numer: 2, denom: 3};
#[allow(non_uppercase_statics)]
pub static _neg2_3: Rational = Ratio { numer: -2, denom: 3};

pub fn to_big(n: Rational) -> BigRational {
Expand Down
Loading