Skip to content

Commit 20e8bbd

Browse files
committed
---
yaml --- r: 27892 b: refs/heads/try c: 1ed94a5 h: refs/heads/master v: v3
1 parent 78d5f4b commit 20e8bbd

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
5-
refs/heads/try: 9ea6b3a32e808c4cf1e2d45cc26363e700944ef9
5+
refs/heads/try: 1ed94a56744c0ed4056c22da297d84222f4327f2
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df

branches/try/src/rustc/middle/kind.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,15 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) {
307307
}
308308
}
309309
}
310+
expr_repeat(element, count_expr, _) => {
311+
let count = ty::eval_repeat_count(cx.tcx, count_expr, e.span);
312+
if count == 1 {
313+
maybe_copy(cx, element);
314+
} else {
315+
let element_ty = ty::expr_ty(cx.tcx, element);
316+
check_copy(cx, element.id, element_ty, element.span, true);
317+
}
318+
}
310319
_ => { }
311320
}
312321
visit::visit_expr(e, cx, v);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Tests that one can't run a destructor twice with the repeated vector
2+
// literal syntax.
3+
4+
struct Foo {
5+
x: int;
6+
7+
drop {
8+
io::println("Goodbye!");
9+
}
10+
}
11+
12+
fn main() {
13+
let a = Foo { x: 3 };
14+
let b = [ a, ..5 ]; //~ ERROR copying a noncopyable value
15+
}
16+

0 commit comments

Comments
 (0)