Skip to content

Commit 9772731

Browse files
committed
---
yaml --- r: 138591 b: refs/heads/try2 c: b171d0e h: refs/heads/master i: 138589: 5a5f69d 138587: a40d05f 138583: 4fb55b8 138575: 61869fd 138559: ff1e5cc v: v3
1 parent 832975b commit 9772731

Some content is hidden

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

61 files changed

+1211
-787
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: 2f858de1c39f3fd8bdc77a6517e12a6458c54f03
8+
refs/heads/try2: b171d0ef7b68fed961597d38e6a474d748243987
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/rust.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ the following forms:
297297
num_lit : nonzero_dec [ dec_digit | '_' ] * num_suffix ?
298298
| '0' [ [ dec_digit | '_' ] + num_suffix ?
299299
| 'b' [ '1' | '0' | '_' ] + int_suffix ?
300-
| 'x' [ hex_digit | '-' ] + int_suffix ? ] ;
300+
| 'x' [ hex_digit | '_' ] + int_suffix ? ] ;
301301
302302
num_suffix : int_suffix | float_suffix ;
303303

branches/try2/src/libcore/io.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,10 @@ impl<R:Reader,C> Reader for Wrapper<R, C> {
474474

475475
pub struct FILERes {
476476
f: *libc::FILE,
477-
drop {
477+
}
478+
479+
impl Drop for FILERes {
480+
fn finalize(&self) {
478481
unsafe {
479482
libc::fclose(self.f);
480483
}
@@ -683,7 +686,10 @@ impl Writer for fd_t {
683686

684687
pub struct FdRes {
685688
fd: fd_t,
686-
drop {
689+
}
690+
691+
impl Drop for FdRes {
692+
fn finalize(&self) {
687693
unsafe {
688694
libc::close(self.fd);
689695
}

branches/try2/src/libcore/option.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,10 @@ fn test_unwrap_str() {
450450
fn test_unwrap_resource() {
451451
struct R {
452452
i: @mut int,
453-
drop { *(self.i) += 1; }
453+
}
454+
455+
impl ::ops::Drop for R {
456+
fn finalize(&self) { *(self.i) += 1; }
454457
}
455458

456459
fn R(i: @mut int) -> R {

branches/try2/src/libcore/pipes.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,10 @@ pub unsafe fn get_buffer<T>(p: *PacketHeader) -> ~Buffer<T> {
346346
struct BufferResource<T> {
347347
buffer: ~Buffer<T>,
348348
349-
drop {
349+
}
350+
351+
impl<T> ::ops::Drop for BufferResource<T> {
352+
fn finalize(&self) {
350353
unsafe {
351354
let b = move_it!(self.buffer);
352355
//let p = ptr::addr_of(*b);

branches/try2/src/libcore/private.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,10 @@ struct ArcData<T> {
126126

127127
struct ArcDestruct<T> {
128128
mut data: *libc::c_void,
129-
drop {
129+
}
130+
131+
impl<T> Drop for ArcDestruct<T>{
132+
fn finalize(&self) {
130133
unsafe {
131134
if self.data.is_null() {
132135
return; // Happens when destructing an unwrapper's handle.
@@ -178,7 +181,10 @@ pub unsafe fn unwrap_shared_mutable_state<T:Owned>(rc: SharedMutableState<T>)
178181
struct DeathThroes<T> {
179182
mut ptr: Option<~ArcData<T>>,
180183
mut response: Option<comm::ChanOne<bool>>,
181-
drop {
184+
}
185+
186+
impl<T> Drop for DeathThroes<T>{
187+
fn finalize(&self) {
182188
unsafe {
183189
let response = option::swap_unwrap(&mut self.response);
184190
// In case we get killed early, we need to tell the person who
@@ -311,7 +317,10 @@ type rust_little_lock = *libc::c_void;
311317
312318
struct LittleLock {
313319
l: rust_little_lock,
314-
drop {
320+
}
321+
322+
impl Drop for LittleLock {
323+
fn finalize(&self) {
315324
unsafe {
316325
rustrt::rust_destroy_little_lock(self.l);
317326
}

branches/try2/src/libcore/rand.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,10 @@ impl Rng {
365365

366366
struct RandRes {
367367
rng: *rust_rng,
368-
drop {
368+
}
369+
370+
impl Drop for RandRes {
371+
fn finalize(&self) {
369372
unsafe {
370373
rustrt::rand_free(self.rng);
371374
}

branches/try2/src/libcore/run.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,10 @@ pub fn start_program(prog: &str, args: &[~str]) -> Program {
248248
}
249249
struct ProgRes {
250250
r: ProgRepr,
251-
drop {
251+
}
252+
253+
impl Drop for ProgRes {
254+
fn finalize(&self) {
252255
unsafe {
253256
// FIXME #4943: This is bad.
254257
destroy_repr(cast::transmute(&self.r));

branches/try2/src/libcore/task/spawn.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,11 @@ struct TCB {
308308
mut ancestors: AncestorList,
309309
is_main: bool,
310310
notifier: Option<AutoNotify>,
311+
}
312+
313+
impl Drop for TCB {
311314
// Runs on task exit.
312-
drop {
315+
fn finalize(&self) {
313316
unsafe {
314317
// If we are failing, the whole taskgroup needs to die.
315318
if rt::rust_task_is_unwinding(self.me) {
@@ -353,7 +356,10 @@ fn TCB(me: *rust_task, tasks: TaskGroupArc, ancestors: AncestorList,
353356
struct AutoNotify {
354357
notify_chan: Chan<TaskResult>,
355358
mut failed: bool,
356-
drop {
359+
}
360+
361+
impl Drop for AutoNotify {
362+
fn finalize(&self) {
357363
let result = if self.failed { Failure } else { Success };
358364
self.notify_chan.send(result);
359365
}

branches/try2/src/libcore/to_str.rs

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -137,15 +137,6 @@ impl<A:ToStr> ToStr for @[A] {
137137
}
138138
}
139139
140-
impl<A:ToStr> ToStr for @A {
141-
#[inline(always)]
142-
pure fn to_str(&self) -> ~str { ~"@" + (**self).to_str() }
143-
}
144-
impl<A:ToStr> ToStr for ~A {
145-
#[inline(always)]
146-
pure fn to_str(&self) -> ~str { ~"~" + (**self).to_str() }
147-
}
148-
149140
#[cfg(test)]
150141
#[allow(non_implicitly_copyable_typarams)]
151142
mod tests {
@@ -170,19 +161,12 @@ mod tests {
170161
}
171162

172163
#[test]
173-
#[ignore]
174164
fn test_vectors() {
175165
let x: ~[int] = ~[];
176-
assert x.to_str() == ~"~[]";
177-
assert (~[1]).to_str() == ~"~[1]";
178-
assert (~[1, 2, 3]).to_str() == ~"~[1, 2, 3]";
166+
assert x.to_str() == ~"[]";
167+
assert (~[1]).to_str() == ~"[1]";
168+
assert (~[1, 2, 3]).to_str() == ~"[1, 2, 3]";
179169
assert (~[~[], ~[1], ~[1, 1]]).to_str() ==
180-
~"~[~[], ~[1], ~[1, 1]]";
181-
}
182-
183-
#[test]
184-
fn test_pointer_types() {
185-
assert (@1).to_str() == ~"@1";
186-
assert (~(true, false)).to_str() == ~"~(true, false)";
170+
~"[[], [1], [1, 1]]";
187171
}
188172
}

branches/try2/src/libcore/util.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ pub fn replace<T>(dest: &mut T, src: T) -> T {
6666
/// A non-copyable dummy type.
6767
pub struct NonCopyable {
6868
i: (),
69-
drop { }
69+
}
70+
71+
impl Drop for NonCopyable {
72+
fn finalize(&self) { }
7073
}
7174

7275
pub fn NonCopyable() -> NonCopyable { NonCopyable { i: () } }

branches/try2/src/librustc/front/test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,14 @@ fn is_bench_fn(i: @ast::item) -> bool {
200200
vec::len(attr::find_attrs_by_name(i.attrs, ~"bench")) > 0u;
201201

202202
fn has_test_signature(i: @ast::item) -> bool {
203-
match /*bad*/copy i.node {
204-
ast::item_fn(decl, _, tps, _) => {
203+
match i.node {
204+
ast::item_fn(ref decl, _, ref generics, _) => {
205205
let input_cnt = vec::len(decl.inputs);
206206
let no_output = match decl.output.node {
207207
ast::ty_nil => true,
208208
_ => false
209209
};
210-
let tparm_cnt = vec::len(tps);
210+
let tparm_cnt = generics.ty_params.len();
211211
// NB: inadequate check, but we're running
212212
// well before resolve, can't get too deep.
213213
input_cnt == 1u

branches/try2/src/librustc/lib/llvm.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,7 +1458,10 @@ pub fn struct_tys(struct_ty: TypeRef) -> ~[TypeRef] {
14581458

14591459
pub struct target_data_res {
14601460
TD: TargetDataRef,
1461-
drop {
1461+
}
1462+
1463+
impl Drop for target_data_res {
1464+
fn finalize(&self) {
14621465
unsafe {
14631466
llvm::LLVMDisposeTargetData(self.TD);
14641467
}
@@ -1492,7 +1495,10 @@ pub fn mk_target_data(string_rep: ~str) -> TargetData {
14921495

14931496
pub struct pass_manager_res {
14941497
PM: PassManagerRef,
1495-
drop {
1498+
}
1499+
1500+
impl Drop for pass_manager_res {
1501+
fn finalize(&self) {
14961502
unsafe {
14971503
llvm::LLVMDisposePassManager(self.PM);
14981504
}
@@ -1525,7 +1531,10 @@ pub fn mk_pass_manager() -> PassManager {
15251531

15261532
pub struct object_file_res {
15271533
ObjectFile: ObjectFileRef,
1528-
drop {
1534+
}
1535+
1536+
impl Drop for object_file_res {
1537+
fn finalize(&self) {
15291538
unsafe {
15301539
llvm::LLVMDisposeObjectFile(self.ObjectFile);
15311540
}
@@ -1559,7 +1568,10 @@ pub fn mk_object_file(llmb: MemoryBufferRef) -> Option<ObjectFile> {
15591568

15601569
pub struct section_iter_res {
15611570
SI: SectionIteratorRef,
1562-
drop {
1571+
}
1572+
1573+
impl Drop for section_iter_res {
1574+
fn finalize(&self) {
15631575
unsafe {
15641576
llvm::LLVMDisposeSectionIterator(self.SI);
15651577
}

0 commit comments

Comments
 (0)