Skip to content

Commit e9b04e0

Browse files
committed
---
yaml --- r: 108431 b: refs/heads/dist-snap c: 74f3e04 h: refs/heads/master i: 108429: 61d0feb 108427: 952e386 108423: ac5d913 108415: ebc1246 v: v3
1 parent 7361a55 commit e9b04e0

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
@@ -6,7 +6,7 @@ refs/heads/try: f64fdf524a434f0e5cd0bc91d09c144723f3c90d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 06589136167f3a345920260e1dcb00717b6cd68f
9+
refs/heads/dist-snap: 74f3e0474b382160a6b0aec6e27fe239025519a0
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/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/dist-snap/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/dist-snap/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/dist-snap/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/dist-snap/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/dist-snap/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/dist-snap/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/dist-snap/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)