Skip to content

Commit cf76e63

Browse files
committed
Auto merge of #25136 - alexcrichton:drop-the-two, r=aturon
* Remove the 2-suffix from some modules * Remove some unused files * Remove double-boxing for `ReentrantMutex`
2 parents b402c43 + 7529bd6 commit cf76e63

File tree

33 files changed

+72
-239
lines changed

33 files changed

+72
-239
lines changed

src/libstd/fs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use fmt;
2323
use ffi::OsString;
2424
use io::{self, Error, ErrorKind, SeekFrom, Seek, Read, Write};
2525
use path::{Path, PathBuf};
26-
use sys::fs2 as fs_imp;
26+
use sys::fs as fs_imp;
2727
use sys_common::{AsInnerMut, FromInner, AsInner};
2828
use vec::Vec;
2929

src/libstd/net/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use prelude::v1::*;
1616

1717
use io::{self, Error, ErrorKind};
18-
use sys_common::net2 as net_imp;
18+
use sys_common::net as net_imp;
1919

2020
pub use self::ip::{IpAddr, Ipv4Addr, Ipv6Addr, Ipv6MulticastScope};
2121
pub use self::addr::{SocketAddr, SocketAddrV4, SocketAddrV6, ToSocketAddrs};

src/libstd/net/tcp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use io::prelude::*;
1717
use fmt;
1818
use io;
1919
use net::{ToSocketAddrs, SocketAddr, Shutdown};
20-
use sys_common::net2 as net_imp;
20+
use sys_common::net as net_imp;
2121
use sys_common::{AsInner, FromInner};
2222

2323
/// A structure which represents a TCP stream between a local socket and a

src/libstd/net/udp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use prelude::v1::*;
1616
use fmt;
1717
use io::{self, Error, ErrorKind};
1818
use net::{ToSocketAddrs, SocketAddr, IpAddr};
19-
use sys_common::net2 as net_imp;
19+
use sys_common::net as net_imp;
2020
use sys_common::{AsInner, FromInner};
2121

2222
/// A User Datagram Protocol socket.

src/libstd/os/android/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
pub mod raw;
1616

1717
pub mod fs {
18-
pub use sys::fs2::MetadataExt;
18+
pub use sys::fs::MetadataExt;
1919
}

src/libstd/os/bitrig/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
pub mod raw;
1616

1717
pub mod fs {
18-
pub use sys::fs2::MetadataExt;
18+
pub use sys::fs::MetadataExt;
1919
}

src/libstd/os/dragonfly/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
pub mod raw;
1616

1717
pub mod fs {
18-
pub use sys::fs2::MetadataExt;
18+
pub use sys::fs::MetadataExt;
1919
}

src/libstd/os/freebsd/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
pub mod raw;
1616

1717
pub mod fs {
18-
pub use sys::fs2::MetadataExt;
18+
pub use sys::fs::MetadataExt;
1919
}

src/libstd/os/ios/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
pub mod raw;
1616

1717
pub mod fs {
18-
pub use sys::fs2::MetadataExt;
18+
pub use sys::fs::MetadataExt;
1919
}

src/libstd/os/linux/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
pub mod raw;
1616

1717
pub mod fs {
18-
pub use sys::fs2::MetadataExt;
18+
pub use sys::fs::MetadataExt;
1919
}

src/libstd/os/macos/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
pub mod raw;
1616

1717
pub mod fs {
18-
pub use sys::fs2::MetadataExt;
18+
pub use sys::fs::MetadataExt;
1919
}

src/libstd/os/nacl/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
pub mod raw;
1616

1717
pub mod fs {
18-
pub use sys::fs2::MetadataExt;
18+
pub use sys::fs::MetadataExt;
1919
}

src/libstd/os/openbsd/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
pub mod raw;
1616

1717
pub mod fs {
18-
pub use sys::fs2::MetadataExt;
18+
pub use sys::fs::MetadataExt;
1919
}

src/libstd/process.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ use fmt;
2121
use io::{self, Error, ErrorKind};
2222
use path;
2323
use sync::mpsc::{channel, Receiver};
24-
use sys::pipe2::{self, AnonPipe};
25-
use sys::process2::Command as CommandImp;
26-
use sys::process2::Process as ProcessImp;
27-
use sys::process2::ExitStatus as ExitStatusImp;
28-
use sys::process2::Stdio as StdioImp2;
24+
use sys::pipe::{self, AnonPipe};
25+
use sys::process::Command as CommandImp;
26+
use sys::process::Process as ProcessImp;
27+
use sys::process::ExitStatus as ExitStatusImp;
28+
use sys::process::Stdio as StdioImp2;
2929
use sys_common::{AsInner, AsInnerMut};
3030
use thread;
3131

@@ -334,7 +334,7 @@ fn setup_io(io: &StdioImp, readable: bool)
334334
Null => (StdioImp2::None, None),
335335
Inherit => (StdioImp2::Inherit, None),
336336
Piped => {
337-
let (reader, writer) = try!(pipe2::anon_pipe());
337+
let (reader, writer) = try!(pipe::anon_pipe());
338338
if readable {
339339
(StdioImp2::Piped(reader), Some(writer))
340340
} else {

src/libstd/sys/common/helper_thread.rs

-170
This file was deleted.

src/libstd/sys/common/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use prelude::v1::*;
1515
pub mod backtrace;
1616
pub mod condvar;
1717
pub mod mutex;
18-
pub mod net2;
18+
pub mod net;
1919
pub mod poison;
2020
pub mod remutex;
2121
pub mod rwlock;
File renamed without changes.

src/libstd/sys/common/remutex.rs

+11-7
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ use sys::mutex as sys;
1919

2020
/// A re-entrant mutual exclusion
2121
///
22-
/// This mutex will block *other* threads waiting for the lock to become available. The thread
23-
/// which has already locked the mutex can lock it multiple times without blocking, preventing a
24-
/// common source of deadlocks.
22+
/// This mutex will block *other* threads waiting for the lock to become
23+
/// available. The thread which has already locked the mutex can lock it
24+
/// multiple times without blocking, preventing a common source of deadlocks.
2525
pub struct ReentrantMutex<T> {
2626
inner: Box<sys::ReentrantMutex>,
2727
poison: poison::Flag,
@@ -51,10 +51,14 @@ impl<'a, T> !marker::Send for ReentrantMutexGuard<'a, T> {}
5151
impl<T> ReentrantMutex<T> {
5252
/// Creates a new reentrant mutex in an unlocked state.
5353
pub fn new(t: T) -> ReentrantMutex<T> {
54-
ReentrantMutex {
55-
inner: box unsafe { sys::ReentrantMutex::new() },
56-
poison: poison::FLAG_INIT,
57-
data: t,
54+
unsafe {
55+
let mut mutex = ReentrantMutex {
56+
inner: box sys::ReentrantMutex::uninitialized(),
57+
poison: poison::FLAG_INIT,
58+
data: t,
59+
};
60+
mutex.inner.init();
61+
return mutex
5862
}
5963
}
6064

src/libstd/sys/unix/ext/fs.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ impl OpenOptionsExt for OpenOptions {
102102
}
103103

104104
#[unstable(feature = "metadata_ext", reason = "recently added API")]
105-
pub struct Metadata(sys::fs2::FileAttr);
105+
pub struct Metadata(sys::fs::FileAttr);
106106

107107
#[unstable(feature = "metadata_ext", reason = "recently added API")]
108108
pub trait MetadataExt {
@@ -111,7 +111,7 @@ pub trait MetadataExt {
111111

112112
impl MetadataExt for fs::Metadata {
113113
fn as_raw(&self) -> &Metadata {
114-
let inner: &sys::fs2::FileAttr = self.as_inner();
114+
let inner: &sys::fs::FileAttr = self.as_inner();
115115
unsafe { mem::transmute(inner) }
116116
}
117117
}
@@ -187,7 +187,7 @@ impl DirEntryExt for fs::DirEntry {
187187
#[stable(feature = "rust1", since = "1.0.0")]
188188
pub fn symlink<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q) -> io::Result<()>
189189
{
190-
sys::fs2::symlink(src.as_ref(), dst.as_ref())
190+
sys::fs::symlink(src.as_ref(), dst.as_ref())
191191
}
192192

193193
#[unstable(feature = "dir_builder", reason = "recently added API")]

0 commit comments

Comments
 (0)