Skip to content

Commit 207bc40

Browse files
committed
Auto merge of #49826 - cuviper:rustc-main-ICE, r=alexcrichton
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
2 parents 1eb0cef + 64bcbca commit 207bc40

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/librustc_driver/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1526,7 +1526,8 @@ pub fn in_rustc_thread<F, R>(f: F) -> Result<R, Box<Any + Send>>
15261526
let thread = cfg.spawn(f);
15271527
thread.unwrap().join()
15281528
} else {
1529-
Ok(f())
1529+
let f = panic::AssertUnwindSafe(f);
1530+
panic::catch_unwind(f)
15301531
}
15311532
}
15321533

0 commit comments

Comments
 (0)