]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #49826 - cuviper:rustc-main-ICE, r=alexcrichton
authorbors <bors@rust-lang.org>
Sat, 28 Apr 2018 06:26:46 +0000 (06:26 +0000)
committerbors <bors@rust-lang.org>
Sat, 28 Apr 2018 06:26:46 +0000 (06:26 +0000)
rustc_driver: Catch ICEs on the main thread too

#48575 introduced an optimization to run rustc directly on the main thread when possible.  However, the threaded code detects panics when they `join()` to report as an ICE.  When running directly, we need to use `panic::catch_unwind` to get the same effect.

cc @ishitatsuyuki
r? @alexcrichton

src/librustc_driver/lib.rs

index b203f387e4662d2f3c5f94664d672c2948875b65..3f166daac717e082a15548b3b7019e935af46e7b 100644 (file)
@@ -1526,7 +1526,8 @@ pub fn in_rustc_thread<F, R>(f: F) -> Result<R, Box<Any + Send>>
         let thread = cfg.spawn(f);
         thread.unwrap().join()
     } else {
-        Ok(f())
+        let f = panic::AssertUnwindSafe(f);
+        panic::catch_unwind(f)
     }
 }