diff options
| -rw-r--r-- | src/librustc/middle/trans/tvec.rs | 5 | ||||
| -rw-r--r-- | src/test/run-pass/repeated-vector-syntax.rs | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/librustc/middle/trans/tvec.rs b/src/librustc/middle/trans/tvec.rs index a86a4aec6b4..90f6bf87578 100644 --- a/src/librustc/middle/trans/tvec.rs +++ b/src/librustc/middle/trans/tvec.rs @@ -414,6 +414,11 @@ pub fn write_content(bcx: block, return bcx; } + // Some cleanup would be required in the case in which failure happens + // during a copy. But given that copy constructors are not overridable, + // this can only happen as a result of OOM. So we just skip out on the + // cleanup since things would *probably* be broken at that point anyways. + let elem = unpack_datum!(bcx, { expr::trans_to_datum(bcx, element) }); diff --git a/src/test/run-pass/repeated-vector-syntax.rs b/src/test/run-pass/repeated-vector-syntax.rs index 49d0c49b396..a22384a6b53 100644 --- a/src/test/run-pass/repeated-vector-syntax.rs +++ b/src/test/run-pass/repeated-vector-syntax.rs @@ -9,8 +9,15 @@ // except according to those terms. pub fn main() { + struct Foo { a: ~str } + + let v = [ ~Foo { a: ~"Hello!" }, ..129 ]; + let w = [ ~"Hello!", ..129 ]; let x = [ @[true], ..512 ]; let y = [ 0, ..1 ]; + + error!("%?", v); + error!("%?", w); error!("%?", x); error!("%?", y); } |
