88//! All items of this library are only available when the `std` feature of this
99//! library is activated, and it is activated by default.
1010
11- #![ cfg_attr( all( feature = "read-initializer" , feature = "std" ) , feature( read_initializer) ) ]
1211#![ cfg_attr( not( feature = "std" ) , no_std) ]
1312#![ warn( missing_debug_implementations, missing_docs, rust_2018_idioms, unreachable_pub) ]
1413// It cannot be included in the published code because this lints have false positives in the minimum required version.
2221) ) ]
2322#![ cfg_attr( docsrs, feature( doc_cfg) ) ]
2423
25- #[ cfg( all( feature = "read-initializer" , not( feature = "unstable" ) ) ) ]
26- compile_error ! ( "The `read-initializer` feature requires the `unstable` feature as an explicit opt-in to unstable features" ) ;
27-
2824#[ cfg( feature = "std" ) ]
2925mod if_std {
3026 use std:: io;
@@ -34,11 +30,6 @@ mod if_std {
3430
3531 // Re-export some types from `std::io` so that users don't have to deal
3632 // with conflicts when `use`ing `futures::io` and `std::io`.
37- #[ cfg( feature = "read-initializer" ) ]
38- #[ cfg_attr( docsrs, doc( cfg( feature = "read-initializer" ) ) ) ]
39- #[ doc( no_inline) ]
40- #[ allow( unreachable_pub) ] // https://github.com/rust-lang/rust/issues/57411
41- pub use io:: Initializer ;
4233 #[ allow( unreachable_pub) ] // https://github.com/rust-lang/rust/issues/57411
4334 #[ doc( no_inline) ]
4435 pub use io:: { Error , ErrorKind , IoSlice , IoSliceMut , Result , SeekFrom } ;
@@ -51,27 +42,6 @@ mod if_std {
5142 /// for wakeup and return if data is not yet available, rather than blocking
5243 /// the calling thread.
5344 pub trait AsyncRead {
54- /// Determines if this `AsyncRead`er can work with buffers of
55- /// uninitialized memory.
56- ///
57- /// The default implementation returns an initializer which will zero
58- /// buffers.
59- ///
60- /// This method is only available when the `read-initializer` feature of this
61- /// library is activated.
62- ///
63- /// # Safety
64- ///
65- /// This method is `unsafe` because an `AsyncRead`er could otherwise
66- /// return a non-zeroing `Initializer` from another `AsyncRead` type
67- /// without an `unsafe` block.
68- #[ cfg( feature = "read-initializer" ) ]
69- #[ cfg_attr( docsrs, doc( cfg( feature = "read-initializer" ) ) ) ]
70- #[ inline]
71- unsafe fn initializer ( & self ) -> Initializer {
72- Initializer :: zeroing ( )
73- }
74-
7545 /// Attempt to read from the `AsyncRead` into `buf`.
7646 ///
7747 /// On success, returns `Poll::Ready(Ok(num_bytes_read))`.
@@ -329,11 +299,6 @@ mod if_std {
329299
330300 macro_rules! deref_async_read {
331301 ( ) => {
332- #[ cfg( feature = "read-initializer" ) ]
333- unsafe fn initializer( & self ) -> Initializer {
334- ( * * self ) . initializer( )
335- }
336-
337302 fn poll_read(
338303 mut self : Pin <& mut Self >,
339304 cx: & mut Context <' _>,
@@ -365,11 +330,6 @@ mod if_std {
365330 P : DerefMut + Unpin ,
366331 P :: Target : AsyncRead ,
367332 {
368- #[ cfg( feature = "read-initializer" ) ]
369- unsafe fn initializer ( & self ) -> Initializer {
370- ( * * self ) . initializer ( )
371- }
372-
373333 fn poll_read (
374334 self : Pin < & mut Self > ,
375335 cx : & mut Context < ' _ > ,
@@ -389,11 +349,6 @@ mod if_std {
389349
390350 macro_rules! delegate_async_read_to_stdio {
391351 ( ) => {
392- #[ cfg( feature = "read-initializer" ) ]
393- unsafe fn initializer( & self ) -> Initializer {
394- io:: Read :: initializer( self )
395- }
396-
397352 fn poll_read(
398353 mut self : Pin <& mut Self >,
399354 _: & mut Context <' _>,
0 commit comments