]> git.lizzy.rs Git - rust.git/blobdiff - src/fn_call.rs
unify code paths
[rust.git] / src / fn_call.rs
index 62ad675218a4fa491ccdc06797354332bc8c3bad..29a34a6968634413b96d584dce8b66b3f451ac4b 100644 (file)
@@ -154,14 +154,11 @@ fn emulate_foreign_item(
             "__rust_start_panic" | "panic_impl" => {
                 return err!(MachineError("the evaluated program panicked".to_string()));
             }
-            "exit" => {
+            "exit" | "ExitProcess" => {
+                // it's really u32 for ExitProcess, but we have to put it into the `Exit` error variant anyway
                 let code = this.read_scalar(args[0])?.to_i32()?;
                 return err!(Exit(code));
             }
-            "ExitProcess" => {
-                let code = this.read_scalar(args[0])?.to_u32()?;
-                return err!(Exit(code as i32));
-            }
             _ => if dest.is_none() {
                 return err!(Unimplemented(
                     format!("can't call diverging foreign function: {}", link_name),