Skip to content

Commit 2884c72

Browse files
committed
Step one towards new type param kind syntax
Issue #1067 Needs a snapshot to finalize.
1 parent ea740a8 commit 2884c72

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

src/comp/syntax/parse/parser.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1739,7 +1739,11 @@ fn parse_ty_param(p: parser) -> ast::ty_param {
17391739
alt p.peek() {
17401740
token::TILDE. { p.bump(); ast::kind_unique }
17411741
token::AT. { p.bump(); ast::kind_shared }
1742-
_ { ast::kind_pinned }
1742+
_ {
1743+
if eat_word(p, "pinned") { ast::kind_pinned }
1744+
else if eat_word(p, "unique") { ast::kind_unique }
1745+
else { ast::kind_shared }
1746+
}
17431747
};
17441748
ret {ident: parse_ident(p), kind: k};
17451749
}

src/comp/syntax/print/pprust.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,8 +1193,8 @@ fn print_arg_mode(s: ps, m: ast::mode) {
11931193
11941194
fn print_kind(s: ps, kind: ast::kind) {
11951195
alt kind {
1196-
ast::kind_unique. { word(s.s, "~"); }
1197-
ast::kind_shared. { word(s.s, "@"); }
1196+
ast::kind_unique. { word_nbsp(s, "unique"); }
1197+
ast::kind_pinned. { word_nbsp(s, "pinned"); }
11981198
_ {/* fallthrough */ }
11991199
}
12001200
}

src/test/compile-fail/implicit-copy-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ resource r(i: @mutable int) {
44
*i = *i + 1;
55
}
66

7-
fn movearg<T>(i: T) {
7+
fn movearg<pinned T>(i: T) {
88
// Implicit copy to mutate reference i
99
let j <- i;
1010
}

src/test/run-pass/resource-in-struct.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ type closable = @mutable bool;
55

66
resource close_res(i: closable) { *i = false; }
77

8-
tag option<T> { none; some(T); }
8+
tag option<pinned T> { none; some(T); }
99

1010
fn sink(res: option<close_res>) { }
1111

0 commit comments

Comments
 (0)