Skip to content

Commit cfecf3f

Browse files
committed
---
yaml --- r: 5602 b: refs/heads/master c: cb4e99b h: refs/heads/master v: v3
1 parent bb99a70 commit cfecf3f

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
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: 14bac217b0cfc5e1640a739605e3c3d7e33525c4
2+
refs/heads/master: cb4e99b68809a17db5624aabbdf9189225333d85

trunk/src/comp/middle/kind.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ fn need_shared_or_pinned_ctor(tcx: ty::ctxt, a: @ast::expr, descr: str) {
189189
ast::expr_tup(_) {
190190
true
191191
}
192+
ast::expr_vec(exprs, _) {
193+
true
194+
}
192195
_ { false }
193196
}
194197
}
@@ -262,6 +265,13 @@ fn check_expr(tcx: ty::ctxt, e: @ast::expr) {
262265
need_shared_or_pinned_ctor(tcx, expr, "tuple parameter");
263266
}
264267
}
268+
ast::expr_vec(exprs, _) {
269+
// Putting pinned things into vectors is pretty useless since vector
270+
// addition can't work (it's a copy)
271+
for expr in exprs {
272+
need_expr_kind(tcx, expr, ast::kind_shared, "vector element");
273+
}
274+
}
265275
_ { }
266276
}
267277
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// error-pattern:mismatched kinds
2+
3+
resource r(i: int) {
4+
}
5+
6+
fn main() {
7+
// This can't make sense as it would copy the resources
8+
let i <- [r(0)];
9+
let j <- [r(1)];
10+
let k = i + j;
11+
}

0 commit comments

Comments
 (0)