Skip to content

Commit 76c0aec

Browse files
committed
---
yaml --- r: 58646 b: refs/heads/try c: 14bf5c4 h: refs/heads/master v: v3
1 parent b5e4068 commit 76c0aec

File tree

284 files changed

+9552
-7144
lines changed

Some content is hidden

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

284 files changed

+9552
-7144
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: c081ffbd1e845687202a975ea2e698b623e5722f
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 213f7b24ccd9a6833af7e1a329c5e7ffc8f9e3d2
5-
refs/heads/try: 941154721ef294149710597409a38294db2a6e07
5+
refs/heads/try: 14bf5c4fe7eb110fc124a710b40bc7c5a7801e25
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/doc/rust.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,8 +1467,8 @@ A complete list of the built-in language items follows:
14671467
: Elements can be subtracted.
14681468
`mul`
14691469
: Elements can be multiplied.
1470-
`div`
1471-
: Elements have a division operation.
1470+
`quot`
1471+
: Elements have a quotient operation.
14721472
`rem`
14731473
: Elements have a remainder operation.
14741474
`neg`
@@ -1857,7 +1857,7 @@ The default meaning of the operators on standard types is given here.
18571857
Calls the `mul` method on the `core::ops::Mul` trait.
18581858
`/`
18591859
: Quotient.
1860-
Calls the `div` method on the `core::ops::Div` trait.
1860+
Calls the `quot` method on the `core::ops::Quot` trait.
18611861
`%`
18621862
: Remainder.
18631863
Calls the `rem` method on the `core::ops::Rem` trait.
@@ -2393,7 +2393,7 @@ variables in the arm's block, and control enters the block.
23932393
An example of an `match` expression:
23942394

23952395

2396-
~~~~
2396+
~~~~ {.xfail-test}
23972397
# fn process_pair(a: int, b: int) { }
23982398
# fn process_ten() { }
23992399

branches/try/mk/clean.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ clean-misc:
4848
$(Q)rm -f $(RUSTLLVM_LIB_OBJS) $(RUSTLLVM_OBJS_OBJS) $(RUSTLLVM_DEF)
4949
$(Q)rm -Rf $(DOCS)
5050
$(Q)rm -Rf $(GENERATED)
51-
$(Q)rm -f tmp/*
51+
$(Q)rm -f tmp/*.log tmp/*.rc tmp/*.rs tmp/*.ok
5252
$(Q)rm -Rf rust-stage0-*.tar.bz2 $(PKG_NAME)-*.tar.gz dist
5353
$(Q)rm -Rf $(foreach ext, \
5454
html aux cp fn ky log pdf pg toc tp vr cps, \

branches/try/src/libcore/cell.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn empty_cell<T>() -> Cell<T> {
4242
pub impl<T> Cell<T> {
4343
/// Yields the value, failing if the cell is empty.
4444
fn take(&self) -> T {
45-
let mut self = unsafe { transmute_mut(self) };
45+
let self = unsafe { transmute_mut(self) };
4646
if self.is_empty() {
4747
fail!(~"attempt to take an empty cell");
4848
}
@@ -54,7 +54,7 @@ pub impl<T> Cell<T> {
5454
5555
/// Returns the value, failing if the cell is full.
5656
fn put_back(&self, value: T) {
57-
let mut self = unsafe { transmute_mut(self) };
57+
let self = unsafe { transmute_mut(self) };
5858
if !self.is_empty() {
5959
fail!(~"attempt to put a value back into a full cell");
6060
}

branches/try/src/libcore/char.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
//! Utilities for manipulating the char type
1212
13-
#[cfg(notest)]
1413
use cmp::Ord;
1514
use option::{None, Option, Some};
1615
use str;

branches/try/src/libcore/cleanup.rs

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,22 +126,29 @@ struct AnnihilateStats {
126126
n_bytes_freed: uint
127127
}
128128

129-
unsafe fn each_live_alloc(f: &fn(box: *mut BoxRepr, uniq: bool) -> bool) {
129+
unsafe fn each_live_alloc(read_next_before: bool,
130+
f: &fn(box: *mut BoxRepr, uniq: bool) -> bool) {
131+
//! Walks the internal list of allocations
132+
130133
use managed;
131134

132135
let task: *Task = transmute(rustrt::rust_get_task());
133136
let box = (*task).boxed_region.live_allocs;
134137
let mut box: *mut BoxRepr = transmute(copy box);
135138
while box != mut_null() {
136-
let next = transmute(copy (*box).header.next);
139+
let next_before = transmute(copy (*box).header.next);
137140
let uniq =
138141
(*box).header.ref_count == managed::raw::RC_MANAGED_UNIQUE;
139142

140143
if ! f(box, uniq) {
141144
break
142145
}
143146

144-
box = next
147+
if read_next_before {
148+
box = next_before;
149+
} else {
150+
box = transmute(copy (*box).header.next);
151+
}
145152
}
146153
}
147154

@@ -159,7 +166,7 @@ fn debug_mem() -> bool {
159166
#[cfg(notest)]
160167
#[lang="annihilate"]
161168
pub unsafe fn annihilate() {
162-
use unstable::lang::local_free;
169+
use unstable::lang::{local_free, debug_ptr};
163170
use io::WriterUtil;
164171
use io;
165172
use libc;
@@ -173,27 +180,46 @@ pub unsafe fn annihilate() {
173180
};
174181

175182
// Pass 1: Make all boxes immortal.
176-
for each_live_alloc |box, uniq| {
183+
//
184+
// In this pass, nothing gets freed, so it does not matter whether
185+
// we read the next field before or after the callback.
186+
for each_live_alloc(true) |box, uniq| {
177187
stats.n_total_boxes += 1;
178188
if uniq {
189+
debug_ptr("Managed-uniq: ", &*box);
179190
stats.n_unique_boxes += 1;
180191
} else {
192+
debug_ptr("Immortalizing: ", &*box);
181193
(*box).header.ref_count = managed::raw::RC_IMMORTAL;
182194
}
183195
}
184196

185197
// Pass 2: Drop all boxes.
186-
for each_live_alloc |box, uniq| {
198+
//
199+
// In this pass, unique-managed boxes may get freed, but not
200+
// managed boxes, so we must read the `next` field *after* the
201+
// callback, as the original value may have been freed.
202+
for each_live_alloc(false) |box, uniq| {
187203
if !uniq {
204+
debug_ptr("Invoking tydesc/glue on: ", &*box);
188205
let tydesc: *TypeDesc = transmute(copy (*box).header.type_desc);
189206
let drop_glue: DropGlue = transmute(((*tydesc).drop_glue, 0));
207+
debug_ptr("Box data: ", &(*box).data);
208+
debug_ptr("Type descriptor: ", tydesc);
190209
drop_glue(to_unsafe_ptr(&tydesc), transmute(&(*box).data));
210+
debug_ptr("Dropped ", &*box);
191211
}
192212
}
193213

194214
// Pass 3: Free all boxes.
195-
for each_live_alloc |box, uniq| {
215+
//
216+
// In this pass, managed boxes may get freed (but not
217+
// unique-managed boxes, though I think that none of those are
218+
// left), so we must read the `next` field before, since it will
219+
// not be valid after.
220+
for each_live_alloc(true) |box, uniq| {
196221
if !uniq {
222+
debug_ptr("About to free: ", &*box);
197223
stats.n_bytes_freed +=
198224
(*((*box).header.type_desc)).size
199225
+ sys::size_of::<BoxRepr>();

branches/try/src/libcore/comm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ impl<T: Owned> Selectable for Port<T> {
205205
fn header(&self) -> *PacketHeader {
206206
unsafe {
207207
match self.endp {
208-
Some(ref endp) => endp.header(),
209-
None => fail!(~"peeking empty stream")
208+
Some(ref endp) => endp.header(),
209+
None => fail!(~"peeking empty stream")
210210
}
211211
}
212212
}

branches/try/src/libcore/container.rs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -25,42 +25,6 @@ pub trait Mutable: Container {
2525
fn clear(&mut self);
2626
}
2727

28-
#[cfg(stage0)]
29-
pub trait Map<K, V>: Mutable {
30-
/// Return true if the map contains a value for the specified key
31-
fn contains_key(&self, key: &K) -> bool;
32-
33-
// Visits all keys and values
34-
fn each(&self, f: &fn(&K, &V) -> bool);
35-
36-
/// Visit all keys
37-
fn each_key(&self, f: &fn(&K) -> bool);
38-
39-
/// Visit all values
40-
fn each_value(&self, f: &fn(&V) -> bool);
41-
42-
/// Iterate over the map and mutate the contained values
43-
fn mutate_values(&mut self, f: &fn(&K, &mut V) -> bool);
44-
45-
/// Return a reference to the value corresponding to the key
46-
fn find(&self, key: &K) -> Option<&'self V>;
47-
48-
/// Return a mutable reference to the value corresponding to the key
49-
fn find_mut(&mut self, key: &K) -> Option<&'self mut V>;
50-
51-
/// Insert a key-value pair into the map. An existing value for a
52-
/// key is replaced by the new value. Return true if the key did
53-
/// not already exist in the map.
54-
fn insert(&mut self, key: K, value: V) -> bool;
55-
56-
/// Remove a key-value pair from the map. Return true if the key
57-
/// was present in the map, otherwise false.
58-
fn remove(&mut self, key: &K) -> bool;
59-
}
60-
61-
#[cfg(stage1)]
62-
#[cfg(stage2)]
63-
#[cfg(stage3)]
6428
pub trait Map<K, V>: Mutable {
6529
/// Return true if the map contains a value for the specified key
6630
fn contains_key(&self, key: &K) -> bool;

branches/try/src/libcore/core.rc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ they contained the following prologue:
6363
#[warn(vecs_implicitly_copyable)];
6464
#[deny(non_camel_case_types)];
6565
#[allow(deprecated_mutable_fields)];
66+
#[allow(deprecated_drop)];
6667

6768
// Make core testable by not duplicating lang items. See #2912
6869
#[cfg(test)] extern mod realcore(name = "core", vers = "0.7-pre");
@@ -74,10 +75,7 @@ they contained the following prologue:
7475

7576
pub use kinds::{Const, Copy, Owned, Durable};
7677
pub use ops::{Drop};
77-
#[cfg(stage0)]
78-
pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, Not};
79-
#[cfg(not(stage0))]
80-
pub use ops::{Add, Sub, Mul, Div, Rem, Neg, Not};
78+
pub use ops::{Add, Sub, Mul, Quot, Rem, Neg, Not};
8179
pub use ops::{BitAnd, BitOr, BitXor};
8280
pub use ops::{Shl, Shr, Index};
8381

branches/try/src/libcore/flate.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Simple compression
1616

1717
use libc;
1818
use libc::{c_void, size_t, c_int};
19-
use ptr;
2019
use vec;
2120

2221
#[cfg(test)] use rand;
@@ -29,13 +28,13 @@ pub mod rustrt {
2928
pub extern {
3029
unsafe fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void,
3130
src_buf_len: size_t,
32-
pout_len: *size_t,
31+
pout_len: *mut size_t,
3332
flags: c_int)
3433
-> *c_void;
3534

3635
unsafe fn tinfl_decompress_mem_to_heap(psrc_buf: *const c_void,
3736
src_buf_len: size_t,
38-
pout_len: *size_t,
37+
pout_len: *mut size_t,
3938
flags: c_int)
4039
-> *c_void;
4140
}
@@ -53,11 +52,11 @@ pub fn deflate_bytes(bytes: &const [u8]) -> ~[u8] {
5352
let res =
5453
rustrt::tdefl_compress_mem_to_heap(b as *c_void,
5554
len as size_t,
56-
&outsz,
55+
&mut outsz,
5756
lz_norm);
5857
assert!(res as int != 0);
5958
let out = vec::raw::from_buf_raw(res as *u8,
60-
outsz as uint);
59+
outsz as uint);
6160
libc::free(res);
6261
out
6362
}
@@ -67,11 +66,11 @@ pub fn deflate_bytes(bytes: &const [u8]) -> ~[u8] {
6766
pub fn inflate_bytes(bytes: &const [u8]) -> ~[u8] {
6867
do vec::as_const_buf(bytes) |b, len| {
6968
unsafe {
70-
let outsz : size_t = 0;
69+
let mut outsz : size_t = 0;
7170
let res =
7271
rustrt::tinfl_decompress_mem_to_heap(b as *c_void,
7372
len as size_t,
74-
&outsz,
73+
&mut outsz,
7574
0);
7675
assert!(res as int != 0);
7776
let out = vec::raw::from_buf_raw(res as *u8,

0 commit comments

Comments
 (0)