File tree 8 files changed +13
-80
lines changed
8 files changed +13
-80
lines changed Original file line number Diff line number Diff line change @@ -286,6 +286,9 @@ pub use self::stdio::{_print, _eprint};
286
286
#[ doc( no_inline, hidden) ]
287
287
pub use self :: stdio:: { set_panic, set_print} ;
288
288
289
+ // Used inside the standard library for panic output.
290
+ pub ( crate ) use self :: stdio:: stderr_raw;
291
+
289
292
pub mod prelude;
290
293
mod buffered;
291
294
mod cursor;
Original file line number Diff line number Diff line change @@ -32,7 +32,9 @@ struct StdoutRaw(stdio::Stdout);
32
32
///
33
33
/// This handle is not synchronized or buffered in any fashion. Constructed via
34
34
/// the `std::io::stdio::stderr_raw` function.
35
- struct StderrRaw ( stdio:: Stderr ) ;
35
+ ///
36
+ /// Not exposed, but used inside the standard library for panic output.
37
+ pub ( crate ) struct StderrRaw ( stdio:: Stderr ) ;
36
38
37
39
/// Constructs a new raw handle to the standard input of this process.
38
40
///
@@ -61,7 +63,9 @@ fn stdout_raw() -> io::Result<StdoutRaw> { stdio::Stdout::new().map(StdoutRaw) }
61
63
///
62
64
/// The returned handle has no external synchronization or buffering layered on
63
65
/// top.
64
- fn stderr_raw ( ) -> io:: Result < StderrRaw > { stdio:: Stderr :: new ( ) . map ( StderrRaw ) }
66
+ ///
67
+ /// Not exposed, but used inside the standard library for panic output.
68
+ pub ( crate ) fn stderr_raw ( ) -> io:: Result < StderrRaw > { stdio:: Stderr :: new ( ) . map ( StderrRaw ) }
65
69
66
70
impl Read for StdinRaw {
67
71
fn read ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < usize > { self . 0 . read ( buf) }
Original file line number Diff line number Diff line change @@ -49,19 +49,6 @@ impl Stderr {
49
49
}
50
50
}
51
51
52
- // FIXME: right now this raw stderr handle is used in a few places because
53
- // std::io::stderr_raw isn't exposed, but once that's exposed this impl
54
- // should go away
55
- impl io:: Write for Stderr {
56
- fn write ( & mut self , data : & [ u8 ] ) -> io:: Result < usize > {
57
- Stderr :: write ( self , data)
58
- }
59
-
60
- fn flush ( & mut self ) -> io:: Result < ( ) > {
61
- Stderr :: flush ( self )
62
- }
63
- }
64
-
65
52
pub fn is_ebadf ( err : & io:: Error ) -> bool {
66
53
err. raw_os_error ( ) == Some ( abi:: errno:: BADF as i32 )
67
54
}
Original file line number Diff line number Diff line change @@ -47,25 +47,12 @@ impl Stderr {
47
47
}
48
48
}
49
49
50
- // FIXME: right now this raw stderr handle is used in a few places because
51
- // std::io::stderr_raw isn't exposed, but once that's exposed this impl
52
- // should go away
53
- impl io:: Write for Stderr {
54
- fn write ( & mut self , data : & [ u8 ] ) -> io:: Result < usize > {
55
- Stderr :: write ( self , data)
56
- }
57
-
58
- fn flush ( & mut self ) -> io:: Result < ( ) > {
59
- Stderr :: flush ( self )
60
- }
61
- }
62
-
63
50
pub fn is_ebadf ( err : & io:: Error ) -> bool {
64
51
err. raw_os_error ( ) == Some ( :: sys:: syscall:: EBADF as i32 )
65
52
}
66
53
67
54
pub const STDIN_BUF_SIZE : usize = :: sys_common:: io:: DEFAULT_BUF_SIZE ;
68
55
69
56
pub fn panic_output ( ) -> Option < impl io:: Write > {
70
- Stderr :: new ( ) . ok ( )
57
+ io :: stderr_raw ( ) . ok ( )
71
58
}
Original file line number Diff line number Diff line change @@ -46,19 +46,6 @@ impl Stderr {
46
46
}
47
47
}
48
48
49
- // FIXME: right now this raw stderr handle is used in a few places because
50
- // std::io::stderr_raw isn't exposed, but once that's exposed this impl
51
- // should go away
52
- impl io:: Write for Stderr {
53
- fn write ( & mut self , data : & [ u8 ] ) -> io:: Result < usize > {
54
- Stderr :: write ( self , data)
55
- }
56
-
57
- fn flush ( & mut self ) -> io:: Result < ( ) > {
58
- Stderr :: flush ( self )
59
- }
60
- }
61
-
62
49
pub const STDIN_BUF_SIZE : usize = :: sys_common:: io:: DEFAULT_BUF_SIZE ;
63
50
64
51
pub fn is_ebadf ( err : & io:: Error ) -> bool {
Original file line number Diff line number Diff line change @@ -47,25 +47,12 @@ impl Stderr {
47
47
}
48
48
}
49
49
50
- // FIXME: right now this raw stderr handle is used in a few places because
51
- // std::io::stderr_raw isn't exposed, but once that's exposed this impl
52
- // should go away
53
- impl io:: Write for Stderr {
54
- fn write ( & mut self , data : & [ u8 ] ) -> io:: Result < usize > {
55
- Stderr :: write ( self , data)
56
- }
57
-
58
- fn flush ( & mut self ) -> io:: Result < ( ) > {
59
- Stderr :: flush ( self )
60
- }
61
- }
62
-
63
50
pub fn is_ebadf ( err : & io:: Error ) -> bool {
64
51
err. raw_os_error ( ) == Some ( libc:: EBADF as i32 )
65
52
}
66
53
67
54
pub const STDIN_BUF_SIZE : usize = :: sys_common:: io:: DEFAULT_BUF_SIZE ;
68
55
69
56
pub fn panic_output ( ) -> Option < impl io:: Write > {
70
- Stderr :: new ( ) . ok ( )
57
+ io :: stderr_raw ( ) . ok ( )
71
58
}
Original file line number Diff line number Diff line change @@ -45,15 +45,6 @@ impl Stderr {
45
45
}
46
46
}
47
47
48
- impl io:: Write for Stderr {
49
- fn write ( & mut self , data : & [ u8 ] ) -> io:: Result < usize > {
50
- ( & * self ) . write ( data)
51
- }
52
- fn flush ( & mut self ) -> io:: Result < ( ) > {
53
- ( & * self ) . flush ( )
54
- }
55
- }
56
-
57
48
pub const STDIN_BUF_SIZE : usize = 0 ;
58
49
59
50
pub fn is_ebadf ( _err : & io:: Error ) -> bool {
@@ -62,7 +53,7 @@ pub fn is_ebadf(_err: &io::Error) -> bool {
62
53
63
54
pub fn panic_output ( ) -> Option < impl io:: Write > {
64
55
if cfg ! ( feature = "wasm_syscall" ) {
65
- Stderr :: new ( ) . ok ( )
56
+ io :: stderr_raw ( ) . ok ( )
66
57
} else {
67
58
None
68
59
}
Original file line number Diff line number Diff line change @@ -165,19 +165,6 @@ impl Stderr {
165
165
}
166
166
}
167
167
168
- // FIXME: right now this raw stderr handle is used in a few places because
169
- // std::io::stderr_raw isn't exposed, but once that's exposed this impl
170
- // should go away
171
- impl io:: Write for Stderr {
172
- fn write ( & mut self , data : & [ u8 ] ) -> io:: Result < usize > {
173
- Stderr :: write ( self , data)
174
- }
175
-
176
- fn flush ( & mut self ) -> io:: Result < ( ) > {
177
- Stderr :: flush ( self )
178
- }
179
- }
180
-
181
168
impl Output {
182
169
pub fn handle ( & self ) -> c:: HANDLE {
183
170
match * self {
@@ -216,5 +203,5 @@ pub fn is_ebadf(err: &io::Error) -> bool {
216
203
pub const STDIN_BUF_SIZE : usize = 8 * 1024 ;
217
204
218
205
pub fn panic_output ( ) -> Option < impl io:: Write > {
219
- Stderr :: new ( ) . ok ( )
206
+ io :: stderr_raw ( ) . ok ( )
220
207
}
You can’t perform that action at this time.
0 commit comments