Skip to content

Commit 9487f3d

Browse files
committed
---
yaml --- r: 42490 b: refs/heads/try c: 1e1707c h: refs/heads/master v: v3
1 parent 3c42381 commit 9487f3d

File tree

6 files changed

+36
-34
lines changed

6 files changed

+36
-34
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: 95d25ca47c0afe8c72bf16777ed266c4e033c54e
5+
refs/heads/try: 1e1707ccb867f1849d71fa64e6f984b60f3e350b
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 interesting in types that will require an item to
625+
// we are only interested 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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ 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+
}
8588
Some(_) | None => {
8689
// this really should not happen
8790
(fmt!("unknown scope: %d. Please report a bug.", node_id),

branches/try/src/libstd/bitv.rs

Lines changed: 5 additions & 32 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,7 +180,10 @@ impl BigBitv {
180180

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

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

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

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

571572
impl Bitv: ops::Index<uint,bool> {
@@ -953,34 +954,6 @@ mod tests {
953954
let bools = ~[false, false, true, false, false, true, true, false];
954955
assert from_bytes([0b00100110]).to_bools() == bools;
955956
}
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-
}
984957
}
985958

986959
//

branches/try/src/test/compile-fail/access-mode-in-closures.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
112
enum sty = ~[int];
213

314
fn unpack(_unpack: &fn(v: &sty) -> ~[int]) {}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main () {
12+
let mut _p: & int = & 4;
13+
_p = ~3; //~ ERROR illegal borrow: borrowed value does not live long enough
14+
//~^ NOTE ...but borrowed value is only valid for the statement
15+
}

0 commit comments

Comments
 (0)