Skip to content

Commit a2baea4

Browse files
committed
---
yaml --- r: 95148 b: refs/heads/dist-snap c: 019b131 h: refs/heads/master v: v3
1 parent 12f05e3 commit a2baea4

File tree

9 files changed

+59
-60
lines changed

9 files changed

+59
-60
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: ccd9a963f75074da506c05fece1e3c965e742c51
9+
refs/heads/dist-snap: 019b131e12f49f1953a52865c1f19b025c73c06e
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/libextra/time.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,7 @@ fn do_strftime(format: &str, tm: &Tm) -> ~str {
788788
}
789789

790790
fn parse_type(ch: char, tm: &Tm) -> ~str {
791+
//FIXME (#2350): Implement missing types.
791792
let die = || format!("strftime: can't understand this format {} ", ch);
792793
match ch {
793794
'A' => match tm.tm_wday as int {
@@ -919,9 +920,10 @@ fn do_strftime(format: &str, tm: &Tm) -> ~str {
919920
parse_type('b', tm),
920921
parse_type('Y', tm))
921922
}
922-
'W' => format!("{:02d}", (tm.tm_yday - (tm.tm_wday - 1 + 7) % 7 + 7)
923-
/ 7),
923+
//'W' {}
924924
'w' => (tm.tm_wday as int).to_str(),
925+
//'X' {}
926+
//'x' {}
925927
'Y' => (tm.tm_year as int + 1900).to_str(),
926928
'y' => format!("{:02d}", (tm.tm_year as int + 1900) % 100),
927929
'Z' => tm.tm_zone.clone(),
@@ -932,7 +934,7 @@ fn do_strftime(format: &str, tm: &Tm) -> ~str {
932934
m -= h * 60_i32;
933935
format!("{}{:02d}{:02d}", sign, h, m)
934936
}
935-
'+' => tm.rfc3339(),
937+
//'+' {}
936938
'%' => ~"%",
937939
_ => die()
938940
}
@@ -1295,13 +1297,12 @@ mod tests {
12951297
assert_eq!(local.strftime("%u"), ~"5");
12961298
assert_eq!(local.strftime("%V"), ~"07");
12971299
assert_eq!(local.strftime("%v"), ~"13-Feb-2009");
1298-
assert_eq!(local.strftime("%W"), ~"06");
1300+
// assert!(local.strftime("%W") == "06");
12991301
assert_eq!(local.strftime("%w"), ~"5");
1300-
assert_eq!(local.strftime("%X"), ~"15:31:30"); // FIXME (#2350): support locale
1301-
assert_eq!(local.strftime("%x"), ~"02/13/09"); // FIXME (#2350): support locale
1302+
// handle "%X"
1303+
// handle "%x"
13021304
assert_eq!(local.strftime("%Y"), ~"2009");
13031305
assert_eq!(local.strftime("%y"), ~"09");
1304-
assert_eq!(local.strftime("%+"), ~"2009-02-13T15:31:30-08:00");
13051306
13061307
// FIXME (#2350): We should probably standardize on the timezone
13071308
// abbreviation.

branches/dist-snap/src/libstd/rt/io/native/file.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ use libc::{c_int, FILE};
1717
#[allow(non_camel_case_types)]
1818
pub type fd_t = c_int;
1919

20-
// Make this a newtype so we can't do I/O on arbitrary integers
21-
pub struct FileDesc(fd_t);
20+
pub struct FileDesc {
21+
priv fd: fd_t
22+
}
2223

2324
impl FileDesc {
2425
/// Create a `FileDesc` from an open C file descriptor.
@@ -46,7 +47,9 @@ impl Seek for FileDesc {
4647
fn seek(&mut self, _pos: i64, _style: SeekStyle) { fail2!() }
4748
}
4849

49-
pub struct CFile(*FILE);
50+
pub struct CFile {
51+
priv file: *FILE
52+
}
5053

5154
impl CFile {
5255
/// Create a `CFile` from an open `FILE` pointer.

branches/dist-snap/src/libstd/rt/io/net/tcp.rs

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ use rt::rtio::{IoFactory, IoFactoryObject,
2020
RtioTcpStream, RtioTcpStreamObject};
2121
use rt::local::Local;
2222

23-
pub struct TcpStream(~RtioTcpStreamObject);
23+
pub struct TcpStream {
24+
priv obj: ~RtioTcpStreamObject
25+
}
2426

2527
impl TcpStream {
2628
fn new(s: ~RtioTcpStreamObject) -> TcpStream {
27-
TcpStream(s)
29+
TcpStream { obj: s }
2830
}
2931

3032
pub fn connect(addr: SocketAddr) -> Option<TcpStream> {
@@ -46,7 +48,7 @@ impl TcpStream {
4648
}
4749

4850
pub fn peer_name(&mut self) -> Option<SocketAddr> {
49-
match (**self).peer_name() {
51+
match self.obj.peer_name() {
5052
Ok(pn) => Some(pn),
5153
Err(ioerr) => {
5254
rtdebug!("failed to get peer name: {:?}", ioerr);
@@ -57,7 +59,7 @@ impl TcpStream {
5759
}
5860

5961
pub fn socket_name(&mut self) -> Option<SocketAddr> {
60-
match (**self).socket_name() {
62+
match self.obj.socket_name() {
6163
Ok(sn) => Some(sn),
6264
Err(ioerr) => {
6365
rtdebug!("failed to get socket name: {:?}", ioerr);
@@ -70,7 +72,7 @@ impl TcpStream {
7072

7173
impl Reader for TcpStream {
7274
fn read(&mut self, buf: &mut [u8]) -> Option<uint> {
73-
match (**self).read(buf) {
75+
match self.obj.read(buf) {
7476
Ok(read) => Some(read),
7577
Err(ioerr) => {
7678
// EOF is indicated by returning None
@@ -87,7 +89,7 @@ impl Reader for TcpStream {
8789

8890
impl Writer for TcpStream {
8991
fn write(&mut self, buf: &[u8]) {
90-
match (**self).write(buf) {
92+
match self.obj.write(buf) {
9193
Ok(_) => (),
9294
Err(ioerr) => io_error::cond.raise(ioerr),
9395
}
@@ -96,7 +98,9 @@ impl Writer for TcpStream {
9698
fn flush(&mut self) { /* no-op */ }
9799
}
98100

99-
pub struct TcpListener(~RtioTcpListenerObject);
101+
pub struct TcpListener {
102+
priv obj: ~RtioTcpListenerObject
103+
}
100104

101105
impl TcpListener {
102106
pub fn bind(addr: SocketAddr) -> Option<TcpListener> {
@@ -105,7 +109,7 @@ impl TcpListener {
105109
(*io).tcp_bind(addr)
106110
};
107111
match listener {
108-
Ok(l) => Some(TcpListener(l)),
112+
Ok(l) => Some(TcpListener { obj: l }),
109113
Err(ioerr) => {
110114
io_error::cond.raise(ioerr);
111115
return None;
@@ -114,7 +118,7 @@ impl TcpListener {
114118
}
115119

116120
pub fn socket_name(&mut self) -> Option<SocketAddr> {
117-
match (**self).socket_name() {
121+
match self.obj.socket_name() {
118122
Ok(sn) => Some(sn),
119123
Err(ioerr) => {
120124
rtdebug!("failed to get socket name: {:?}", ioerr);
@@ -127,8 +131,8 @@ impl TcpListener {
127131

128132
impl Listener<TcpStream, TcpAcceptor> for TcpListener {
129133
fn listen(self) -> Option<TcpAcceptor> {
130-
match (**self).listen() {
131-
Ok(acceptor) => Some(TcpAcceptor(acceptor)),
134+
match self.obj.listen() {
135+
Ok(acceptor) => Some(TcpAcceptor { obj: acceptor }),
132136
Err(ioerr) => {
133137
io_error::cond.raise(ioerr);
134138
None
@@ -137,11 +141,13 @@ impl Listener<TcpStream, TcpAcceptor> for TcpListener {
137141
}
138142
}
139143

140-
pub struct TcpAcceptor(~RtioTcpAcceptorObject);
144+
pub struct TcpAcceptor {
145+
priv obj: ~RtioTcpAcceptorObject
146+
}
141147

142148
impl Acceptor<TcpStream> for TcpAcceptor {
143149
fn accept(&mut self) -> Option<TcpStream> {
144-
match (**self).accept() {
150+
match self.obj.accept() {
145151
Ok(s) => Some(TcpStream::new(s)),
146152
Err(ioerr) => {
147153
io_error::cond.raise(ioerr);

branches/dist-snap/src/libstd/rt/io/net/udp.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ use rt::io::{io_error, read_error, EndOfFile};
1616
use rt::rtio::{RtioSocket, RtioUdpSocketObject, RtioUdpSocket, IoFactory, IoFactoryObject};
1717
use rt::local::Local;
1818

19-
pub struct UdpSocket(~RtioUdpSocketObject);
19+
pub struct UdpSocket {
20+
priv obj: ~RtioUdpSocketObject
21+
}
2022

2123
impl UdpSocket {
2224
pub fn bind(addr: SocketAddr) -> Option<UdpSocket> {
@@ -25,7 +27,7 @@ impl UdpSocket {
2527
(*factory).udp_bind(addr)
2628
};
2729
match socket {
28-
Ok(s) => Some(UdpSocket(s)),
30+
Ok(s) => Some(UdpSocket { obj: s }),
2931
Err(ioerr) => {
3032
io_error::cond.raise(ioerr);
3133
None
@@ -34,7 +36,7 @@ impl UdpSocket {
3436
}
3537

3638
pub fn recvfrom(&mut self, buf: &mut [u8]) -> Option<(uint, SocketAddr)> {
37-
match (**self).recvfrom(buf) {
39+
match self.obj.recvfrom(buf) {
3840
Ok((nread, src)) => Some((nread, src)),
3941
Err(ioerr) => {
4042
// EOF is indicated by returning None
@@ -47,7 +49,7 @@ impl UdpSocket {
4749
}
4850

4951
pub fn sendto(&mut self, buf: &[u8], dst: SocketAddr) {
50-
match (**self).sendto(buf, dst) {
52+
match self.obj.sendto(buf, dst) {
5153
Ok(_) => (),
5254
Err(ioerr) => io_error::cond.raise(ioerr),
5355
}
@@ -58,7 +60,7 @@ impl UdpSocket {
5860
}
5961

6062
pub fn socket_name(&mut self) -> Option<SocketAddr> {
61-
match (***self).socket_name() {
63+
match self.obj.socket_name() {
6264
Ok(sn) => Some(sn),
6365
Err(ioerr) => {
6466
rtdebug!("failed to get socket name: {:?}", ioerr);
@@ -70,8 +72,8 @@ impl UdpSocket {
7072
}
7173

7274
pub struct UdpStream {
73-
socket: UdpSocket,
74-
connectedTo: SocketAddr
75+
priv socket: UdpSocket,
76+
priv connectedTo: SocketAddr
7577
}
7678

7779
impl UdpStream {

branches/dist-snap/src/libstd/rt/io/pipe.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ use rt::local::Local;
2020
use rt::rtio::{RtioPipe, RtioPipeObject, IoFactoryObject, IoFactory};
2121
use rt::rtio::RtioUnboundPipeObject;
2222

23-
pub struct PipeStream(RtioPipeObject);
23+
pub struct PipeStream {
24+
priv obj: RtioPipeObject
25+
}
26+
27+
// This should not be a newtype, but rt::uv::process::set_stdio needs to reach
28+
// into the internals of this :(
2429
pub struct UnboundPipeStream(~RtioUnboundPipeObject);
2530

2631
impl PipeStream {
@@ -41,13 +46,13 @@ impl PipeStream {
4146
}
4247

4348
pub fn bind(inner: RtioPipeObject) -> PipeStream {
44-
PipeStream(inner)
49+
PipeStream { obj: inner }
4550
}
4651
}
4752

4853
impl Reader for PipeStream {
4954
fn read(&mut self, buf: &mut [u8]) -> Option<uint> {
50-
match (**self).read(buf) {
55+
match self.obj.read(buf) {
5156
Ok(read) => Some(read),
5257
Err(ioerr) => {
5358
// EOF is indicated by returning None
@@ -64,7 +69,7 @@ impl Reader for PipeStream {
6469

6570
impl Writer for PipeStream {
6671
fn write(&mut self, buf: &[u8]) {
67-
match (**self).write(buf) {
72+
match self.obj.write(buf) {
6873
Ok(_) => (),
6974
Err(ioerr) => {
7075
io_error::cond.raise(ioerr);

branches/dist-snap/src/libstd/rt/io/timer.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ use rt::rtio::{IoFactory, IoFactoryObject,
1515
RtioTimer, RtioTimerObject};
1616
use rt::local::Local;
1717

18-
pub struct Timer(~RtioTimerObject);
18+
pub struct Timer {
19+
priv obj: ~RtioTimerObject
20+
}
1921

2022
/// Sleep the current task for `msecs` milliseconds.
2123
pub fn sleep(msecs: u64) {
@@ -34,7 +36,7 @@ impl Timer {
3436
(*io).timer_init()
3537
};
3638
match timer {
37-
Ok(t) => Some(Timer(t)),
39+
Ok(t) => Some(Timer { obj: t }),
3840
Err(ioerr) => {
3941
rtdebug!("Timer::init: failed to init: {:?}", ioerr);
4042
io_error::cond.raise(ioerr);
@@ -44,7 +46,7 @@ impl Timer {
4446
}
4547

4648
pub fn sleep(&mut self, msecs: u64) {
47-
(**self).sleep(msecs);
49+
self.obj.sleep(msecs);
4850
}
4951
}
5052

branches/dist-snap/src/libstd/str.rs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ use option::{None, Option, Some};
105105
use ptr;
106106
use ptr::RawPtr;
107107
use to_str::ToStr;
108-
use from_str::FromStr;
109108
use uint;
110109
use vec;
111110
use vec::{OwnedVector, OwnedCopyableVector, ImmutableVector, MutableVector};
@@ -205,11 +204,6 @@ impl ToStr for ~str {
205204
fn to_str(&self) -> ~str { self.to_owned() }
206205
}
207206

208-
impl FromStr for ~str {
209-
#[inline]
210-
fn from_str(s: &str) -> Option<~str> { Some(s.to_owned()) }
211-
}
212-
213207
impl<'self> ToStr for &'self str {
214208
#[inline]
215209
fn to_str(&self) -> ~str { self.to_owned() }
@@ -220,11 +214,6 @@ impl ToStr for @str {
220214
fn to_str(&self) -> ~str { self.to_owned() }
221215
}
222216

223-
impl<'self> FromStr for @str {
224-
#[inline]
225-
fn from_str(s: &str) -> Option<@str> { Some(s.to_managed()) }
226-
}
227-
228217
/// Convert a byte to a UTF-8 string
229218
///
230219
/// # Failure
@@ -2591,14 +2580,13 @@ impl Default for @str {
25912580
#[cfg(test)]
25922581
mod tests {
25932582
use container::Container;
2594-
use option::{None, Some, Option};
2583+
use option::{None, Some};
25952584
use ptr;
25962585
use str::*;
25972586
use vec;
25982587
use vec::{Vector, ImmutableVector, CopyableVector};
25992588
use cmp::{TotalOrd, Less, Equal, Greater};
26002589
use send_str::{SendStrOwned, SendStrStatic};
2601-
use from_str::from_str;
26022590
26032591
#[test]
26042592
fn test_eq() {
@@ -3901,14 +3889,6 @@ mod tests {
39013889
assert_eq!("abcde".to_send_str(), SendStrStatic("abcde"));
39023890
assert_eq!("abcde".to_send_str(), SendStrOwned(~"abcde"));
39033891
}
3904-
3905-
#[test]
3906-
fn test_from_str() {
3907-
let owned: Option<~str> = from_str(&"string");
3908-
assert_eq!(owned, Some(~"string"));
3909-
let managed: Option<@str> = from_str(&"string");
3910-
assert_eq!(managed, Some(@"string"));
3911-
}
39123892
}
39133893
39143894
#[cfg(test)]

branches/dist-snap/src/test/run-pass/rtio-processes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ fn read_all(input: &mut Reader) -> ~str {
8484
let mut buf = [0, ..1024];
8585
loop {
8686
match input.read(buf) {
87-
None | Some(0) => { break }
87+
None => { break }
8888
Some(n) => { ret = ret + str::from_utf8(buf.slice_to(n)); }
8989
}
9090
}

0 commit comments

Comments
 (0)