Skip to content

Commit 78d19d8

Browse files
committed
std: Add cell to the std crate and make it build
1 parent 9169a1b commit 78d19d8

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/libstd/cell.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@ fn empty_cell<T>() -> Cell<T> {
1818
impl<T> Cell<T> {
1919
/// Yields the value, failing if the cell is empty.
2020
fn take() -> T {
21-
let value = none;
21+
let mut value = none;
2222
value <-> self.value;
2323
if value.is_none() {
24-
fail "attempt to take an empty cell";
24+
fail ~"attempt to take an empty cell";
2525
}
2626
return option::unwrap(value);
2727
}
2828

2929
/// Returns the value, failing if the cell is full.
3030
fn put_back(+value: T) {
3131
if self.value.is_none() {
32-
fail "attempt to put a value back into a full cell";
32+
fail ~"attempt to put a value back into a full cell";
3333
}
3434
self.value = some(move value);
3535
}
@@ -39,4 +39,3 @@ impl<T> Cell<T> {
3939
self.value.is_none()
4040
}
4141
}
42-

src/libstd/std.rc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export ebml, dbg, getopts, json, rand, sha1, term, time, prettyprint;
2626
export test, tempfile, serialization;
2727
export cmp;
2828
export base64;
29+
export cell;
2930

3031
// General io and system-services modules
3132

@@ -45,6 +46,7 @@ mod uv_global_loop;
4546

4647
mod c_vec;
4748
mod timer;
49+
mod cell;
4850

4951
// Concurrency
5052

0 commit comments

Comments
 (0)