@@ -9,7 +9,7 @@ use std::time::Duration;
99use bufstream:: BufStream ;
1010#[ cfg( feature = "unix_socket" ) ]
1111use unix_socket:: UnixStream ;
12- #[ cfg( all( not( feature = "unix_socket" ) , feature = "nightly" ) ) ]
12+ #[ cfg( all( not( feature = "unix_socket" ) , all ( unix , feature = "nightly" ) ) ) ]
1313use std:: os:: unix:: net:: UnixStream ;
1414#[ cfg( unix) ]
1515use std:: os:: unix:: io:: { AsRawFd , RawFd } ;
@@ -34,15 +34,15 @@ impl StreamOptions for BufStream<Box<StreamWrapper>> {
3434 fn set_read_timeout ( & self , timeout : Option < Duration > ) -> io:: Result < ( ) > {
3535 match self . get_ref ( ) . get_ref ( ) . 0 {
3636 InternalStream :: Tcp ( ref s) => s. set_read_timeout ( timeout) ,
37- #[ cfg( any( feature = "unix_socket" , feature = "nightly" ) ) ]
37+ #[ cfg( any( feature = "unix_socket" , all ( unix , feature = "nightly" ) ) ) ]
3838 InternalStream :: Unix ( ref s) => s. set_read_timeout ( timeout) ,
3939 }
4040 }
4141
4242 fn set_nonblocking ( & self , nonblock : bool ) -> io:: Result < ( ) > {
4343 match self . get_ref ( ) . get_ref ( ) . 0 {
4444 InternalStream :: Tcp ( ref s) => s. set_nonblocking ( nonblock) ,
45- #[ cfg( any( feature = "unix_socket" , feature = "nightly" ) ) ]
45+ #[ cfg( any( feature = "unix_socket" , all ( unix , feature = "nightly" ) ) ) ]
4646 InternalStream :: Unix ( ref s) => s. set_nonblocking ( nonblock) ,
4747 }
4848 }
@@ -58,7 +58,7 @@ impl fmt::Debug for Stream {
5858 fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
5959 match self . 0 {
6060 InternalStream :: Tcp ( ref s) => fmt:: Debug :: fmt ( s, fmt) ,
61- #[ cfg( any( feature = "unix_socket" , feature = "nightly" ) ) ]
61+ #[ cfg( any( feature = "unix_socket" , all ( unix , feature = "nightly" ) ) ) ]
6262 InternalStream :: Unix ( ref s) => fmt:: Debug :: fmt ( s, fmt) ,
6363 }
6464 }
@@ -95,7 +95,7 @@ impl AsRawFd for Stream {
9595 fn as_raw_fd ( & self ) -> RawFd {
9696 match self . 0 {
9797 InternalStream :: Tcp ( ref s) => s. as_raw_fd ( ) ,
98- #[ cfg( any( feature = "unix_socket" , feature = "nightly" ) ) ]
98+ #[ cfg( any( feature = "unix_socket" , all ( unix , feature = "nightly" ) ) ) ]
9999 InternalStream :: Unix ( ref s) => s. as_raw_fd ( ) ,
100100 }
101101 }
@@ -113,15 +113,15 @@ impl AsRawSocket for Stream {
113113
114114enum InternalStream {
115115 Tcp ( TcpStream ) ,
116- #[ cfg( any( feature = "unix_socket" , feature = "nightly" ) ) ]
116+ #[ cfg( any( feature = "unix_socket" , all ( unix , feature = "nightly" ) ) ) ]
117117 Unix ( UnixStream ) ,
118118}
119119
120120impl Read for InternalStream {
121121 fn read ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
122122 match * self {
123123 InternalStream :: Tcp ( ref mut s) => s. read ( buf) ,
124- #[ cfg( any( feature = "unix_socket" , feature = "nightly" ) ) ]
124+ #[ cfg( any( feature = "unix_socket" , all ( unix , feature = "nightly" ) ) ) ]
125125 InternalStream :: Unix ( ref mut s) => s. read ( buf) ,
126126 }
127127 }
@@ -131,15 +131,15 @@ impl Write for InternalStream {
131131 fn write ( & mut self , buf : & [ u8 ] ) -> io:: Result < usize > {
132132 match * self {
133133 InternalStream :: Tcp ( ref mut s) => s. write ( buf) ,
134- #[ cfg( any( feature = "unix_socket" , feature = "nightly" ) ) ]
134+ #[ cfg( any( feature = "unix_socket" , all ( unix , feature = "nightly" ) ) ) ]
135135 InternalStream :: Unix ( ref mut s) => s. write ( buf) ,
136136 }
137137 }
138138
139139 fn flush ( & mut self ) -> io:: Result < ( ) > {
140140 match * self {
141141 InternalStream :: Tcp ( ref mut s) => s. flush ( ) ,
142- #[ cfg( any( feature = "unix_socket" , feature = "nightly" ) ) ]
142+ #[ cfg( any( feature = "unix_socket" , all ( unix , feature = "nightly" ) ) ) ]
143143 InternalStream :: Unix ( ref mut s) => s. flush ( ) ,
144144 }
145145 }
@@ -151,7 +151,7 @@ fn open_socket(params: &ConnectParams) -> Result<InternalStream, ConnectError> {
151151 ConnectTarget :: Tcp ( ref host) => {
152152 Ok ( try!( TcpStream :: connect ( & ( & * * host, port) ) . map ( InternalStream :: Tcp ) ) )
153153 }
154- #[ cfg( any( feature = "unix_socket" , feature = "nightly" ) ) ]
154+ #[ cfg( any( feature = "unix_socket" , all ( unix , feature = "nightly" ) ) ) ]
155155 ConnectTarget :: Unix ( ref path) => {
156156 let path = path. join ( & format ! ( ".s.PGSQL.{}" , port) ) ;
157157 Ok ( try!( UnixStream :: connect ( & path) . map ( InternalStream :: Unix ) ) )
@@ -185,7 +185,7 @@ pub fn initialize_stream(params: &ConnectParams,
185185 // Postgres doesn't support SSL over unix sockets
186186 let host = match params. target {
187187 ConnectTarget :: Tcp ( ref host) => host,
188- #[ cfg( any( feature = "unix_socket" , feature = "nightly" ) ) ]
188+ #[ cfg( any( feature = "unix_socket" , all ( unix , feature = "nightly" ) ) ) ]
189189 ConnectTarget :: Unix ( _) => return Err ( ConnectError :: Io ( :: bad_response ( ) ) ) ,
190190 } ;
191191
0 commit comments