File tree Expand file tree Collapse file tree 8 files changed +13
-80
lines changed Expand file tree Collapse file tree 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};
286286#[ doc( no_inline, hidden) ]
287287pub use self :: stdio:: { set_panic, set_print} ;
288288
289+ // Used inside the standard library for panic output.
290+ pub ( crate ) use self :: stdio:: stderr_raw;
291+
289292pub mod prelude;
290293mod buffered;
291294mod cursor;
Original file line number Diff line number Diff line change @@ -32,7 +32,9 @@ struct StdoutRaw(stdio::Stdout);
3232///
3333/// This handle is not synchronized or buffered in any fashion. Constructed via
3434/// 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 ) ;
3638
3739/// Constructs a new raw handle to the standard input of this process.
3840///
@@ -61,7 +63,9 @@ fn stdout_raw() -> io::Result<StdoutRaw> { stdio::Stdout::new().map(StdoutRaw) }
6163///
6264/// The returned handle has no external synchronization or buffering layered on
6365/// 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 ) }
6569
6670impl Read for StdinRaw {
6771 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 {
4949 }
5050}
5151
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-
6552pub fn is_ebadf ( err : & io:: Error ) -> bool {
6653 err. raw_os_error ( ) == Some ( abi:: errno:: BADF as i32 )
6754}
Original file line number Diff line number Diff line change @@ -47,25 +47,12 @@ impl Stderr {
4747 }
4848}
4949
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-
6350pub fn is_ebadf ( err : & io:: Error ) -> bool {
6451 err. raw_os_error ( ) == Some ( :: sys:: syscall:: EBADF as i32 )
6552}
6653
6754pub const STDIN_BUF_SIZE : usize = :: sys_common:: io:: DEFAULT_BUF_SIZE ;
6855
6956pub fn panic_output ( ) -> Option < impl io:: Write > {
70- Stderr :: new ( ) . ok ( )
57+ io :: stderr_raw ( ) . ok ( )
7158}
Original file line number Diff line number Diff line change @@ -46,19 +46,6 @@ impl Stderr {
4646 }
4747}
4848
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-
6249pub const STDIN_BUF_SIZE : usize = :: sys_common:: io:: DEFAULT_BUF_SIZE ;
6350
6451pub fn is_ebadf ( err : & io:: Error ) -> bool {
Original file line number Diff line number Diff line change @@ -47,25 +47,12 @@ impl Stderr {
4747 }
4848}
4949
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-
6350pub fn is_ebadf ( err : & io:: Error ) -> bool {
6451 err. raw_os_error ( ) == Some ( libc:: EBADF as i32 )
6552}
6653
6754pub const STDIN_BUF_SIZE : usize = :: sys_common:: io:: DEFAULT_BUF_SIZE ;
6855
6956pub fn panic_output ( ) -> Option < impl io:: Write > {
70- Stderr :: new ( ) . ok ( )
57+ io :: stderr_raw ( ) . ok ( )
7158}
Original file line number Diff line number Diff line change @@ -45,15 +45,6 @@ impl Stderr {
4545 }
4646}
4747
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-
5748pub const STDIN_BUF_SIZE : usize = 0 ;
5849
5950pub fn is_ebadf ( _err : & io:: Error ) -> bool {
@@ -62,7 +53,7 @@ pub fn is_ebadf(_err: &io::Error) -> bool {
6253
6354pub fn panic_output ( ) -> Option < impl io:: Write > {
6455 if cfg ! ( feature = "wasm_syscall" ) {
65- Stderr :: new ( ) . ok ( )
56+ io :: stderr_raw ( ) . ok ( )
6657 } else {
6758 None
6859 }
Original file line number Diff line number Diff line change @@ -165,19 +165,6 @@ impl Stderr {
165165 }
166166}
167167
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-
181168impl Output {
182169 pub fn handle ( & self ) -> c:: HANDLE {
183170 match * self {
@@ -216,5 +203,5 @@ pub fn is_ebadf(err: &io::Error) -> bool {
216203pub const STDIN_BUF_SIZE : usize = 8 * 1024 ;
217204
218205pub fn panic_output ( ) -> Option < impl io:: Write > {
219- Stderr :: new ( ) . ok ( )
206+ io :: stderr_raw ( ) . ok ( )
220207}
You can’t perform that action at this time.
0 commit comments