File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
src/test/ui/stdlib-unit-tests Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -437,6 +437,29 @@ impl Read for Stdin {
437437 }
438438}
439439
440+
441+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
442+ impl Read for & Stdin {
443+ fn read ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
444+ self . lock ( ) . read ( buf)
445+ }
446+ fn read_vectored ( & mut self , bufs : & mut [ IoSliceMut < ' _ > ] ) -> io:: Result < usize > {
447+ self . lock ( ) . read_vectored ( bufs)
448+ }
449+ #[ inline]
450+ fn is_read_vectored ( & self ) -> bool {
451+ self . lock ( ) . is_read_vectored ( )
452+ }
453+ fn read_to_end ( & mut self , buf : & mut Vec < u8 > ) -> io:: Result < usize > {
454+ self . lock ( ) . read_to_end ( buf)
455+ }
456+ fn read_to_string ( & mut self , buf : & mut String ) -> io:: Result < usize > {
457+ self . lock ( ) . read_to_string ( buf)
458+ }
459+ fn read_exact ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < ( ) > {
460+ self . lock ( ) . read_exact ( buf)
461+ }
462+ }
440463// only used by platform-dependent io::copy specializations, i.e. unused on some platforms
441464#[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
442465impl StdinLock < ' _ > {
Original file line number Diff line number Diff line change 1+ // check-pass
2+ use std:: io:: { self , Read } ;
3+
4+ fn main ( ) {
5+ let x = io:: stdin ( ) ;
6+ foo ( & x) ;
7+ }
8+
9+ fn foo < T : Read > ( t : T ) { }
You can’t perform that action at this time.
0 commit comments