Skip to content

Commit 7da0451

Browse files
committed
---
yaml --- r: 103104 b: refs/heads/auto c: 74f3e04 h: refs/heads/master v: v3
1 parent adca8e7 commit 7da0451

File tree

44 files changed

+2452
-882
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+2452
-882
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 06589136167f3a345920260e1dcb00717b6cd68f
16+
refs/heads/auto: 74f3e0474b382160a6b0aec6e27fe239025519a0
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/compiler-rt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit d4606f1818dd8dfeaa3e509cd1cbac4482c3513e
1+
Subproject commit f4b221571ce6f05714c1f1c6fa48f1393499989c

branches/auto/src/doc/guide-tasks.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,7 @@ spawn(proc() {
226226
});
227227
~~~
228228

229-
Instead we can use a `SharedChan`, a type that allows a single
230-
`Chan` to be shared by multiple senders.
229+
Instead we can clone the `chan`, which allows for multiple senders.
231230

232231
~~~
233232
# use std::task::spawn;
@@ -246,16 +245,13 @@ let result = port.recv() + port.recv() + port.recv();
246245
# fn some_expensive_computation(_i: uint) -> int { 42 }
247246
~~~
248247

249-
Here we transfer ownership of the channel into a new `SharedChan` value. Like
250-
`Chan`, `SharedChan` is a non-copyable, owned type (sometimes also referred to
251-
as an *affine* or *linear* type). Unlike with `Chan`, though, the programmer
252-
may duplicate a `SharedChan`, with the `clone()` method. A cloned
253-
`SharedChan` produces a new handle to the same channel, allowing multiple
254-
tasks to send data to a single port. Between `spawn`, `Chan` and
255-
`SharedChan`, we have enough tools to implement many useful concurrency
256-
patterns.
248+
Cloning a `Chan` produces a new handle to the same channel, allowing multiple
249+
tasks to send data to a single port. It also upgrades the channel internally in
250+
order to allow this functionality, which means that channels that are not
251+
cloned can avoid the overhead required to handle multiple senders. But this
252+
fact has no bearing on the channel's usage: the upgrade is transparent.
257253

258-
Note that the above `SharedChan` example is somewhat contrived since
254+
Note that the above cloning example is somewhat contrived since
259255
you could also simply use three `Chan` pairs, but it serves to
260256
illustrate the point. For reference, written with multiple streams, it
261257
might look like the example below.

branches/auto/src/etc/vim/syntax/rust.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ syn keyword rustTrait Iterator DoubleEndedIterator RandomAccessIterator Cloneabl
8585
syn keyword rustTrait OrdIterator MutableDoubleEndedIterator ExactSize
8686

8787
syn keyword rustTrait Algebraic Trigonometric Exponential Hyperbolic
88-
syn keyword rustTrait Bitwise Bounded Integer Fractional Real RealExt
88+
syn keyword rustTrait Bitwise Bounded Integer
8989
syn keyword rustTrait Num NumCast CheckedAdd CheckedSub CheckedMul CheckedDiv
9090
syn keyword rustTrait Orderable Signed Unsigned Round
9191
syn keyword rustTrait Primitive Int Float ToStrRadix ToPrimitive FromPrimitive

branches/auto/src/libextra/json.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ fn main() {
127127
}
128128
```
129129
130-
To decode a json string using `Decodable` trait :
130+
To decode a JSON string using `Decodable` trait :
131131
132132
```rust
133133
extern crate extra;
@@ -176,7 +176,7 @@ fn main() {
176176
{data_int: 1, data_str:~"toto", data_vector:~[2,3,4,5]};
177177
let encoded_str: ~str = json::Encoder::str_encode(&to_encode_object);
178178
179-
// To unserialize use the `extra::json::from_str` and `extra::json::Decoder`
179+
// To deserialize use the `extra::json::from_str` and `extra::json::Decoder`
180180
181181
let json_object = extra::json::from_str(encoded_str);
182182
let mut decoder = json::Decoder::new(json_object.unwrap());
@@ -186,7 +186,7 @@ fn main() {
186186
187187
## Using `ToJson`
188188
189-
This example use the ToJson impl to unserialize the json string.
189+
This example use the ToJson impl to deserialize the JSON string.
190190
Example of `ToJson` trait implementation for TestStruct1.
191191
192192
```rust
@@ -217,13 +217,13 @@ impl ToJson for TestStruct1 {
217217
}
218218
219219
fn main() {
220-
// Seralization using our impl of to_json
220+
// Serialization using our impl of to_json
221221
222222
let test2: TestStruct1 = TestStruct1 {data_int: 1, data_str:~"toto", data_vector:~[2,3,4,5]};
223223
let tjson: json::Json = test2.to_json();
224224
let json_str: ~str = tjson.to_str();
225225
226-
// Unserialize like before.
226+
// Deserialize like before.
227227
228228
let mut decoder = json::Decoder::new(json::from_str(json_str).unwrap());
229229
// create the final object

branches/auto/src/libextra/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,7 @@ impl MetricMap {
11101110
11111111
// Benchmarking
11121112
1113-
/// A function that is opaque to the optimiser, to allow benchmarks to
1113+
/// A function that is opaque to the optimizer, to allow benchmarks to
11141114
/// pretend to use outputs to assist in avoiding dead-code
11151115
/// elimination.
11161116
///

branches/auto/src/libgreen/sched.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ pub struct Scheduler {
8686
/// A flag to tell the scheduler loop it needs to do some stealing
8787
/// in order to introduce randomness as part of a yield
8888
steal_for_yield: bool,
89-
/// Bookeeping for the number of tasks which are currently running around
89+
/// Bookkeeping for the number of tasks which are currently running around
9090
/// inside this pool of schedulers
9191
task_state: TaskState,
9292

branches/auto/src/libnative/io/file.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,9 @@ pub fn readdir(p: &CString) -> IoResult<~[Path]> {
571571
else {
572572
let fp_vec = vec::from_buf(
573573
fp_buf, wcslen(fp_buf) as uint);
574-
let fp_str = str::from_utf16(fp_vec);
574+
let fp_trimmed = str::truncate_utf16_at_nul(fp_vec);
575+
let fp_str = str::from_utf16(fp_trimmed)
576+
.expect("rust_list_dir_wfd_fp_buf returned invalid UTF-16");
575577
paths.push(Path::new(fp_str));
576578
}
577579
more_files = FindNextFileW(find_handle, wfd_ptr as HANDLE);

branches/auto/src/libnative/io/mod.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ pub mod timer;
6060
#[path = "timer_win32.rs"]
6161
pub mod timer;
6262

63+
#[cfg(unix)]
64+
#[path = "pipe_unix.rs"]
65+
pub mod pipe;
66+
67+
#[cfg(windows)]
68+
#[path = "pipe_win32.rs"]
69+
pub mod pipe;
70+
6371
mod timer_helper;
6472

6573
pub type IoResult<T> = Result<T, IoError>;
@@ -77,6 +85,9 @@ fn translate_error(errno: i32, detail: bool) -> IoError {
7785
fn get_err(errno: i32) -> (io::IoErrorKind, &'static str) {
7886
match errno {
7987
libc::EOF => (io::EndOfFile, "end of file"),
88+
libc::ERROR_NO_DATA => (io::BrokenPipe, "the pipe is being closed"),
89+
libc::ERROR_FILE_NOT_FOUND => (io::FileNotFound, "file not found"),
90+
libc::ERROR_INVALID_NAME => (io::InvalidInput, "invalid file name"),
8091
libc::WSAECONNREFUSED => (io::ConnectionRefused, "connection refused"),
8192
libc::WSAECONNRESET => (io::ConnectionReset, "connection reset"),
8293
libc::WSAEACCES => (io::PermissionDenied, "permission denied"),
@@ -86,6 +97,7 @@ fn translate_error(errno: i32, detail: bool) -> IoError {
8697
libc::WSAECONNABORTED => (io::ConnectionAborted, "connection aborted"),
8798
libc::WSAEADDRNOTAVAIL => (io::ConnectionRefused, "address not available"),
8899
libc::WSAEADDRINUSE => (io::ConnectionRefused, "address in use"),
100+
libc::ERROR_BROKEN_PIPE => (io::BrokenPipe, "the pipe has ended"),
89101

90102
x => {
91103
debug!("ignoring {}: {}", x, os::last_os_error());
@@ -108,6 +120,7 @@ fn translate_error(errno: i32, detail: bool) -> IoError {
108120
libc::ECONNABORTED => (io::ConnectionAborted, "connection aborted"),
109121
libc::EADDRNOTAVAIL => (io::ConnectionRefused, "address not available"),
110122
libc::EADDRINUSE => (io::ConnectionRefused, "address in use"),
123+
libc::ENOENT => (io::FileNotFound, "no such file or directory"),
111124

112125
// These two constants can have the same value on some systems, but
113126
// different values on others, so we can't use a match clause
@@ -196,11 +209,11 @@ impl rtio::IoFactory for IoFactory {
196209
fn udp_bind(&mut self, addr: SocketAddr) -> IoResult<~RtioUdpSocket> {
197210
net::UdpSocket::bind(addr).map(|u| ~u as ~RtioUdpSocket)
198211
}
199-
fn unix_bind(&mut self, _path: &CString) -> IoResult<~RtioUnixListener> {
200-
Err(unimpl())
212+
fn unix_bind(&mut self, path: &CString) -> IoResult<~RtioUnixListener> {
213+
pipe::UnixListener::bind(path).map(|s| ~s as ~RtioUnixListener)
201214
}
202-
fn unix_connect(&mut self, _path: &CString) -> IoResult<~RtioPipe> {
203-
Err(unimpl())
215+
fn unix_connect(&mut self, path: &CString) -> IoResult<~RtioPipe> {
216+
pipe::UnixStream::connect(path).map(|s| ~s as ~RtioPipe)
204217
}
205218
fn get_host_addresses(&mut self, host: Option<&str>, servname: Option<&str>,
206219
hint: Option<ai::Hint>) -> IoResult<~[ai::Info]> {

0 commit comments

Comments
 (0)