Skip to content

Commit 619f6c3

Browse files
committed
---
yaml --- r: 10740 b: refs/heads/snap-stage3 c: 51468b6 h: refs/heads/master v: v3
1 parent f72b183 commit 619f6c3

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 2898dcc5d97da9427ac367542382b6239d9c0bbf
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: f17ca3f73e8e6196a7549ae0df721828a3dfd262
4+
refs/heads/snap-stage3: 51468b65a48e7e897ff7ac080c33efb7b5ce289d
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/snap-stage3/src/rustc/middle/trans/tvec.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,15 @@ fn trans_evec(bcx: block, args: [@ast::expr]/~,
152152
}
153153
ast::vstore_slice(_) {
154154
let n = vec::len(args);
155+
// Make a fake type to use for the cleanup
156+
let ty = ty::mk_evec(bcx.tcx(),
157+
{ty: unit_ty, mutbl: ast::m_mutbl},
158+
ty::vstore_fixed(n));
159+
155160
let n = C_uint(ccx, n);
156161
let vp = base::arrayalloca(bcx, llunitty, n);
162+
add_clean(bcx, vp, ty);
163+
157164
let len = Mul(bcx, n, unit_sz);
158165

159166
let p = base::alloca(bcx, T_struct([T_ptr(llunitty),
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Make sure that destructors get run on slice literals
2+
class foo {
3+
let x: @mut int;
4+
new(x: @mut int) { self.x = x; }
5+
drop { *self.x += 1; }
6+
}
7+
8+
fn main() {
9+
let x = @mut 0;
10+
{
11+
let l = [foo(x)]/&;
12+
assert *l[0].x == 0;
13+
}
14+
assert *x == 1;
15+
}

0 commit comments

Comments
 (0)