Skip to content

Commit 3c42381

Browse files
committed
---
yaml --- r: 42489 b: refs/heads/try c: 95d25ca h: refs/heads/master i: 42487: 75b0f36 v: v3
1 parent fc4623b commit 3c42381

File tree

5 files changed

+34
-25
lines changed

5 files changed

+34
-25
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 19dfec2aaf746535de1521f68421f9980dbf25de
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
5-
refs/heads/try: 96b4f436753ac40211035b533f0e0c88858ff72d
5+
refs/heads/try: 95d25ca47c0afe8c72bf16777ed266c4e033c54e
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278

branches/try/src/librustc/middle/region.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ fn determine_rp_in_ty(ty: @ast::Ty,
622622
&&cx: determine_rp_ctxt,
623623
visitor: visit::vt<determine_rp_ctxt>) {
624624

625-
// we are only interested in types that will require an item to
625+
// we are only interesting in types that will require an item to
626626
// be region-parameterized. if cx.item_id is zero, then this type
627627
// is not a member of a type defn nor is it a constitutent of an
628628
// impl etc. So we can ignore it and its components.

branches/try/src/librustc/util/ppaux.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,6 @@ fn explain_region_and_span(cx: ctxt, region: ty::Region)
8282
_ => explain_span(cx, "expression", expr.span)
8383
}
8484
}
85-
Some(ast_map::node_stmt(stmt)) => {
86-
explain_span(cx, "statement", stmt.span)
87-
}
8885
Some(_) | None => {
8986
// this really should not happen
9087
(fmt!("unknown scope: %d. Please report a bug.", node_id),

branches/try/src/libstd/bitv.rs

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl SmallBitv {
5959

6060
#[inline(always)]
6161
fn difference(s: &SmallBitv, nbits: uint) -> bool {
62-
self.bits_op(s.bits, nbits, |u1, u2| u1 ^ u2)
62+
self.bits_op(s.bits, nbits, |u1, u2| u1 & !u2)
6363
}
6464

6565
#[inline(always)]
@@ -180,10 +180,7 @@ impl BigBitv {
180180

181181
#[inline(always)]
182182
fn difference(b: &BigBitv, nbits: uint) -> bool {
183-
self.invert();
184-
let b = self.intersect(b, nbits);
185-
self.invert();
186-
b
183+
self.process(b, nbits, difference)
187184
}
188185

189186
#[inline(always)]
@@ -567,6 +564,8 @@ pure fn lor(w0: uint, w1: uint) -> uint { return w0 | w1; }
567564

568565
pure fn land(w0: uint, w1: uint) -> uint { return w0 & w1; }
569566

567+
pure fn difference(w0: uint, w1: uint) -> uint { return w0 & !w1; }
568+
570569
pure fn right(_w0: uint, w1: uint) -> uint { return w1; }
571570

572571
impl Bitv: ops::Index<uint,bool> {
@@ -954,6 +953,34 @@ mod tests {
954953
let bools = ~[false, false, true, false, false, true, true, false];
955954
assert from_bytes([0b00100110]).to_bools() == bools;
956955
}
956+
957+
#[test]
958+
fn test_small_difference() {
959+
let b1 = Bitv(3, false);
960+
let b2 = Bitv(3, false);
961+
b1.set(0, true);
962+
b1.set(1, true);
963+
b2.set(1, true);
964+
b2.set(2, true);
965+
assert b1.difference(&b2);
966+
assert b1[0];
967+
assert !b1[1];
968+
assert !b1[2];
969+
}
970+
971+
#[test]
972+
fn test_big_difference() {
973+
let b1 = Bitv(100, false);
974+
let b2 = Bitv(100, false);
975+
b1.set(0, true);
976+
b1.set(40, true);
977+
b2.set(40, true);
978+
b2.set(80, true);
979+
assert b1.difference(&b2);
980+
assert b1[0];
981+
assert !b1[40];
982+
assert !b1[80];
983+
}
957984
}
958985

959986
//

branches/try/src/test/compile-fail/issue-4500.rs

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)