Skip to content

Commit cf2c538

Browse files
committed
---
yaml --- r: 152702 b: refs/heads/try2 c: e103881 h: refs/heads/master v: v3
1 parent 791ef03 commit cf2c538

File tree

7 files changed

+54
-88
lines changed

7 files changed

+54
-88
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: 311890ccfe08af8b0153510b6cfbc33f9a13d102
8+
refs/heads/try2: e1038819c2ab190ace31f2f0ac7f4455e3708cfc
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/doc/index.md

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,26 +67,12 @@ li {list-style-type: none; }
6767

6868
* [The `rustdoc` manual](rustdoc.html)
6969

70-
# External documentation
70+
# External resources
7171

72-
*Note: While these are great resources for learning Rust, they may
73-
track a particular version of Rust that is likely not exactly the same
74-
as that for which this documentation was generated.*
75-
76-
* [Rust for Rubyists] - An excellent introduction for Rust; not just for Rubyists (tracks the most recent release).
77-
* [Rust by Example] - Short examples of common tasks in Rust (tracks the master branch).
78-
* [The Rust wiki](http://github.com/rust-lang/rust/wiki)
79-
80-
[Rust for Rubyists]: http://www.rustforrubyists.com/
81-
[Rust by Example]: http://rustbyexample.com/
82-
83-
# Community
84-
85-
* [Reddit](http://reddit.com/r/rust)
86-
* [Stack Overflow](http://stackoverflow.com/questions/tagged/rust)
87-
* The Rust IRC channels on [irc.mozilla.org](http://irc.mozilla.org/):
72+
* The Rust IRC channels on [irc.mozilla.org](http://irc.mozilla.org/)
8873
* [`#rust`](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust) - general discussion
8974
* [`#rust-gamedev`](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-gamedev) - game development
9075
* [`#rust-internals`](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-internals) - compiler and libraries
9176
* [`#rust-osdev`](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-osdev) - operating system development
92-
77+
* The Rust community on [Reddit](http://reddit.com/r/rust)
78+
* The Rust [wiki](http://github.com/rust-lang/rust/wiki)

branches/try2/src/doc/rust.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ dd {
275275

276276
nav ul {
277277
list-style-type: none;
278-
margin: 0 0 20px 0;
278+
margin: 0;
279279
padding-left: 0px;
280280
}
281281

branches/try2/src/libcollections/bitv.rs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -376,27 +376,6 @@ impl Bitv {
376376
}
377377
}
378378

379-
/**
380-
* Compares two bitvectors
381-
*
382-
* Both bitvectors must be the same length. Returns `true` if both
383-
* bitvectors contain identical elements.
384-
*/
385-
#[inline]
386-
pub fn equal(&self, v1: &Bitv) -> bool {
387-
if self.nbits != v1.nbits { return false; }
388-
match self.rep {
389-
Small(ref b) => match v1.rep {
390-
Small(ref b1) => b.equals(b1, self.nbits),
391-
_ => false
392-
},
393-
Big(ref s) => match v1.rep {
394-
Big(ref s1) => s.equals(s1, self.nbits),
395-
Small(_) => return false
396-
}
397-
}
398-
}
399-
400379
/// Set all bits to 0
401380
#[inline]
402381
pub fn clear(&mut self) {
@@ -613,6 +592,25 @@ impl<S: hash::Writer> hash::Hash<S> for Bitv {
613592
}
614593
}
615594

595+
impl cmp::PartialEq for Bitv {
596+
#[inline]
597+
fn eq(&self, other: &Bitv) -> bool {
598+
if self.nbits != other.nbits { return false; }
599+
match self.rep {
600+
Small(ref b) => match other.rep {
601+
Small(ref b1) => b.equals(b1, self.nbits),
602+
_ => false
603+
},
604+
Big(ref s) => match other.rep {
605+
Big(ref s1) => s.equals(s1, self.nbits),
606+
Small(_) => return false
607+
}
608+
}
609+
}
610+
}
611+
612+
impl cmp::Eq for Bitv {}
613+
616614
#[inline]
617615
fn iterate_bits(base: uint, bits: uint, f: |uint| -> bool) -> bool {
618616
if bits == 0 {
@@ -841,6 +839,8 @@ impl cmp::PartialEq for BitvSet {
841839
fn ne(&self, other: &BitvSet) -> bool { !self.eq(other) }
842840
}
843841

842+
impl cmp::Eq for BitvSet {}
843+
844844
impl fmt::Show for BitvSet {
845845
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
846846
try!(write!(fmt, "{{"));
@@ -1323,14 +1323,14 @@ mod tests {
13231323
fn test_equal_differing_sizes() {
13241324
let v0 = Bitv::new(10u, false);
13251325
let v1 = Bitv::new(11u, false);
1326-
assert!(!v0.equal(&v1));
1326+
assert!(v0 != v1);
13271327
}
13281328

13291329
#[test]
13301330
fn test_equal_greatly_differing_sizes() {
13311331
let v0 = Bitv::new(10u, false);
13321332
let v1 = Bitv::new(110u, false);
1333-
assert!(!v0.equal(&v1));
1333+
assert!(v0 != v1);
13341334
}
13351335

13361336
#[test]
@@ -1341,7 +1341,7 @@ mod tests {
13411341
let mut b = bitv::Bitv::new(1, true);
13421342
b.set(0, true);
13431343

1344-
assert!(a.equal(&b));
1344+
assert_eq!(a, b);
13451345
}
13461346

13471347
#[test]
@@ -1356,7 +1356,7 @@ mod tests {
13561356
b.set(i, true);
13571357
}
13581358

1359-
assert!(a.equal(&b));
1359+
assert_eq!(a, b);
13601360
}
13611361

13621362
#[test]

branches/try2/src/libstd/sync/task_pool.rs

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! Abstraction of a task pool for basic parallelism.
11+
#![allow(missing_doc)]
12+
13+
/// A task pool abstraction. Useful for achieving predictable CPU
14+
/// parallelism.
1215
1316
use core::prelude::*;
1417

@@ -22,7 +25,6 @@ enum Msg<T> {
2225
Quit
2326
}
2427

25-
/// A task pool used to execute functions in parallel.
2628
pub struct TaskPool<T> {
2729
channels: Vec<Sender<Msg<T>>>,
2830
next_index: uint,
@@ -38,13 +40,11 @@ impl<T> Drop for TaskPool<T> {
3840
}
3941

4042
impl<T> TaskPool<T> {
41-
/// Spawns a new task pool with `n_tasks` tasks. The provided
42-
/// `init_fn_factory` returns a function which, given the index of the
43-
/// task, should return local data to be kept around in that task.
44-
///
45-
/// # Failure
46-
///
47-
/// This function will fail if `n_tasks` is less than 1.
43+
/// Spawns a new task pool with `n_tasks` tasks. If the `sched_mode`
44+
/// is None, the tasks run on this scheduler; otherwise, they run on a
45+
/// new scheduler with the given mode. The provided `init_fn_factory`
46+
/// returns a function which, given the index of the task, should return
47+
/// local data to be kept around in that task.
4848
pub fn new(n_tasks: uint,
4949
init_fn_factory: || -> proc(uint):Send -> T)
5050
-> TaskPool<T> {
@@ -87,16 +87,12 @@ impl<T> TaskPool<T> {
8787

8888
#[test]
8989
fn test_task_pool() {
90-
let f: || -> proc(uint):Send -> uint = || { proc(i) i };
90+
let f: || -> proc(uint):Send -> uint = || {
91+
let g: proc(uint):Send -> uint = proc(i) i;
92+
g
93+
};
9194
let mut pool = TaskPool::new(4, f);
9295
for _ in range(0, 8) {
9396
pool.execute(proc(i) println!("Hello from thread {}!", *i));
9497
}
9598
}
96-
97-
#[test]
98-
#[should_fail]
99-
fn test_zero_tasks_failure() {
100-
let f: || -> proc(uint):Send -> uint = || { proc(i) i };
101-
TaskPool::new(0, f);
102-
}

branches/try2/src/libstd/task.rs

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,17 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! Task creation
11+
//! Utilities for managing and scheduling tasks
1212
//!
13-
//! An executing Rust program consists of a collection of tasks, each
14-
//! with their own stack and local state. A Rust task is typically
15-
//! backed by an operating system thread, making tasks 'just threads',
16-
//! but may also be implemented via other strategies as well
17-
//! (e.g. Rust comes with the [`green`](../../green/index.html)
18-
//! scheduling crate for creating tasks backed by green threads).
13+
//! An executing Rust program consists of a collection of lightweight tasks,
14+
//! each with their own stack. Tasks communicate with each other using channels
15+
//! (see `std::comm`) or other forms of synchronization (see `std::sync`) that
16+
//! ensure data-race freedom.
1917
//!
20-
//! Tasks generally have their memory *isolated* from each other by
21-
//! virtue of Rust's owned types (which of course may only be owned by
22-
//! a single task at a time). Communication between tasks is primarily
23-
//! done through [channels](../../std/comm/index.html), Rust's
24-
//! message-passing types, though [other forms of task
25-
//! synchronization](../../std/sync/index.html) are often employed to
26-
//! achieve particular performance goals. In particular, types that
27-
//! are guaranteed to be threadsafe are easily shared between threads
28-
//! using the atomically-reference-counted container,
29-
//! [`Arc`](../../std/sync/struct.Arc.html).
30-
//!
31-
//! Fatal logic errors in Rust cause *task failure*, during which
32-
//! a task will unwind the stack, running destructors and freeing
33-
//! owned resources. Task failure is unrecoverable from within
34-
//! the failing task (i.e. there is no 'try/catch' in Rust), but
35-
//! failure may optionally be detected from a different task. If
36-
//! the main task fails the application will exit with a non-zero
37-
//! exit code.
18+
//! Failure in one task does immediately propagate to any others (not to parent,
19+
//! not to child). Failure propagation is instead handled as part of task
20+
//! synchronization. For example, the channel `send()` and `recv()` methods will
21+
//! fail if the other end has hung up already.
3822
//!
3923
//! # Basic task scheduling
4024
//!

branches/try2/src/libsync/comm/select.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ impl Select {
132132
/// event could either be that data is available or the corresponding
133133
/// channel has been closed.
134134
pub fn wait(&self) -> uint {
135-
self.wait2(true)
135+
self.wait2(false)
136136
}
137137

138138
/// Helper method for skipping the preflight checks during testing

0 commit comments

Comments
 (0)