Skip to content

Commit e7f42f1

Browse files
committed
Expand on cleanups in trans for expr_repeat and add to tests.
1 parent 89a7407 commit e7f42f1

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Diff for: src/librustc/middle/trans/tvec.rs

+5
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,11 @@ pub fn write_content(bcx: block,
414414
return bcx;
415415
}
416416

417+
// Some cleanup would be required in the case in which failure happens
418+
// during a copy. But given that copy constructors are not overridable,
419+
// this can only happen as a result of OOM. So we just skip out on the
420+
// cleanup since things would *probably* be broken at that point anyways.
421+
417422
let elem = unpack_datum!(bcx, {
418423
expr::trans_to_datum(bcx, element)
419424
});

Diff for: src/test/run-pass/repeated-vector-syntax.rs

+7
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@
99
// except according to those terms.
1010

1111
pub fn main() {
12+
struct Foo { a: ~str }
13+
14+
let v = [ ~Foo { a: ~"Hello!" }, ..129 ];
15+
let w = [ ~"Hello!", ..129 ];
1216
let x = [ @[true], ..512 ];
1317
let y = [ 0, ..1 ];
18+
19+
error!("%?", v);
20+
error!("%?", w);
1421
error!("%?", x);
1522
error!("%?", y);
1623
}

0 commit comments

Comments
 (0)