Skip to content

Commit 2b60633

Browse files
committed
Track Rust nightlies
1 parent 1e9c7b2 commit 2b60633

File tree

7 files changed

+30
-11
lines changed

7 files changed

+30
-11
lines changed

src/fcntl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub use self::consts::*;
77
pub use self::ffi::flock;
88

99
// Re-export Fd defined in std
10-
pub type Fd = ::std::os::unix::Fd;
10+
pub type Fd = ::std::os::unix::io::Fd;
1111

1212
#[allow(dead_code)]
1313
mod ffi {

src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! defined in.
55
#![crate_name = "nix"]
66

7-
#![feature(collections, core, net, linkage, libc, std_misc)]
7+
#![feature(collections, core, io_ext, linkage, libc, std_misc)]
88
#![allow(non_camel_case_types)]
99

1010
#[macro_use]
@@ -51,7 +51,7 @@ pub mod unistd;
5151
*/
5252

5353
use std::ffi::OsStr;
54-
use std::os::unix::OsStrExt;
54+
use std::os::unix::ffi::OsStrExt;
5555

5656
/// Converts a value to an external (FFI) string representation
5757
trait AsExtStr {

src/nix.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use libc;
22
use std::ffi::{OsStr, AsOsStr};
3-
use std::os::unix::OsStrExt;
3+
use std::os::unix::ffi::OsStrExt;
44
use std::path::{Path, PathBuf};
55
use std::slice::bytes;
66

src/sys/socket/addr.rs

+23-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ use std::{fmt, hash, mem, net, ptr};
66
use std::ffi::{CStr, OsStr};
77
use std::num::Int;
88
use std::path::Path;
9-
use std::os::unix::OsStrExt;
9+
use std::os::unix::ffi::OsStrExt;
10+
11+
// TODO: uncomment out IpAddr functions: rust-lang/rfcs#988
1012

1113
/*
1214
*
@@ -30,7 +32,12 @@ pub enum InetAddr {
3032

3133
impl InetAddr {
3234
pub fn from_std(std: &net::SocketAddr) -> InetAddr {
33-
InetAddr::new(IpAddr::from_std(&std.ip()), std.port())
35+
let ip = match *std {
36+
net::SocketAddr::V4(ref addr) => IpAddr::V4(Ipv4Addr::from_std(&addr.ip())),
37+
net::SocketAddr::V6(ref addr) => IpAddr::V6(Ipv6Addr::from_std(&addr.ip())),
38+
};
39+
40+
InetAddr::new(ip, std.port())
3441
}
3542

3643
pub fn new(ip: IpAddr, port: u16) -> InetAddr {
@@ -53,7 +60,6 @@ impl InetAddr {
5360
}
5461
}
5562
}
56-
5763
/// Gets the IP address associated with this socket address.
5864
pub fn ip(&self) -> IpAddr {
5965
match *self {
@@ -71,7 +77,18 @@ impl InetAddr {
7177
}
7278

7379
pub fn to_std(&self) -> net::SocketAddr {
74-
net::SocketAddr::new(self.ip().to_std(), self.port())
80+
match *self {
81+
InetAddr::V4(ref sa) => net::SocketAddr::V4(
82+
net::SocketAddrV4::new(
83+
Ipv4Addr(sa.sin_addr).to_std(),
84+
self.port())),
85+
InetAddr::V6(ref sa) => net::SocketAddr::V6(
86+
net::SocketAddrV6::new(
87+
Ipv6Addr(sa.sin6_addr).to_std(),
88+
self.port(),
89+
sa.sin6_flowinfo,
90+
sa.sin6_scope_id)),
91+
}
7592
}
7693

7794
pub fn to_str(&self) -> String {
@@ -160,6 +177,7 @@ impl IpAddr {
160177
IpAddr::V6(Ipv6Addr::new(a, b, c, d, e, f, g, h))
161178
}
162179

180+
/*
163181
pub fn from_std(std: &net::IpAddr) -> IpAddr {
164182
match *std {
165183
net::IpAddr::V4(ref std) => IpAddr::V4(Ipv4Addr::from_std(std)),
@@ -173,6 +191,7 @@ impl IpAddr {
173191
IpAddr::V6(ref ip) => net::IpAddr::V6(ip.to_std()),
174192
}
175193
}
194+
*/
176195
}
177196

178197
impl fmt::Display for IpAddr {

src/sys/socket/sockopt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use errno::Errno;
44
use sys::time::TimeVal;
55
use libc::{c_int, uint8_t, c_void, socklen_t};
66
use std::mem;
7-
use std::os::unix::Fd;
7+
use std::os::unix::io::Fd;
88

99
// Helper to generate the sockopt accessors
1010
// TODO: Figure out how to ommit gets when not supported by opt

test/sys/test_socket.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::{mem, net};
33
use std::num::Int;
44
use std::path::Path;
55
use std::str::FromStr;
6-
use std::os::unix::AsRawFd;
6+
use std::os::unix::io::AsRawFd;
77
use ports::localhost;
88

99
#[test]

test/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(core, libc, net, std_misc)]
1+
#![feature(core, io_ext, libc)]
22

33
extern crate nix;
44
extern crate libc;

0 commit comments

Comments
 (0)