summaryrefslogtreecommitdiffstats
path: root/library/std/src/sys/unsupported
diff options
context:
space:
mode:
Diffstat (limited to 'library/std/src/sys/unsupported')
-rw-r--r--library/std/src/sys/unsupported/os.rs18
-rw-r--r--library/std/src/sys/unsupported/process.rs37
2 files changed, 36 insertions, 19 deletions
diff --git a/library/std/src/sys/unsupported/os.rs b/library/std/src/sys/unsupported/os.rs
index e150ae143..248b34829 100644
--- a/library/std/src/sys/unsupported/os.rs
+++ b/library/std/src/sys/unsupported/os.rs
@@ -65,10 +65,26 @@ pub fn current_exe() -> io::Result<PathBuf> {
pub struct Env(!);
+impl Env {
+ // FIXME(https://github.com/rust-lang/rust/issues/114583): Remove this when <OsStr as Debug>::fmt matches <str as Debug>::fmt.
+ pub fn str_debug(&self) -> impl fmt::Debug + '_ {
+ let Self(inner) = self;
+ match *inner {}
+ }
+}
+
+impl fmt::Debug for Env {
+ fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result {
+ let Self(inner) = self;
+ match *inner {}
+ }
+}
+
impl Iterator for Env {
type Item = (OsString, OsString);
fn next(&mut self) -> Option<(OsString, OsString)> {
- self.0
+ let Self(inner) = self;
+ match *inner {}
}
}
diff --git a/library/std/src/sys/unsupported/process.rs b/library/std/src/sys/unsupported/process.rs
index a494f2d6b..77b675aaa 100644
--- a/library/std/src/sys/unsupported/process.rs
+++ b/library/std/src/sys/unsupported/process.rs
@@ -99,58 +99,59 @@ impl fmt::Debug for Command {
}
}
-pub struct ExitStatus(!);
+#[derive(PartialEq, Eq, Clone, Copy, Debug, Default)]
+#[non_exhaustive]
+pub struct ExitStatus();
impl ExitStatus {
pub fn exit_ok(&self) -> Result<(), ExitStatusError> {
- self.0
+ Ok(())
}
pub fn code(&self) -> Option<i32> {
- self.0
+ Some(0)
}
}
-impl Clone for ExitStatus {
- fn clone(&self) -> ExitStatus {
- self.0
+impl fmt::Display for ExitStatus {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ write!(f, "<dummy exit status>")
}
}
-impl Copy for ExitStatus {}
+pub struct ExitStatusError(!);
-impl PartialEq for ExitStatus {
- fn eq(&self, _other: &ExitStatus) -> bool {
+impl Clone for ExitStatusError {
+ fn clone(&self) -> ExitStatusError {
self.0
}
}
-impl Eq for ExitStatus {}
+impl Copy for ExitStatusError {}
-impl fmt::Debug for ExitStatus {
- fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
+impl PartialEq for ExitStatusError {
+ fn eq(&self, _other: &ExitStatusError) -> bool {
self.0
}
}
-impl fmt::Display for ExitStatus {
+impl Eq for ExitStatusError {}
+
+impl fmt::Debug for ExitStatusError {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0
}
}
-#[derive(PartialEq, Eq, Clone, Copy, Debug)]
-pub struct ExitStatusError(ExitStatus);
-
impl Into<ExitStatus> for ExitStatusError {
fn into(self) -> ExitStatus {
- self.0.0
+ self.0
}
}
impl ExitStatusError {
pub fn code(self) -> Option<NonZeroI32> {
- self.0.0
+ self.0
}
}