Skip to content

Commit c3aa1b3

Browse files
committed
---
yaml --- r: 47316 b: refs/heads/try c: c623d21 h: refs/heads/master v: v3
1 parent 6f02b2d commit c3aa1b3

File tree

123 files changed

+1493
-1278
lines changed

Some content is hidden

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

123 files changed

+1493
-1278
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: 3bbcac322669cff3abde5be937cc4ec3860f3985
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d9689399d091c3265f00434a69c551a61c28dc
5-
refs/heads/try: 43d43adf6bd2024b1ddc0e596d4bed88e1df82b1
5+
refs/heads/try: c623d21e388315df672951fcb8efb5000923ab3d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/doc/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ points to.
11261126
11271127
~~~
11281128
let managed = @mut 10;
1129-
let mut owned = ~20;
1129+
let owned = ~mut 20;
11301130

11311131
let mut value = 30;
11321132
let borrowed = &mut value;

branches/try/src/libcore/at_vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ pub mod traits {
168168
use kinds::Copy;
169169
use ops::Add;
170170

171-
impl<T:Copy> Add<&[const T],@[T]> for @[T] {
171+
pub impl<T:Copy> Add<&[const T],@[T]> for @[T] {
172172
#[inline(always)]
173173
pure fn add(&self, rhs: & &self/[const T]) -> @[T] {
174174
append(*self, (*rhs))

branches/try/src/libcore/dvec.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,18 @@ impl<A> DVec<A> {
133133
self.check_out(|v| self.give_back(f(v)))
134134
}
135135
136+
/**
137+
* Swaps out the current vector and hands it off to a user-provided
138+
* function `f`. The function should transform it however is desired
139+
* and return a new vector to replace it with.
140+
*/
141+
#[inline(always)]
142+
fn swap_mut(f: &fn(v: ~[mut A]) -> ~[mut A]) {
143+
do self.swap |v| {
144+
vec::cast_from_mut(f(vec::cast_to_mut(v)))
145+
}
146+
}
147+
136148
/// Returns the number of elements currently in the dvec
137149
#[inline(always)]
138150
pure fn len() -> uint {
@@ -205,7 +217,7 @@ impl<A> DVec<A> {
205217
}
206218
207219
/// Gives access to the vector as a slice with mutable contents
208-
fn borrow_mut<R>(op: &fn(x: &mut [A]) -> R) -> R {
220+
fn borrow_mut<R>(op: fn(x: &[mut A]) -> R) -> R {
209221
do self.check_out |v| {
210222
let mut v = v;
211223
let result = op(v);

branches/try/src/libcore/io.rs

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

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

687684
pub struct FdRes {
688685
fd: fd_t,
689-
}
690-
691-
impl Drop for FdRes {
692-
fn finalize(&self) {
686+
drop {
693687
unsafe {
694688
libc::close(self.fd);
695689
}

branches/try/src/libcore/num/f32.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ impl num::One for f32 {
284284
static pure fn one() -> f32 { 1.0 }
285285
}
286286

287-
impl NumCast for f32 {
287+
pub impl NumCast for f32 {
288288
/**
289289
* Cast `n` to an `f32`
290290
*/

branches/try/src/libcore/num/f64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ impl cmp::Ord for f64 {
299299
pure fn gt(&self, other: &f64) -> bool { (*self) > (*other) }
300300
}
301301

302-
impl NumCast for f64 {
302+
pub impl NumCast for f64 {
303303
/**
304304
* Cast `n` to an `f64`
305305
*/

branches/try/src/libcore/num/float.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ impl num::One for float {
420420
static pure fn one() -> float { 1.0 }
421421
}
422422
423-
impl NumCast for float {
423+
pub impl NumCast for float {
424424
/**
425425
* Cast `n` to a `float`
426426
*/

branches/try/src/libcore/num/int-template/i16.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ mod inst {
1717
pub const bits: uint = ::u16::bits;
1818
}
1919

20-
impl NumCast for i16 {
20+
pub impl NumCast for i16 {
2121
/**
2222
* Cast `n` to a `i16`
2323
*/

branches/try/src/libcore/num/int-template/i32.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ mod inst {
1717
pub const bits: uint = ::u32::bits;
1818
}
1919

20-
impl NumCast for i32 {
20+
pub impl NumCast for i32 {
2121
/**
2222
* Cast `n` to a `i32`
2323
*/

branches/try/src/libcore/num/int-template/i64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ mod inst {
1717
pub const bits: uint = ::u64::bits;
1818
}
1919

20-
impl NumCast for i64 {
20+
pub impl NumCast for i64 {
2121
/**
2222
* Cast `n` to a `i64`
2323
*/

branches/try/src/libcore/num/int-template/i8.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ mod inst {
1717
pub const bits: uint = ::u8::bits;
1818
}
1919

20-
impl NumCast for i8 {
20+
pub impl NumCast for i8 {
2121
/**
2222
* Cast `n` to a `i8`
2323
*/

branches/try/src/libcore/num/int-template/int.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ mod inst {
5858
}
5959
}
6060

61-
impl NumCast for int {
61+
pub impl NumCast for int {
6262
/**
6363
* Cast `n` to a `int`
6464
*/

branches/try/src/libcore/num/uint-template/u16.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ mod inst {
1919
pub const bits: uint = 16;
2020
}
2121

22-
impl NumCast for u16 {
22+
pub impl NumCast for u16 {
2323
/**
2424
* Cast `n` to a `u16`
2525
*/

branches/try/src/libcore/num/uint-template/u32.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ mod inst {
1919
pub const bits: uint = 32;
2020
}
2121

22-
impl NumCast for u32 {
22+
pub impl NumCast for u32 {
2323
/**
2424
* Cast `n` to a `u32`
2525
*/

branches/try/src/libcore/num/uint-template/u64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ mod inst {
1919
pub const bits: uint = 64;
2020
}
2121

22-
impl NumCast for u64 {
22+
pub impl NumCast for u64 {
2323
/**
2424
* Cast `n` to a `u64`
2525
*/

branches/try/src/libcore/num/uint-template/u8.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ mod inst {
2626
pub pure fn is_ascii(x: T) -> bool { return 0 as T == x & 128 as T; }
2727
}
2828

29-
impl NumCast for u8 {
29+
pub impl NumCast for u8 {
3030
/**
3131
* Cast `n` to a `u8`
3232
*/

branches/try/src/libcore/num/uint-template/uint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ pub mod inst {
110110
return true;
111111
}
112112

113-
impl iter::Times for uint {
113+
pub impl iter::Times for uint {
114114
#[inline(always)]
115115
/**
116116
* A convenience form for basic iteration. Given a uint `x`,
@@ -209,7 +209,7 @@ pub mod inst {
209209
}
210210
}
211211

212-
impl NumCast for uint {
212+
pub impl NumCast for uint {
213213
/**
214214
* Cast `n` to a `uint`
215215
*/

branches/try/src/libcore/option.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub enum Option<T> {
5656
Some(T),
5757
}
5858

59-
impl<T:Ord> Ord for Option<T> {
59+
pub impl<T:Ord> Ord for Option<T> {
6060
pure fn lt(&self, other: &Option<T>) -> bool {
6161
match (self, other) {
6262
(&None, &None) => false,
@@ -450,10 +450,7 @@ fn test_unwrap_str() {
450450
fn test_unwrap_resource() {
451451
struct R {
452452
i: @mut int,
453-
}
454-
455-
impl ::ops::Drop for R {
456-
fn finalize(&self) { *(self.i) += 1; }
453+
drop { *(self.i) += 1; }
457454
}
458455

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

branches/try/src/libcore/os.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ pub mod win32 {
109109
let mut done = false;
110110
while !done {
111111
let mut k: DWORD = 0;
112-
let mut buf = vec::from_elem(n as uint, 0u16);
112+
let buf = vec::cast_to_mut(vec::from_elem(n as uint, 0u16));
113113
do vec::as_mut_buf(buf) |b, _sz| {
114114
k = f(b, TMPBUF_SZ as DWORD);
115115
if k == (0 as DWORD) {

branches/try/src/libcore/owned.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@
1313
use cmp::{Eq, Ord};
1414

1515
#[cfg(notest)]
16-
impl<T:Eq> Eq for ~T {
16+
impl<T:Eq> Eq for ~const T {
1717
#[inline(always)]
18-
pure fn eq(&self, other: &~T) -> bool { *(*self) == *(*other) }
18+
pure fn eq(&self, other: &~const T) -> bool { *(*self) == *(*other) }
1919
#[inline(always)]
20-
pure fn ne(&self, other: &~T) -> bool { *(*self) != *(*other) }
20+
pure fn ne(&self, other: &~const T) -> bool { *(*self) != *(*other) }
2121
}
2222

2323
#[cfg(notest)]
24-
impl<T:Ord> Ord for ~T {
24+
impl<T:Ord> Ord for ~const T {
2525
#[inline(always)]
26-
pure fn lt(&self, other: &~T) -> bool { *(*self) < *(*other) }
26+
pure fn lt(&self, other: &~const T) -> bool { *(*self) < *(*other) }
2727
#[inline(always)]
28-
pure fn le(&self, other: &~T) -> bool { *(*self) <= *(*other) }
28+
pure fn le(&self, other: &~const T) -> bool { *(*self) <= *(*other) }
2929
#[inline(always)]
30-
pure fn ge(&self, other: &~T) -> bool { *(*self) >= *(*other) }
30+
pure fn ge(&self, other: &~const T) -> bool { *(*self) >= *(*other) }
3131
#[inline(always)]
32-
pure fn gt(&self, other: &~T) -> bool { *(*self) > *(*other) }
32+
pure fn gt(&self, other: &~const T) -> bool { *(*self) > *(*other) }
3333
}
3434

branches/try/src/libcore/pipes.rs

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

branches/try/src/libcore/private.rs

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

127127
struct ArcDestruct<T> {
128128
mut data: *libc::c_void,
129-
}
130-
131-
impl<T> Drop for ArcDestruct<T>{
132-
fn finalize(&self) {
129+
drop {
133130
unsafe {
134131
if self.data.is_null() {
135132
return; // Happens when destructing an unwrapper's handle.
@@ -181,10 +178,7 @@ pub unsafe fn unwrap_shared_mutable_state<T:Owned>(rc: SharedMutableState<T>)
181178
struct DeathThroes<T> {
182179
mut ptr: Option<~ArcData<T>>,
183180
mut response: Option<comm::ChanOne<bool>>,
184-
}
185-
186-
impl<T> Drop for DeathThroes<T>{
187-
fn finalize(&self) {
181+
drop {
188182
unsafe {
189183
let response = option::swap_unwrap(&mut self.response);
190184
// In case we get killed early, we need to tell the person who
@@ -317,10 +311,7 @@ type rust_little_lock = *libc::c_void;
317311
318312
struct LittleLock {
319313
l: rust_little_lock,
320-
}
321-
322-
impl Drop for LittleLock {
323-
fn finalize(&self) {
314+
drop {
324315
unsafe {
325316
rustrt::rust_destroy_little_lock(self.l);
326317
}

branches/try/src/libcore/rand.rs

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

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

branches/try/src/libcore/run.rs

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

branches/try/src/libcore/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2362,7 +2362,7 @@ pub trait OwnedStr {
23622362
fn push_char(&mut self, c: char);
23632363
}
23642364

2365-
impl OwnedStr for ~str {
2365+
pub impl OwnedStr for ~str {
23662366
fn push_str(&mut self, v: &str) {
23672367
push_str(self, v);
23682368
}

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

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

branches/try/src/libcore/to_bytes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ impl IterBytes for char {
170170
pub mod x32 {
171171
use to_bytes::{Cb, IterBytes};
172172

173-
impl IterBytes for uint {
173+
pub impl IterBytes for uint {
174174
#[inline(always)]
175175
pure fn iter_bytes(&self, lsb0: bool, f: Cb) {
176176
(*self as u32).iter_bytes(lsb0, f)
@@ -182,7 +182,7 @@ pub mod x32 {
182182
pub mod x64 {
183183
use to_bytes::{Cb, IterBytes};
184184

185-
impl IterBytes for uint {
185+
pub impl IterBytes for uint {
186186
#[inline(always)]
187187
pure fn iter_bytes(&self, lsb0: bool, f: Cb) {
188188
(*self as u64).iter_bytes(lsb0, f)

0 commit comments

Comments
 (0)