@@ -1098,38 +1098,26 @@ impl fmt::Display for ExitStatus {
1098
1098
///
1099
1099
/// [RFC #1937]: https://github.com/rust-lang/rfcs/pull/1937
1100
1100
#[ derive( Clone , Copy , Debug ) ]
1101
- #[ unstable( feature = "process_exitcode_placeholder" , issue = "43301 " ) ]
1102
- pub struct ExitCode ( pub i32 ) ;
1101
+ #[ unstable( feature = "process_exitcode_placeholder" , issue = "48711 " ) ]
1102
+ pub struct ExitCode ( imp :: ExitCode ) ;
1103
1103
1104
- #[ cfg( target_arch = "wasm32" ) ]
1105
- mod rawexit {
1106
- pub const SUCCESS : i32 = 0 ;
1107
- pub const FAILURE : i32 = 1 ;
1108
- }
1109
- #[ cfg( not( target_arch = "wasm32" ) ) ]
1110
- mod rawexit {
1111
- use libc;
1112
- pub const SUCCESS : i32 = libc:: EXIT_SUCCESS ;
1113
- pub const FAILURE : i32 = libc:: EXIT_FAILURE ;
1114
- }
1115
-
1116
- #[ unstable( feature = "process_exitcode_placeholder" , issue = "43301" ) ]
1104
+ #[ unstable( feature = "process_exitcode_placeholder" , issue = "48711" ) ]
1117
1105
impl ExitCode {
1118
1106
/// The canonical ExitCode for successful termination on this platform.
1119
1107
///
1120
1108
/// Note that a `()`-returning `main` implicitly results in a successful
1121
1109
/// termination, so there's no need to return this from `main` unless
1122
1110
/// you're also returning other possible codes.
1123
- #[ unstable( feature = "process_exitcode_placeholder" , issue = "43301 " ) ]
1124
- pub const SUCCESS : ExitCode = ExitCode ( rawexit :: SUCCESS ) ;
1111
+ #[ unstable( feature = "process_exitcode_placeholder" , issue = "48711 " ) ]
1112
+ pub const SUCCESS : ExitCode = ExitCode ( imp :: ExitCode :: SUCCESS ) ;
1125
1113
1126
1114
/// The canonical ExitCode for unsuccessful termination on this platform.
1127
1115
///
1128
1116
/// If you're only returning this and `SUCCESS` from `main`, consider
1129
1117
/// instead returning `Err(_)` and `Ok(())` respectively, which will
1130
1118
/// return the same codes (but will also `eprintln!` the error).
1131
- #[ unstable( feature = "process_exitcode_placeholder" , issue = "43301 " ) ]
1132
- pub const FAILURE : ExitCode = ExitCode ( rawexit :: FAILURE ) ;
1119
+ #[ unstable( feature = "process_exitcode_placeholder" , issue = "48711 " ) ]
1120
+ pub const FAILURE : ExitCode = ExitCode ( imp :: ExitCode :: FAILURE ) ;
1133
1121
}
1134
1122
1135
1123
impl Child {
@@ -1494,8 +1482,7 @@ impl<E: fmt::Debug> Termination for Result<!, E> {
1494
1482
#[ unstable( feature = "termination_trait_lib" , issue = "43301" ) ]
1495
1483
impl Termination for ExitCode {
1496
1484
fn report ( self ) -> i32 {
1497
- let ExitCode ( code) = self ;
1498
- code
1485
+ self . 0 . as_i32 ( )
1499
1486
}
1500
1487
}
1501
1488
0 commit comments