Skip to content

Commit ee5354d

Browse files
committed
---
yaml --- r: 47725 b: refs/heads/incoming c: 6c728e3 h: refs/heads/master i: 47723: b8d1bb8 v: v3
1 parent 2fc5cd9 commit ee5354d

File tree

4 files changed

+44
-32
lines changed

4 files changed

+44
-32
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 2a8fb58d79e685d5ca07b039badcf2ae3ef077ea
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/incoming: ad8b437adabbc11e79c3672bd5c74294f38d3bc4
9+
refs/heads/incoming: 6c728e32c0bad69318c1c4d4413ea55ce7c5813f
1010
refs/heads/dist-snap: 8b98e5a296d95c5e832db0756828e5bec31c6f50
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/libsyntax/parse/parser.rs

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -307,12 +307,12 @@ pub impl Parser {
307307
{
308308
/*
309309
310-
extern "ABI" [pure|unsafe] fn (S) -> T
311-
^~~~^ ^~~~~~~~~~~~^ ^~^ ^
312-
| | | |
313-
| | | Return type
314-
| | Argument types
315-
| |
310+
extern "ABI" [pure|unsafe] fn <'lt> (S) -> T
311+
^~~~^ ^~~~~~~~~~~~^ ^~~~^ ^~^ ^
312+
| | | | |
313+
| | | | Return type
314+
| | | Argument types
315+
| | Lifetimes
316316
| |
317317
| Purity
318318
ABI
@@ -333,12 +333,12 @@ pub impl Parser {
333333
{
334334
/*
335335
336-
(&|~|@) [r/] [pure|unsafe] [once] fn (S) -> T
337-
^~~~~~^ ^~~^ ^~~~~~~~~~~~^ ^~~~~^ ^~^ ^
338-
| | | | | |
339-
| | | | | Return type
340-
| | | | Argument types
341-
| | | |
336+
(&|~|@) [r/] [pure|unsafe] [once] fn <'lt> (S) -> T
337+
^~~~~~^ ^~~^ ^~~~~~~~~~~~^ ^~~~~^ ^~~~^ ^~^ ^
338+
| | | | | | |
339+
| | | | | | Return type
340+
| | | | | Argument types
341+
| | | | Lifetimes
342342
| | | Once-ness (a.k.a., affine)
343343
| | Purity
344344
| Lifetime bound
@@ -394,12 +394,24 @@ pub impl Parser {
394394
}
395395
396396
fn parse_ty_fn_decl() -> fn_decl {
397-
let inputs = do self.parse_unspanned_seq(
398-
token::LPAREN, token::RPAREN,
399-
seq_sep_trailing_disallowed(token::COMMA)) |p| {
397+
/*
400398
401-
p.parse_arg_general(false)
402-
};
399+
(fn) <'lt> (S) -> T
400+
^~~~^ ^~^ ^
401+
| | |
402+
| | Return type
403+
| Argument types
404+
Lifetimes
405+
406+
*/
407+
if self.eat(token::LT) {
408+
let _lifetimes = self.parse_lifetimes();
409+
self.expect(token::GT);
410+
}
411+
let inputs = self.parse_unspanned_seq(
412+
token::LPAREN, token::RPAREN,
413+
seq_sep_trailing_disallowed(token::COMMA),
414+
|p| p.parse_arg_general(false));
403415
let (ret_style, ret_ty) = self.parse_ret_ty();
404416
ast::fn_decl { inputs: inputs, output: ret_ty, cf: ret_style }
405417
}

branches/incoming/src/test/compile-fail/regions-in-enums.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010

1111
enum yes0<'lt> {
1212
// This will eventually be legal (and in fact the only way):
13-
x3(&'lt uint) //~ ERROR named regions other than `self` are not allowed as part of a type declaration
13+
X3(&'lt uint) //~ ERROR named regions other than `self` are not allowed as part of a type declaration
1414
}
1515

1616
enum yes1 {
17-
x4(&'self uint)
17+
X4(&'self uint)
1818
}
1919

2020
enum yes2 {
21-
x5(&'foo uint) //~ ERROR named regions other than `self` are not allowed as part of a type declaration
21+
X5(&'foo uint) //~ ERROR named regions other than `self` are not allowed as part of a type declaration
2222
}
2323

2424
fn main() {}

branches/incoming/src/test/compile-fail/regions-scoping.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010

1111
fn with<T>(t: T, f: fn(T)) { f(t) }
1212

13-
fn nested(x: &x/int) { // (1)
13+
fn nested<'x>(x: &'x int) { // (1)
1414
do with(
15-
fn&(x: &x/int, // Refers to the region `x` at (1)
16-
y: &y/int, // A fresh region `y` (2)
17-
z: fn(x: &x/int, // Refers to `x` at (1)
18-
y: &y/int, // Refers to `y` at (2)
19-
z: &z/int) -> &z/int) // A fresh region `z` (3)
15+
fn&(x: &'x int, // Refers to the region `x` at (1)
16+
y: &'y int, // A fresh region `y` (2)
17+
z: fn<'z>(x: &'x int, // Refers to `x` at (1)
18+
y: &'y int, // Refers to `y` at (2)
19+
z: &'z int) -> &'z int) // A fresh region `z` (3)
2020
-> &x/int {
2121

2222
if false { return z(x, y, x); }
@@ -29,13 +29,13 @@ fn nested(x: &x/int) { // (1)
2929
}
3030
) |foo| {
3131

32-
let a: &x/int = foo(x, x, |_x, _y, z| z );
33-
let b: &x/int = foo(x, a, |_x, _y, z| z );
34-
let c: &x/int = foo(a, a, |_x, _y, z| z );
32+
let a: &'x int = foo(x, x, |_x, _y, z| z );
33+
let b: &'x int = foo(x, a, |_x, _y, z| z );
34+
let c: &'x int = foo(a, a, |_x, _y, z| z );
3535

3636
let z = 3i;
37-
let d: &x/int = foo(x, x, |_x, _y, z| z );
38-
let e: &x/int = foo(x, &z, |_x, _y, z| z );
37+
let d: &'x int = foo(x, x, |_x, _y, z| z );
38+
let e: &'x int = foo(x, &z, |_x, _y, z| z );
3939

4040
// This would result in an error, but it is not reported by typeck
4141
// anymore but rather borrowck. Therefore, it doesn't end up

0 commit comments

Comments
 (0)