]> git.lizzy.rs Git - rust.git/commitdiff
Expand on cleanups in trans for expr_repeat and add to tests.
authorLuqman Aden <me@luqman.ca>
Mon, 25 Mar 2013 22:46:10 +0000 (15:46 -0700)
committerLuqman Aden <me@luqman.ca>
Mon, 25 Mar 2013 22:46:10 +0000 (15:46 -0700)
src/librustc/middle/trans/tvec.rs
src/test/run-pass/repeated-vector-syntax.rs

index a86a4aec6b49fc2cf615c528522828f576b4430f..90f6bf8757865ce7c1d95076c2ac048d5664bd9c 100644 (file)
@@ -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)
                     });
index 49d0c49b3967e4b26f9a1a0078385da7255bc148..a22384a6b53d010865f109524752fc2bcdbba1f8 100644 (file)
@@ -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);
 }