Skip to content

Commit adca8e7

Browse files
committed
---
yaml --- r: 103103 b: refs/heads/auto c: 0658913 h: refs/heads/master i: 103101: b5cbd26 103099: ebc7558 103095: 07d9b22 103087: 639c9a8 103071: 0837460 103039: ac51270 v: v3
1 parent 6b561ae commit adca8e7

File tree

45 files changed

+894
-2457
lines changed

Some content is hidden

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

45 files changed

+894
-2457
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: cae5999a542fc391e9764ca181f6ac39beec06cb
16+
refs/heads/auto: 06589136167f3a345920260e1dcb00717b6cd68f
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 f4b221571ce6f05714c1f1c6fa48f1393499989c
1+
Subproject commit d4606f1818dd8dfeaa3e509cd1cbac4482c3513e

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

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

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

231232
~~~
232233
# use std::task::spawn;
@@ -245,13 +246,16 @@ let result = port.recv() + port.recv() + port.recv();
245246
# fn some_expensive_computation(_i: uint) -> int { 42 }
246247
~~~
247248

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.
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.
253257

254-
Note that the above cloning example is somewhat contrived since
258+
Note that the above `SharedChan` example is somewhat contrived since
255259
you could also simply use three `Chan` pairs, but it serves to
256260
illustrate the point. For reference, written with multiple streams, it
257261
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
88+
syn keyword rustTrait Bitwise Bounded Integer Fractional Real RealExt
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: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ the code for these traits: `#[deriving(Decodable, Encodable)]`
5959
To encode using Encodable :
6060
6161
```rust
62+
extern crate extra;
6263
extern crate serialize;
6364
use extra::json;
6465
use std::io;
@@ -98,6 +99,7 @@ A basic `ToJson` example using a TreeMap of attribute name / attribute value:
9899
99100
100101
```rust
102+
extern crate extra;
101103
extern crate collections;
102104
103105
use extra::json;
@@ -125,9 +127,10 @@ fn main() {
125127
}
126128
```
127129
128-
To decode a JSON string using `Decodable` trait :
130+
To decode a json string using `Decodable` trait :
129131
130132
```rust
133+
extern crate extra;
131134
extern crate serialize;
132135
use serialize::Decodable;
133136
@@ -154,6 +157,7 @@ Create a struct called TestStruct1 and serialize and deserialize it to and from
154157
using the serialization API, using the derived serialization code.
155158
156159
```rust
160+
extern crate extra;
157161
extern crate serialize;
158162
use extra::json;
159163
use serialize::{Encodable, Decodable};
@@ -172,7 +176,7 @@ fn main() {
172176
{data_int: 1, data_str:~"toto", data_vector:~[2,3,4,5]};
173177
let encoded_str: ~str = json::Encoder::str_encode(&to_encode_object);
174178
175-
// To deserialize use the `extra::json::from_str` and `extra::json::Decoder`
179+
// To unserialize use the `extra::json::from_str` and `extra::json::Decoder`
176180
177181
let json_object = extra::json::from_str(encoded_str);
178182
let mut decoder = json::Decoder::new(json_object.unwrap());
@@ -182,10 +186,11 @@ fn main() {
182186
183187
## Using `ToJson`
184188
185-
This example use the ToJson impl to deserialize the JSON string.
189+
This example use the ToJson impl to unserialize the json string.
186190
Example of `ToJson` trait implementation for TestStruct1.
187191
188192
```rust
193+
extern crate extra;
189194
extern crate serialize;
190195
extern crate collections;
191196
@@ -212,13 +217,13 @@ impl ToJson for TestStruct1 {
212217
}
213218
214219
fn main() {
215-
// Serialization using our impl of to_json
220+
// Seralization using our impl of to_json
216221
217222
let test2: TestStruct1 = TestStruct1 {data_int: 1, data_str:~"toto", data_vector:~[2,3,4,5]};
218223
let tjson: json::Json = test2.to_json();
219224
let json_str: ~str = tjson.to_str();
220225
221-
// Deserialize like before.
226+
// Unserialize like before.
222227
223228
let mut decoder = json::Decoder::new(json::from_str(json_str).unwrap());
224229
// 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 optimizer, to allow benchmarks to
1113+
/// A function that is opaque to the optimiser, 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-
/// Bookkeeping for the number of tasks which are currently running around
89+
/// Bookeeping 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: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -571,9 +571,7 @@ 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_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");
574+
let fp_str = str::from_utf16(fp_vec);
577575
paths.push(Path::new(fp_str));
578576
}
579577
more_files = FindNextFileW(find_handle, wfd_ptr as HANDLE);

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

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,6 @@ 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-
7163
mod timer_helper;
7264

7365
pub type IoResult<T> = Result<T, IoError>;
@@ -85,9 +77,6 @@ fn translate_error(errno: i32, detail: bool) -> IoError {
8577
fn get_err(errno: i32) -> (io::IoErrorKind, &'static str) {
8678
match errno {
8779
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"),
9180
libc::WSAECONNREFUSED => (io::ConnectionRefused, "connection refused"),
9281
libc::WSAECONNRESET => (io::ConnectionReset, "connection reset"),
9382
libc::WSAEACCES => (io::PermissionDenied, "permission denied"),
@@ -97,7 +86,6 @@ fn translate_error(errno: i32, detail: bool) -> IoError {
9786
libc::WSAECONNABORTED => (io::ConnectionAborted, "connection aborted"),
9887
libc::WSAEADDRNOTAVAIL => (io::ConnectionRefused, "address not available"),
9988
libc::WSAEADDRINUSE => (io::ConnectionRefused, "address in use"),
100-
libc::ERROR_BROKEN_PIPE => (io::BrokenPipe, "the pipe has ended"),
10189

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

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

0 commit comments

Comments
 (0)