Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/doc/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -3256,10 +3256,10 @@ An example of a *recursive* type and its use:
~~~~
enum List<T> {
Nil,
Cons(T, @List<T>)
Cons(T, ~List<T>)
}

let a: List<int> = Cons(7, @Cons(13, @Nil));
let a: List<int> = Cons(7, ~Cons(13, ~Nil));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change this part of the tutorial?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @eddyb mentioned on #servo, it would be nice to replace @List<T> with some other kind of garbage-collected container (like Rc<T>), but it wouldn't need to mess with the tutorial.

ps: However, I was told that @ is going to be deprecated soon, so we may change it later on anyways.

~~~~

### Pointer types
Expand Down
9 changes: 3 additions & 6 deletions src/libarena/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
extern crate collections;

use collections::list::{List, Cons, Nil};
use collections::list;

use std::cast::{transmute, transmute_mut, transmute_mut_region};
use std::cast;
Expand All @@ -44,7 +43,7 @@ use std::vec;
// The way arena uses arrays is really deeply awful. The arrays are
// allocated, and have capacities reserved, but the fill for the array
// will always stay at 0.
#[deriving(Clone)]
#[deriving(Clone, Eq)]
struct Chunk {
data: Rc<RefCell<~[u8]>>,
fill: Cell<uint>,
Expand Down Expand Up @@ -119,13 +118,11 @@ impl Drop for Arena {
fn drop(&mut self) {
unsafe {
destroy_chunk(&self.head);

list::each(self.chunks.get(), |chunk| {
for chunk in self.chunks.get().iter() {
if !chunk.is_pod.get() {
destroy_chunk(chunk);
}
true
});
}
}
}
}
Expand Down
Loading