diff options
| author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2023-09-09 11:24:53 +0100 |
|---|---|---|
| committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2023-09-09 11:24:53 +0100 |
| commit | 436fe0189564faf0547fc483d8999a62c94704aa (patch) | |
| tree | 139d16a7affd92f420aa0e40929f3e9739af2788 | |
| parent | 36295fad122fd7b94d46f7bcc83a7432b94aee96 (diff) | |
| download | rust-436fe0189564faf0547fc483d8999a62c94704aa.tar.gz rust-436fe0189564faf0547fc483d8999a62c94704aa.zip | |
std::process (unsupported): Implement From<io::Stdout> etc. for imp::Stdio
This implementation is wrong. Like the impl for From<File>, it is forced to panic because process::Stdio in unsupported/process.rs doesn't have a suitable variant. The root cause of the problem is that process::Stdio in unsupported/process.rs has any information in it at all. I'm pretty sure that it should just be a unit struct. However, making that build on all platforms is going to be a lot of work, iterating through CI and/or wrestling Docker. I don't think this extra panic is making things significantly worse. For now I have added some TODOs.
| -rw-r--r-- | library/std/src/sys/unsupported/process.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/library/std/src/sys/unsupported/process.rs b/library/std/src/sys/unsupported/process.rs index a494f2d6b4c..68e3728e27a 100644 --- a/library/std/src/sys/unsupported/process.rs +++ b/library/std/src/sys/unsupported/process.rs @@ -27,6 +27,8 @@ pub struct StdioPipes { pub stderr: Option<AnonPipe>, } +// FIXME: This should be a unit struct, so we can always construct it +// The value here should be never used, since we cannot spawn processes. pub enum Stdio { Inherit, Null, @@ -87,8 +89,26 @@ impl From<AnonPipe> for Stdio { } } +impl From<io::Stdout> for Stdio { + fn from(_: io::Stdout) -> Stdio { + // FIXME: This is wrong. + // Instead, the Stdio we have here should be a unit struct. + panic!("unsupported") + } +} + +impl From<io::Stderr> for Stdio { + fn from(_: io::Stderr) -> Stdio { + // FIXME: This is wrong. + // Instead, the Stdio we have here should be a unit struct. + panic!("unsupported") + } +} + impl From<File> for Stdio { fn from(_file: File) -> Stdio { + // FIXME: This is wrong. + // Instead, the Stdio we have here should be a unit struct. panic!("unsupported") } } |
