about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-01-04 15:33:58 +0100
committerGitHub <noreply@github.com>2024-01-04 15:33:58 +0100
commit3d8d10d4ea2a74be154aada58eeec8ad3b346f99 (patch)
tree56495643627c5efe17f434907c4b0cc4f44c40e2
parenta919d97aaa1598fbd380b992f3404454fb20641b (diff)
parent7e3f5f858dc685b28e6046de36c5a7834ee42839 (diff)
downloadrust-3d8d10d4ea2a74be154aada58eeec8ad3b346f99.tar.gz
rust-3d8d10d4ea2a74be154aada58eeec8ad3b346f99.zip
Rollup merge of #119391 - DaniPopes:catch-flatten, r=davidtwco
Use Result::flatten in catch_with_exit_code
-rw-r--r--compiler/rustc_driver_impl/src/lib.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs
index ca6b0afc76a..2041ffefe77 100644
--- a/compiler/rustc_driver_impl/src/lib.rs
+++ b/compiler/rustc_driver_impl/src/lib.rs
@@ -12,6 +12,7 @@
 #![feature(lazy_cell)]
 #![feature(let_chains)]
 #![feature(panic_update_hook)]
+#![feature(result_flattening)]
 #![recursion_limit = "256"]
 #![deny(rustc::untranslatable_diagnostic)]
 #![deny(rustc::diagnostic_outside_of_impl)]
@@ -1249,8 +1250,7 @@ pub fn catch_fatal_errors<F: FnOnce() -> R, R>(f: F) -> Result<R, ErrorGuarantee
 /// Variant of `catch_fatal_errors` for the `interface::Result` return type
 /// that also computes the exit code.
 pub fn catch_with_exit_code(f: impl FnOnce() -> interface::Result<()>) -> i32 {
-    let result = catch_fatal_errors(f).and_then(|result| result);
-    match result {
+    match catch_fatal_errors(f).flatten() {
         Ok(()) => EXIT_SUCCESS,
         Err(_) => EXIT_FAILURE,
     }