Skip to content

Commit 4fbc450

Browse files
committed
---
yaml --- r: 5511 b: refs/heads/master c: e5d5682 h: refs/heads/master i: 5509: 788baee 5507: e0c8e34 5503: 530c233 v: v3
1 parent def2513 commit 4fbc450

File tree

5 files changed

+26
-5
lines changed

5 files changed

+26
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 97629727b18293ae57a4c93f41a0dac8b9611cbb
2+
refs/heads/master: e5d5682065eac04322bb1cc21c1cd672393c6c33

trunk/src/comp/middle/ty.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,11 +1021,18 @@ fn type_kind(cx: ctxt, ty: t) -> ast::kind {
10211021
}
10221022
// Pointers and unique boxes / vecs raise pinned to shared,
10231023
// otherwise pass through their pointee kind.
1024-
ty_ptr(tm) | ty_vec(tm) | ty_uniq(tm) {
1024+
ty_ptr(tm) | ty_vec(tm) {
10251025
let k = type_kind(cx, tm.ty);
10261026
if k == ast::kind_pinned { k = ast::kind_shared; }
10271027
result = kind::lower_kind(result, k);
10281028
}
1029+
// Unique boxes pass through their pointee kind. FIXME: Shouldn't
1030+
// pointers and vecs do this too to avoid copying vectors of pinned
1031+
// things?
1032+
ty_uniq(tm) {
1033+
let k = type_kind(cx, tm.ty);
1034+
result = kind::lower_kind(result, k);
1035+
}
10291036
// Records lower to the lowest of their members.
10301037
ty_rec(flds) {
10311038
for f: field in flds {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// error-pattern: mismatched kind
2+
3+
resource r(b: bool) {
4+
}
5+
6+
fn main() {
7+
let i = ~r(true);
8+
let j;
9+
j = i;
10+
}

trunk/src/test/run-pass/generic-exterior-unique.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
2-
31
type recbox<T> = {x: ~T};
42

5-
fn reclift<T>(t: T) -> recbox<T> { ret {x: ~t}; }
3+
fn reclift<@T>(t: T) -> recbox<T> { ret {x: ~t}; }
64

75
fn main() {
86
let foo: int = 17;

trunk/src/test/run-pass/unique-swap2.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
// xfail-test
2+
3+
// This no longer works because ~r() is lowered to a pinned type
4+
// (which can't be swapped). Should probably be a compile-fail
5+
// test.
6+
17
resource r(i: @mutable int) {
28
*i += 1;
39
}

0 commit comments

Comments
 (0)