about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2021-02-24 14:52:16 +0000
committerIan Jackson <ijackson@chiark.greenend.org.uk>2021-05-12 11:12:19 +0100
commit60a4d9612d5cd5dde600bbf7a3cb5431f55de670 (patch)
treeb0b7f78a61a3a29ac2925517d0e9fee9a4e12295 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parente893089ea066ce2b339543ac8e59b4e0ca8c44d3 (diff)
downloadrust-60a4d9612d5cd5dde600bbf7a3cb5431f55de670.tar.gz
rust-60a4d9612d5cd5dde600bbf7a3cb5431f55de670.zip
unix: impl ExitStatusExt for ExitStatusError
It is unergnomic to have to say things like
   bad.into_status().signal()

Implementing `ExitStatusExt` for `ExitStatusError` fixes this.
Unfortunately it does mean making a previously-infallible method
capable of panicing, although of course the existing impl remains
infallible.

The alternative would be a whole new `ExitStatusErrorExt` trait.

`<ExitStatus as ExitStatusExt>::into_raw()` is not particularly
ergonomic to call because of the often-required type annotation.
See for example the code in the test case in
  library/std/src/sys/unix/process/process_unix/tests.rs

Perhaps we should provide equivalent free functions for `ExitStatus`
and `ExitStatusExt` in std::os::unix::process and maybe deprecate this
trait method.  But I think that is for the future.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions