Skip to content

Commit 5489965

Browse files
committed
---
yaml --- r: 144949 b: refs/heads/try2 c: ad43613 h: refs/heads/master i: 144947: b98c0a3 v: v3
1 parent 24b7cb9 commit 5489965

File tree

21 files changed

+1499
-519
lines changed

21 files changed

+1499
-519
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 5bb8aefed6994303aca9180958fcbd077c219cd1
8+
refs/heads/try2: ad43613346a5702b84e3a32b39395258e32b1037
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libextra/num/bigint.rs

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use std::cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Greater};
2323
use std::int;
2424
use std::num;
2525
use std::num::{IntConvertible, Zero, One, ToStrRadix, FromStrRadix, Orderable};
26-
use std::rand::{Rng, RngUtil};
2726
use std::str;
2827
use std::uint;
2928
use std::vec;
@@ -1089,53 +1088,6 @@ impl FromStrRadix for BigInt {
10891088
}
10901089
}
10911090
1092-
trait RandBigInt {
1093-
/// Generate a random BigUint of the given bit size.
1094-
fn gen_biguint(&mut self, bit_size: uint) -> BigUint;
1095-
1096-
/// Generate a random BigInt of the given bit size.
1097-
fn gen_bigint(&mut self, bit_size: uint) -> BigInt;
1098-
}
1099-
1100-
impl<R: Rng> RandBigInt for R {
1101-
/// Generate a random BigUint of the given bit size.
1102-
fn gen_biguint(&mut self, bit_size: uint) -> BigUint {
1103-
let (digits, rem) = bit_size.div_rem(&BigDigit::bits);
1104-
let mut data = vec::with_capacity(digits+1);
1105-
for _ in range(0, digits) {
1106-
data.push(self.gen());
1107-
}
1108-
if rem > 0 {
1109-
let final_digit: BigDigit = self.gen();
1110-
data.push(final_digit >> (BigDigit::bits - rem));
1111-
}
1112-
return BigUint::new(data);
1113-
}
1114-
1115-
/// Generate a random BigInt of the given bit size.
1116-
fn gen_bigint(&mut self, bit_size: uint) -> BigInt {
1117-
// Generate a random BigUint...
1118-
let biguint = self.gen_biguint(bit_size);
1119-
// ...and then randomly assign it a Sign...
1120-
let sign = if biguint.is_zero() {
1121-
// ...except that if the BigUint is zero, we need to try
1122-
// again with probability 0.5. This is because otherwise,
1123-
// the probability of generating a zero BigInt would be
1124-
// double that of any other number.
1125-
if self.gen() {
1126-
return self.gen_bigint(bit_size);
1127-
} else {
1128-
Zero
1129-
}
1130-
} else if self.gen() {
1131-
Plus
1132-
} else {
1133-
Minus
1134-
};
1135-
return BigInt::from_biguint(sign, biguint);
1136-
}
1137-
}
1138-
11391091
impl BigInt {
11401092
/// Creates and initializes an BigInt.
11411093
#[inline]
@@ -1197,7 +1149,6 @@ mod biguint_tests {
11971149
use std::cmp::{Less, Equal, Greater};
11981150
use std::int;
11991151
use std::num::{IntConvertible, Zero, One, FromStrRadix};
1200-
use std::rand::{task_rng};
12011152
use std::str;
12021153
use std::uint;
12031154
use std::vec;
@@ -1705,13 +1656,6 @@ mod biguint_tests {
17051656
check(20, "2432902008176640000");
17061657
check(30, "265252859812191058636308480000000");
17071658
}
1708-
1709-
#[test]
1710-
fn test_rand() {
1711-
let mut rng = task_rng();
1712-
let _n: BigUint = rng.gen_biguint(137);
1713-
assert!(rng.gen_biguint(0).is_zero());
1714-
}
17151659
}
17161660

17171661
#[cfg(test)]
@@ -1721,7 +1665,6 @@ mod bigint_tests {
17211665
use std::cmp::{Less, Equal, Greater};
17221666
use std::int;
17231667
use std::num::{IntConvertible, Zero, One, FromStrRadix};
1724-
use std::rand::{task_rng};
17251668
use std::uint;
17261669

17271670
#[test]
@@ -2142,13 +2085,6 @@ mod bigint_tests {
21422085
let zero: BigInt = Zero::zero();
21432086
assert_eq!(-zero, zero);
21442087
}
2145-
2146-
#[test]
2147-
fn test_rand() {
2148-
let mut rng = task_rng();
2149-
let _n: BigInt = rng.gen_bigint(137);
2150-
assert!(rng.gen_bigint(0).is_zero());
2151-
}
21522088
}
21532089

21542090
#[cfg(test)]

branches/try2/src/librustc/middle/effect.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,8 @@ impl Visitor<()> for EffectCheckVisitor {
102102
fn visit_block(&mut self, block:&Block, _:()) {
103103

104104
let old_unsafe_context = self.context.unsafe_context;
105-
let is_unsafe = match block.rules {
106-
ast::UnsafeBlock(*) => true, ast::DefaultBlock => false
107-
};
108-
if is_unsafe && self.context.unsafe_context == SafeContext {
105+
if block.rules == ast::UnsafeBlock &&
106+
self.context.unsafe_context == SafeContext {
109107
self.context.unsafe_context = UnsafeBlock(block.id)
110108
}
111109

branches/try2/src/librustc/middle/lint.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,11 +1131,8 @@ impl Visitor<@mut Context> for UnusedUnsafeLintVisitor {
11311131
fn visit_expr(&mut self, e:@ast::Expr, cx:@mut Context) {
11321132

11331133
match e.node {
1134-
// Don't warn about generated blocks, that'll just pollute the
1135-
// output.
1136-
ast::ExprBlock(ref blk) => {
1137-
if blk.rules == ast::UnsafeBlock(ast::UserProvided) &&
1138-
!cx.tcx.used_unsafe.contains(&blk.id) {
1134+
ast::ExprBlock(ref blk) if blk.rules == ast::UnsafeBlock => {
1135+
if !cx.tcx.used_unsafe.contains(&blk.id) {
11391136
cx.span_lint(unused_unsafe, blk.span,
11401137
"unnecessary `unsafe` block");
11411138
}

branches/try2/src/librustc/middle/ty.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4266,7 +4266,8 @@ pub fn is_binopable(cx: ctxt, ty: t, op: ast::BinOp) -> bool {
42664266
static tycat_char: int = 2;
42674267
static tycat_int: int = 3;
42684268
static tycat_float: int = 4;
4269-
static tycat_bot: int = 5;
4269+
static tycat_struct: int = 5;
4270+
static tycat_bot: int = 6;
42704271

42714272
static opcat_add: int = 0;
42724273
static opcat_sub: int = 1;
@@ -4309,6 +4310,7 @@ pub fn is_binopable(cx: ctxt, ty: t, op: ast::BinOp) -> bool {
43094310
ty_bool => tycat_bool,
43104311
ty_int(_) | ty_uint(_) | ty_infer(IntVar(_)) => tycat_int,
43114312
ty_float(_) | ty_infer(FloatVar(_)) => tycat_float,
4313+
ty_tup(_) | ty_enum(_, _) => tycat_struct,
43124314
ty_bot => tycat_bot,
43134315
_ => tycat_other
43144316
}
@@ -4324,7 +4326,8 @@ pub fn is_binopable(cx: ctxt, ty: t, op: ast::BinOp) -> bool {
43244326
/*char*/ [f, f, f, f, t, t, f, f],
43254327
/*int*/ [t, t, t, t, t, t, t, f],
43264328
/*float*/ [t, t, t, f, t, t, f, f],
4327-
/*bot*/ [t, t, t, t, f, f, t, t]];
4329+
/*bot*/ [f, f, f, f, f, f, f, f],
4330+
/*struct*/ [t, t, t, t, f, f, t, t]];
43284331

43294332
return tbl[tycat(cx, ty)][opcat(op)];
43304333
}

branches/try2/src/librustc/middle/typeck/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ impl PurityState {
200200

201201
purity => {
202202
let (purity, def) = match blk.rules {
203-
ast::UnsafeBlock(*) => (ast::unsafe_fn, blk.id),
203+
ast::UnsafeBlock => (ast::unsafe_fn, blk.id),
204204
ast::DefaultBlock => (purity, self.def),
205205
};
206206
PurityState{ def: def,

branches/try2/src/librustpkg/api.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ pub fn default_context(p: Path) -> BuildContext {
2929
pub fn new_default_context(c: workcache::Context, p: Path) -> BuildContext {
3030
BuildContext {
3131
context: Context {
32+
cfgs: ~[],
33+
rustc_flags: RustcFlags::default(),
3234
use_rust_path_hack: false,
3335
sysroot: p
3436
},
@@ -44,7 +46,6 @@ fn binary_is_fresh(path: &str, in_hash: &str) -> bool {
4446
in_hash == digest_only_date(&Path(path))
4547
}
4648

47-
4849
pub fn new_workcache_context(p: &Path) -> workcache::Context {
4950
let db_file = p.push("rustpkg_db.json"); // ??? probably wrong
5051
debug!("Workcache database file: %s", db_file.to_str());

0 commit comments

Comments
 (0)