Skip to content

Commit 1c3cfd1

Browse files
committed
---
yaml --- r: 154318 b: refs/heads/try2 c: c3ce245 h: refs/heads/master v: v3
1 parent 9313055 commit 1c3cfd1

File tree

30 files changed

+430
-910
lines changed

30 files changed

+430
-910
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 28b5e4588f5d78d2dab830245bc453dd666af617
8+
refs/heads/try2: c3ce245ba68f62edfc5818f003b2b78a02ce5c03
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/compiletest/runtest.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ use std::os;
3030
use std::str;
3131
use std::string::String;
3232
use std::task;
33-
use std::time::Duration;
3433
use test::MetricMap;
3534

3635
pub fn run(config: Config, testfile: String) {
@@ -401,7 +400,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
401400
.expect(format!("failed to exec `{}`", config.adb_path).as_slice());
402401
loop {
403402
//waiting 1 second for gdbserver start
404-
timer::sleep(Duration::milliseconds(1000));
403+
timer::sleep(1000);
405404
let result = task::try(proc() {
406405
tcp::TcpStream::connect("127.0.0.1", 5039).unwrap();
407406
});

branches/try2/src/doc/guide-runtime.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ itself, yet again implying that they are not defined in the standard library.
128128
The full complement of runtime features is defined by the [`Runtime`
129129
trait](std/rt/trait.Runtime.html) and the [`Task`
130130
struct](std/rt/task/struct.Task.html). A `Task` is constant among all runtime
131-
implementations, but each runtime has its own implementation of the
131+
implementations, but each runtime implements has its own implementation of the
132132
`Runtime` trait.
133133

134134
The local `Task` stores the runtime value inside of itself, and then ownership

branches/try2/src/doc/guide-testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ per-iteration speed of.
198198

199199
For benchmarks relating to processing/generating data, one can set the
200200
`bytes` field to the number of bytes consumed/produced in each
201-
iteration; this will be used to show the throughput of the benchmark.
201+
iteration; this will used to show the throughput of the benchmark.
202202
This must be the amount used in each iteration, *not* the total
203203
amount.
204204

branches/try2/src/doc/guide-unsafe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ explicitly with, respectively, `value as *const T` and `value as *mut T`).
137137

138138
Going the opposite direction, from `*const` to a reference `&`, is not
139139
safe. A `&T` is always valid, and so, at a minimum, the raw pointer
140-
`*const T` has to point to a valid instance of type `T`. Furthermore,
140+
`*const T` has to be a valid to a valid instance of type `T`. Furthermore,
141141
the resulting pointer must satisfy the aliasing and mutability laws of
142142
references. The compiler assumes these properties are true for any
143143
references, no matter how they are created, and so any conversion from

branches/try2/src/doc/guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ This is not the same as this, which won't compile:
666666
```{ignore}
667667
let x = 5i;
668668
669-
let y: int = if x == 5i { 10i; } else { 15i; };
669+
let y: int = if x == 5 { 10i; } else { 15i; };
670670
```
671671

672672
Note the semicolons after the 10 and 15. Rust will give us the following error:

branches/try2/src/doc/rust.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,9 +1356,6 @@ A *static item* is a named _constant value_ stored in the global data section of
13561356
Immutable static items are stored in the read-only data section.
13571357
The constant value bound to a static item is, like all constant values, evaluated at compile time.
13581358
Static items have the `static` lifetime, which outlives all other lifetimes in a Rust program.
1359-
Only values stored in the global data section (such as string constants
1360-
and static items) can have the `static` lifetime;
1361-
dynamically constructed values cannot safely be assigned the `static` lifetime.
13621359
Static items are declared with the `static` keyword.
13631360
A static item must have a _constant expression_ giving its definition.
13641361

@@ -3624,10 +3621,7 @@ There are four varieties of pointer in Rust:
36243621
References arise by (automatic) conversion from owning pointers, managed pointers,
36253622
or by applying the borrowing operator `&` to some other value,
36263623
including [lvalues, rvalues or temporaries](#lvalues,-rvalues-and-temporaries).
3627-
A borrow expression is written `&content`.
3628-
3629-
A reference type is written `&'f type` for some lifetime-variable `f`,
3630-
or just `&type` when the lifetime can be elided;
3624+
References are written `&content`, or in some cases `&'f content` for some lifetime-variable `f`,
36313625
for example `&int` means a reference to an integer.
36323626
Copying a reference is a "shallow" operation:
36333627
it involves only copying the pointer itself.

branches/try2/src/libgreen/sched.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,6 @@ mod test {
10291029
use std::rt::task::TaskOpts;
10301030
use std::rt::task::Task;
10311031
use std::rt::local::Local;
1032-
use std::time::Duration;
10331032

10341033
use {TaskState, PoolConfig, SchedPool};
10351034
use basic;
@@ -1292,7 +1291,7 @@ mod test {
12921291
// doesn't exit before emptying the work queue
12931292
pool.spawn(TaskOpts::new(), proc() {
12941293
spawn(proc() {
1295-
timer::sleep(Duration::milliseconds(10));
1294+
timer::sleep(10);
12961295
});
12971296
});
12981297

branches/try2/src/libstd/io/net/tcp.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,13 @@ use io::net::addrinfo::get_host_addresses;
2727
use io::net::ip::SocketAddr;
2828
use io::{IoError, ConnectionFailed, InvalidInput};
2929
use io::{Reader, Writer, Listener, Acceptor};
30-
use io::{standard_error, TimedOut};
3130
use from_str::FromStr;
3231
use kinds::Send;
3332
use option::{None, Some, Option};
3433
use boxed::Box;
3534
use rt::rtio::{IoFactory, LocalIo, RtioSocket, RtioTcpListener};
3635
use rt::rtio::{RtioTcpAcceptor, RtioTcpStream};
3736
use rt::rtio;
38-
use time::Duration;
3937

4038
/// A structure which represents a TCP stream between a local socket and a
4139
/// remote socket.
@@ -94,28 +92,21 @@ impl TcpStream {
9492
}
9593

9694
/// Creates a TCP connection to a remote socket address, timing out after
97-
/// the specified duration.
95+
/// the specified number of milliseconds.
9896
///
9997
/// This is the same as the `connect` method, except that if the timeout
10098
/// specified (in milliseconds) elapses before a connection is made an error
10199
/// will be returned. The error's kind will be `TimedOut`.
102100
///
103101
/// Note that the `addr` argument may one day be split into a separate host
104102
/// and port, similar to the API seen in `connect`.
105-
///
106-
/// If a `timeout` with zero or negative duration is specified then
107-
/// the function returns `Err`, with the error kind set to `TimedOut`.
108103
#[experimental = "the timeout argument may eventually change types"]
109104
pub fn connect_timeout(addr: SocketAddr,
110-
timeout: Duration) -> IoResult<TcpStream> {
111-
if timeout <= Duration::milliseconds(0) {
112-
return Err(standard_error(TimedOut));
113-
}
114-
105+
timeout_ms: u64) -> IoResult<TcpStream> {
115106
let SocketAddr { ip, port } = addr;
116107
let addr = rtio::SocketAddr { ip: super::to_rtio(ip), port: port };
117108
LocalIo::maybe_raise(|io| {
118-
io.tcp_connect(addr, Some(timeout.num_milliseconds() as u64)).map(TcpStream::new)
109+
io.tcp_connect(addr, Some(timeout_ms)).map(TcpStream::new)
119110
}).map_err(IoError::from_rtio_error)
120111
}
121112

@@ -173,14 +164,13 @@ impl TcpStream {
173164
/// # #![allow(unused_must_use)]
174165
/// use std::io::timer;
175166
/// use std::io::TcpStream;
176-
/// use std::time::Duration;
177167
///
178168
/// let mut stream = TcpStream::connect("127.0.0.1", 34254).unwrap();
179169
/// let stream2 = stream.clone();
180170
///
181171
/// spawn(proc() {
182172
/// // close this stream after one second
183-
/// timer::sleep(Duration::seconds(1));
173+
/// timer::sleep(1000);
184174
/// let mut stream = stream2;
185175
/// stream.close_read();
186176
/// });

branches/try2/src/libstd/io/net/unix.rs

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,10 @@ use prelude::*;
2929
use c_str::ToCStr;
3030
use clone::Clone;
3131
use io::{Listener, Acceptor, Reader, Writer, IoResult, IoError};
32-
use io::{standard_error, TimedOut};
3332
use kinds::Send;
3433
use boxed::Box;
3534
use rt::rtio::{IoFactory, LocalIo, RtioUnixListener};
3635
use rt::rtio::{RtioUnixAcceptor, RtioPipe};
37-
use time::Duration;
3836

3937
/// A stream which communicates over a named pipe.
4038
pub struct UnixStream {
@@ -68,18 +66,11 @@ impl UnixStream {
6866
///
6967
/// This function is similar to `connect`, except that if `timeout_ms`
7068
/// elapses the function will return an error of kind `TimedOut`.
71-
///
72-
/// If a `timeout` with zero or negative duration is specified then
73-
/// the function returns `Err`, with the error kind set to `TimedOut`.
7469
#[experimental = "the timeout argument is likely to change types"]
7570
pub fn connect_timeout<P: ToCStr>(path: &P,
76-
timeout: Duration) -> IoResult<UnixStream> {
77-
if timeout <= Duration::milliseconds(0) {
78-
return Err(standard_error(TimedOut));
79-
}
80-
71+
timeout_ms: u64) -> IoResult<UnixStream> {
8172
LocalIo::maybe_raise(|io| {
82-
let s = io.unix_connect(&path.to_c_str(), Some(timeout.num_milliseconds() as u64));
73+
let s = io.unix_connect(&path.to_c_str(), Some(timeout_ms));
8374
s.map(|p| UnixStream { obj: p })
8475
}).map_err(IoError::from_rtio_error)
8576
}
@@ -508,25 +499,13 @@ mod tests {
508499

509500
iotest!(fn connect_timeout_error() {
510501
let addr = next_test_unix();
511-
assert!(UnixStream::connect_timeout(&addr, Duration::milliseconds(100)).is_err());
502+
assert!(UnixStream::connect_timeout(&addr, 100).is_err());
512503
})
513504

514505
iotest!(fn connect_timeout_success() {
515506
let addr = next_test_unix();
516507
let _a = UnixListener::bind(&addr).unwrap().listen().unwrap();
517-
assert!(UnixStream::connect_timeout(&addr, Duration::milliseconds(100)).is_ok());
518-
})
519-
520-
iotest!(fn connect_timeout_zero() {
521-
let addr = next_test_unix();
522-
let _a = UnixListener::bind(&addr).unwrap().listen().unwrap();
523-
assert!(UnixStream::connect_timeout(&addr, Duration::milliseconds(0)).is_err());
524-
})
525-
526-
iotest!(fn connect_timeout_negative() {
527-
let addr = next_test_unix();
528-
let _a = UnixListener::bind(&addr).unwrap().listen().unwrap();
529-
assert!(UnixStream::connect_timeout(&addr, Duration::milliseconds(-1)).is_err());
508+
assert!(UnixStream::connect_timeout(&addr, 100).is_ok());
530509
})
531510

532511
iotest!(fn close_readwrite_smoke() {

branches/try2/src/libstd/io/process.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ mod tests {
976976
assert!(!p.wait().unwrap().success());
977977
return
978978
}
979-
timer::sleep(Duration::milliseconds(100));
979+
timer::sleep(100);
980980
}
981981
fail!("never saw the child go away");
982982
})

branches/try2/src/libstd/io/signal.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ mod test_unix {
167167
use comm::Empty;
168168
use io::timer;
169169
use super::{Listener, Interrupt};
170-
use time::Duration;
171170

172171
fn sigint() {
173172
unsafe {
@@ -180,7 +179,7 @@ mod test_unix {
180179
let mut signal = Listener::new();
181180
signal.register(Interrupt).unwrap();
182181
sigint();
183-
timer::sleep(Duration::milliseconds(10));
182+
timer::sleep(10);
184183
match signal.rx.recv() {
185184
Interrupt => (),
186185
s => fail!("Expected Interrupt, got {:?}", s),
@@ -194,7 +193,7 @@ mod test_unix {
194193
s1.register(Interrupt).unwrap();
195194
s2.register(Interrupt).unwrap();
196195
sigint();
197-
timer::sleep(Duration::milliseconds(10));
196+
timer::sleep(10);
198197
match s1.rx.recv() {
199198
Interrupt => (),
200199
s => fail!("Expected Interrupt, got {:?}", s),
@@ -213,7 +212,7 @@ mod test_unix {
213212
s2.register(Interrupt).unwrap();
214213
s2.unregister(Interrupt);
215214
sigint();
216-
timer::sleep(Duration::milliseconds(10));
215+
timer::sleep(10);
217216
assert_eq!(s2.rx.try_recv(), Err(Empty));
218217
}
219218
}

branches/try2/src/libstd/io/test.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ macro_rules! iotest (
3939
use io::process::*;
4040
use rt::running_on_valgrind;
4141
use str;
42-
use time::Duration;
4342

4443
fn f() $b
4544

0 commit comments

Comments
 (0)