]> git.lizzy.rs Git - rust.git/commitdiff
Change init-large-type to use child thread
authorAaron Turon <aturon@mozilla.com>
Wed, 21 Jan 2015 00:37:00 +0000 (16:37 -0800)
committerAaron Turon <aturon@mozilla.com>
Wed, 21 Jan 2015 16:11:07 +0000 (08:11 -0800)
src/test/run-pass/init-large-type.rs

index 0534d0c054f44df52f7607be6c6f4ae5512177da..8ee6054f8ba5634cdcdb97663cfedbe33ce5cc30 100644 (file)
@@ -14,6 +14,8 @@
 
 #![feature(intrinsics)]
 
+use std::thread::Thread;
+
 extern "rust-intrinsic" {
     pub fn init<T>() -> T;
 }
@@ -21,5 +23,8 @@
 const SIZE: usize = 1024 * 1024;
 
 fn main() {
-    let _memory: [u8; SIZE] = unsafe { init() };
+    // do the test in a new thread to avoid (spurious?) stack overflows
+    let _ = Thread::scoped(|| {
+        let _memory: [u8; SIZE] = unsafe { init() };
+    }).join();
 }