Skip to content

Commit c74797f

Browse files
committed
---
yaml --- r: 22498 b: refs/heads/master c: 90e435e h: refs/heads/master v: v3
1 parent 0aefe57 commit c74797f

29 files changed

+88
-83
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 1fe0d8d7d70c78ea69647f765dd1bb780b5e6d86
2+
refs/heads/master: 90e435e8082105f86f45a11186450ffb50653ffd
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be

trunk/src/libsyntax/parse/parser.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -420,15 +420,20 @@ class parser {
420420
}
421421
}
422422

423-
// Parses something like "&x." (note the trailing dot)
424-
fn parse_region_dot() -> @region {
423+
// Parses something like "&x/" (note the trailing slash)
424+
fn parse_region_with_sep() -> @region {
425425
let name =
426426
alt copy self.token {
427-
token::IDENT(sid, _) if self.look_ahead(1u) == token::DOT {
428-
self.bump(); self.bump();
429-
some(self.get_str(sid))
427+
token::IDENT(sid, _) => {
428+
if self.look_ahead(1u) == token::DOT || // backwards compat
429+
self.look_ahead(1u) == token::BINOP(token::SLASH) {
430+
self.bump(); self.bump();
431+
some(self.get_str(sid))
432+
} else {
433+
none
434+
}
430435
}
431-
_ { none }
436+
_ => { none }
432437
};
433438
self.region_from_name(name)
434439
}
@@ -495,7 +500,7 @@ class parser {
495500
t
496501
} else if self.token == token::BINOP(token::AND) {
497502
self.bump();
498-
let region = self.parse_region_dot();
503+
let region = self.parse_region_with_sep();
499504
let mt = self.parse_mt();
500505
ty_rptr(region, mt)
501506
} else if self.eat_keyword("pure") {

trunk/src/rustc/util/ppaux.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,10 @@ fn ty_to_str(cx: ctxt, typ: t) -> str {
183183
ty_ptr(tm) { "*" + mt_to_str(cx, tm) }
184184
ty_rptr(r, tm) {
185185
let rs = region_to_str(cx, r);
186-
if str::len(rs) == 1u {
186+
if rs == "&" {
187187
rs + mt_to_str(cx, tm)
188188
} else {
189-
rs + "." + mt_to_str(cx, tm)
189+
rs + "/" + mt_to_str(cx, tm)
190190
}
191191
}
192192
ty_vec(tm) { "[" + mt_to_str(cx, tm) + "]" }

trunk/src/test/compile-fail/regions-addr-of-arg.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
fn foo(a: int) {
2-
let _p: &static.int = &a; //~ ERROR mismatched types
2+
let _p: &static/int = &a; //~ ERROR mismatched types
33
}
44

55
fn bar(a: int) {
6-
let _q: &blk.int = &a;
6+
let _q: &blk/int = &a;
77
}
88

99
fn main() {

trunk/src/test/compile-fail/regions-addr-of-self.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ class dog {
66
}
77

88
fn chase_cat() {
9-
let p: &static.mut uint = &mut self.cats_chased; //~ ERROR mismatched types
9+
let p: &static/mut uint = &mut self.cats_chased; //~ ERROR mismatched types
1010
*p += 1u;
1111
}
1212

1313
fn chase_cat_2() {
14-
let p: &blk.mut uint = &mut self.cats_chased;
14+
let p: &blk/mut uint = &mut self.cats_chased;
1515
*p += 1u;
1616
}
1717
}

trunk/src/test/compile-fail/regions-addr-of-upvar-self.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class dog {
77

88
fn chase_cat() {
99
for uint::range(0u, 10u) |i| {
10-
let p: &static.mut uint = &mut self.food; //~ ERROR mismatched types
10+
let p: &static/mut uint = &mut self.food; //~ ERROR mismatched types
1111
*p = 3u;
1212
}
1313
}

trunk/src/test/compile-fail/regions-blk.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
fn foo(cond: bool) {
22
let x = 5;
3-
let mut y: &blk.int = &x;
3+
let mut y: &blk/int = &x;
44

5-
let mut z: &blk.int;
5+
let mut z: &blk/int;
66
if cond {
77
z = &x;
88
} else {
9-
let w: &blk.int = &x;
9+
let w: &blk/int = &x;
1010
z = w; //~ ERROR mismatched types
1111
}
1212
}

trunk/src/test/compile-fail/regions-bounds.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// checked.
44

55
enum an_enum = ∫
6-
iface an_iface { fn foo() -> &self.int; }
7-
class a_class { let x:&self.int; new(x:&self.int) { self.x = x; } }
6+
iface an_iface { fn foo() -> &self/int; }
7+
class a_class { let x:&self/int; new(x:&self/int) { self.x = x; } }
88

99
fn a_fn1(e: an_enum/&a) -> an_enum/&b {
1010
ret e; //~ ERROR mismatched types: expected `an_enum/&b` but found `an_enum/&a`

trunk/src/test/compile-fail/regions-creating-enums3.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
enum ast/& {
1+
enum ast {
22
num(uint),
33
add(&ast, &ast)
44
}
55

6-
fn mk_add_bad1(x: &a.ast, y: &b.ast) -> ast/&a {
6+
fn mk_add_bad1(x: &a/ast, y: &b/ast) -> ast/&a {
77
add(x, y) //~ ERROR mismatched types: expected `&a.ast/&a` but found `&b.ast/&b`
88
}
99

trunk/src/test/compile-fail/regions-creating-enums4.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
enum ast/& {
1+
enum ast {
22
num(uint),
33
add(&ast, &ast)
44
}
55

6-
fn mk_add_bad2(x: &a.ast, y: &a.ast, z: &ast) -> ast {
6+
fn mk_add_bad2(x: &a/ast, y: &a/ast, z: &ast) -> ast {
77
add(x, y) //~ ERROR mismatched types: expected `ast/&` but found `ast/&a`
88
}
99

trunk/src/test/compile-fail/regions-fn-subtyping.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Here, `f` is a function that takes a pointer `x` and a function
22
// `g`, where `g` requires its argument `y` to be in the same region
33
// that `x` is in.
4-
fn has_same_region(f: fn(x: &a.int, g: fn(y: &a.int))) {
4+
fn has_same_region(f: fn(x: &a/int, g: fn(y: &a/int))) {
55
// Somewhat counterintuitively, this fails because, in
66
// `wants_two_regions`, the `g` argument needs to be able to
77
// accept any region. That is, the type that `has_same_region`

trunk/src/test/compile-fail/regions-fns.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
// Should fail region checking, because g can only accept a pointer
22
// with lifetime r, and a is a pointer with unspecified lifetime.
33
fn not_ok_1(a: &uint) {
4-
let mut g: fn@(x: &uint) = fn@(x: &r.uint) {};
4+
let mut g: fn@(x: &uint) = fn@(x: &r/uint) {};
55
//~^ ERROR mismatched types
66
g(a);
77
}
88

99
// Should fail region checking, because g can only accept a pointer
1010
// with lifetime r, and a is a pointer with lifetime s.
11-
fn not_ok_2(s: &s.uint)
11+
fn not_ok_2(s: &s/uint)
1212
{
13-
let mut g: fn@(x: &uint) = fn@(x: &r.uint) {};
13+
let mut g: fn@(x: &uint) = fn@(x: &r/uint) {};
1414
//~^ ERROR mismatched types
1515
g(s);
1616
}

trunk/src/test/compile-fail/regions-iface-1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ impl of get_ctxt for has_ctxt {
1111

1212
// Here an error occurs because we used `&self` but
1313
// the definition used `&`:
14-
fn get_ctxt() -> &self.ctxt { //~ ERROR method `get_ctxt` has an incompatible type
14+
fn get_ctxt() -> &self/ctxt { //~ ERROR method `get_ctxt` has an incompatible type
1515
self.c
1616
}
1717

trunk/src/test/compile-fail/regions-iface-2.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
type ctxt = { v: uint };
22

33
iface get_ctxt {
4-
fn get_ctxt() -> &self.ctxt;
4+
fn get_ctxt() -> &self/ctxt;
55
}
66

77
type has_ctxt = { c: &ctxt };
88

99
impl of get_ctxt for has_ctxt {
10-
fn get_ctxt() -> &self.ctxt { self.c }
10+
fn get_ctxt() -> &self/ctxt { self.c }
1111
}
1212

1313
fn make_gc() -> get_ctxt {

trunk/src/test/compile-fail/regions-iface-3.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
iface get_ctxt {
2-
fn get_ctxt() -> &self.uint;
2+
fn get_ctxt() -> &self/uint;
33
}
44

55
fn make_gc1(gc: get_ctxt/&a) -> get_ctxt/&b {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// xfail-test
22

3-
const c_x: &blk.int = 22; //~ ERROR only the static region is allowed here
4-
const c_y: &static.int = &22; //~ ERROR only the static region is allowed here
3+
const c_x: &blk/int = 22; //~ ERROR only the static region is allowed here
4+
const c_y: &static/int = &22; //~ ERROR only the static region is allowed here
55

66
fn main() {
77
}

trunk/src/test/compile-fail/regions-in-enums.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ enum yes0 {
33
}
44

55
enum yes1 {
6-
x4(&self.uint)
6+
x4(&self/uint)
77
}
88

99
enum yes2 {
10-
x5(&foo.uint) //~ ERROR named regions other than `self` are not allowed as part of a type declaration
10+
x5(&foo/uint) //~ ERROR named regions other than `self` are not allowed as part of a type declaration
1111
}
1212

1313
fn main() {}

trunk/src/test/compile-fail/regions-in-rsrcs.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ class yes0 {
55
}
66

77
class yes1 {
8-
let x: &self.uint;
9-
new(x: &self.uint) { self.x = x; }
8+
let x: &self/uint;
9+
new(x: &self/uint) { self.x = x; }
1010
drop {}
1111
}
1212

1313
class yes2 {
14-
let x: &foo.uint; //~ ERROR named regions other than `self` are not allowed as part of a type declaration
15-
new(x: &foo.uint) { self.x = x; } //~ ERROR named regions other than `self` are not allowed as part of a type declaration
14+
let x: &foo/uint; //~ ERROR named regions other than `self` are not allowed as part of a type declaration
15+
new(x: &foo/uint) { self.x = x; } //~ ERROR named regions other than `self` are not allowed as part of a type declaration
1616
drop {}
1717
}
1818

trunk/src/test/compile-fail/regions-in-type-items.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ type item_ty_yes0 = {
33
};
44

55
type item_ty_yes1 = {
6-
x: &self.uint
6+
x: &self/uint
77
};
88

99
type item_ty_yes2 = {
10-
x: &foo.uint //~ ERROR named regions other than `self` are not allowed as part of a type declaration
10+
x: &foo/uint //~ ERROR named regions other than `self` are not allowed as part of a type declaration
1111
};
1212

1313
fn main() {}

trunk/src/test/compile-fail/regions-infer-paramd-indirect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ impl methods for c {
1111
}
1212

1313
fn set_f_bad(b: @b) {
14-
self.f = b; //~ ERROR mismatched types: expected `@@&self.int` but found `@@&int`
14+
self.f = b; //~ ERROR mismatched types: expected `@@&self/int` but found `@@&int`
1515
}
1616
}
1717

trunk/src/test/compile-fail/regions-infer-paramd-method.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// refers to self.
33

44
iface foo {
5-
fn self_int() -> &self.int;
5+
fn self_int() -> &self/int;
66

77
fn any_int() -> ∫
88
}

trunk/src/test/compile-fail/regions-nested-fns.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
fn ignore<T>(t: T) {}
22

3-
fn nested(x: &x.int) {
3+
fn nested(x: &x/int) {
44
let y = 3;
55
let mut ay = &y;
66

7-
ignore(fn&(z: &z.int) {
7+
ignore(fn&(z: &z/int) {
88
ay = x;
99
ay = &y;
1010
ay = z; //~ ERROR references with lifetime
1111
});
1212

13-
ignore(fn&(z: &z.int) -> &z.int {
13+
ignore(fn&(z: &z/int) -> &z/int {
1414
if false { ret x; } //~ ERROR references with lifetime
1515
if false { ret &y; } //~ ERROR references with lifetime
1616
if false { ret ay; } //~ ERROR references with lifetime

trunk/src/test/compile-fail/regions-ret.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// error-pattern: mismatched types
22

3-
fn f(x : &a.int) -> &a.int {
3+
fn f(x : &a/int) -> &a/int {
44
ret &3;
55
}
66

trunk/src/test/compile-fail/regions-scoping.rs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
11
fn with<T>(t: T, f: fn(T)) { f(t) }
22

3-
fn nested(x: &x.int) { // (1)
3+
fn nested(x: &x/int) { // (1)
44
do with(
5-
fn&(x: &x.int, // Refers to the region `x` at (1)
6-
y: &y.int, // A fresh region `y` (2)
7-
z: fn(x: &x.int, // Refers to `x` at (1)
8-
y: &y.int, // Refers to `y` at (2)
9-
z: &z.int) -> &z.int) // A fresh region `z` (3)
10-
-> &x.int {
5+
fn&(x: &x/int, // Refers to the region `x` at (1)
6+
y: &y/int, // A fresh region `y` (2)
7+
z: fn(x: &x/int, // Refers to `x` at (1)
8+
y: &y/int, // Refers to `y` at (2)
9+
z: &z/int) -> &z/int) // A fresh region `z` (3)
10+
-> &x/int {
1111

12-
if false { ret z(x, x, x); } //~ ERROR mismatched types: expected `&y.int` but found `&x.int`
13-
if false { ret z(x, x, y); } //~ ERROR mismatched types: expected `&y.int` but found `&x.int`
14-
//~^ ERROR mismatched types: expected `&x.int` but found `&y.int`
12+
if false { ret z(x, x, x); } //~ ERROR mismatched types: expected `&y/int` but found `&x/int`
13+
if false { ret z(x, x, y); } //~ ERROR mismatched types: expected `&y/int` but found `&x/int`
14+
//~^ ERROR mismatched types: expected `&x/int` but found `&y/int`
1515
if false { ret z(x, y, x); }
16-
if false { ret z(x, y, y); } //~ ERROR mismatched types: expected `&x.int` but found `&y.int`
17-
if false { ret z(y, x, x); } //~ ERROR mismatched types: expected `&x.int` but found `&y.int`
18-
//~^ ERROR mismatched types: expected `&y.int` but found `&x.int`
19-
if false { ret z(y, x, y); } //~ ERROR mismatched types: expected `&x.int` but found `&y.int`
20-
//~^ ERROR mismatched types: expected `&y.int` but found `&x.int`
21-
//~^^ ERROR mismatched types: expected `&x.int` but found `&y.int`
22-
if false { ret z(y, y, x); } //~ ERROR mismatched types: expected `&x.int` but found `&y.int`
23-
if false { ret z(y, y, y); } //~ ERROR mismatched types: expected `&x.int` but found `&y.int`
24-
//~^ ERROR mismatched types: expected `&x.int` but found `&y.int`
16+
if false { ret z(x, y, y); } //~ ERROR mismatched types: expected `&x/int` but found `&y/int`
17+
if false { ret z(y, x, x); } //~ ERROR mismatched types: expected `&x/int` but found `&y/int`
18+
//~^ ERROR mismatched types: expected `&y/int` but found `&x/int`
19+
if false { ret z(y, x, y); } //~ ERROR mismatched types: expected `&x/int` but found `&y/int`
20+
//~^ ERROR mismatched types: expected `&y/int` but found `&x/int`
21+
//~^^ ERROR mismatched types: expected `&x/int` but found `&y/int`
22+
if false { ret z(y, y, x); } //~ ERROR mismatched types: expected `&x/int` but found `&y/int`
23+
if false { ret z(y, y, y); } //~ ERROR mismatched types: expected `&x/int` but found `&y/int`
24+
//~^ ERROR mismatched types: expected `&x/int` but found `&y/int`
2525
fail;
2626
}
2727
) |foo| {
2828

29-
let a: &x.int = foo(x, x, |_x, _y, z| z );
30-
let b: &x.int = foo(x, a, |_x, _y, z| z );
31-
let c: &x.int = foo(a, a, |_x, _y, z| z );
29+
let a: &x/int = foo(x, x, |_x, _y, z| z );
30+
let b: &x/int = foo(x, a, |_x, _y, z| z );
31+
let c: &x/int = foo(a, a, |_x, _y, z| z );
3232

3333
let z = 3i;
34-
let d: &x.int = foo(x, x, |_x, _y, z| z );
35-
let e: &x.int = foo(x, &z, |_x, _y, z| z );
36-
let f: &x.int = foo(&z, &z, |_x, _y, z| z ); //~ ERROR mismatched types: expected `&x.int` but found
34+
let d: &x/int = foo(x, x, |_x, _y, z| z );
35+
let e: &x/int = foo(x, &z, |_x, _y, z| z );
36+
let f: &x/int = foo(&z, &z, |_x, _y, z| z ); //~ ERROR mismatched types: expected `&x/int` but found
3737

38-
foo(x, &z, |x, _y, _z| x ); //~ ERROR mismatched types: expected `&z.int` but found `&x.int`
39-
foo(x, &z, |_x, y, _z| y ); //~ ERROR mismatched types: expected `&z.int` but found `&<block at
38+
foo(x, &z, |x, _y, _z| x ); //~ ERROR mismatched types: expected `&z/int` but found `&x/int`
39+
foo(x, &z, |_x, y, _z| y ); //~ ERROR mismatched types: expected `&z/int` but found `&<block at
4040
}
4141
}
4242

trunk/src/test/run-pass/issue-2502.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
class font {
2-
let fontbuf: &self.~[u8];
2+
let fontbuf: &self/~[u8];
33

4-
new(fontbuf: &self.~[u8]) {
4+
new(fontbuf: &self/~[u8]) {
55
self.fontbuf = fontbuf;
66
}
77

8-
fn buf() -> &self.~[u8] {
8+
fn buf() -> &self/~[u8] {
99
self.fontbuf
1010
}
1111
}

0 commit comments

Comments
 (0)