Skip to content

Commit 2e2eed5

Browse files
committed
---
yaml --- r: 46590 b: refs/heads/auto c: 33e7a1f h: refs/heads/master v: v3
1 parent 982175b commit 2e2eed5

File tree

123 files changed

+1529
-752
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

+1529
-752
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: 1b1017087be4e842ef0ff43486da8b4e9b085f14
17+
refs/heads/auto: 33e7a1f087b3b8047891b91fa95c5626042e7f6e

branches/auto/configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ do
678678
LLVM_BUILD_DIR=${CFG_BUILD_DIR}llvm/$t
679679
if [ ! -z "$CFG_DISABLE_OPTIMIZE_LLVM" ]
680680
then
681-
LLVM_DBG_OPTS=""
681+
LLVM_DBG_OPTS="--enable-debug-symbols --disable-optimized"
682682
# Just use LLVM straight from its build directory to
683683
# avoid 'make install' time
684684
LLVM_INST_DIR=$LLVM_BUILD_DIR/Debug+Asserts

branches/auto/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 owned = ~mut 20;
1129+
let mut owned = ~20;
11301130

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

branches/auto/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-
pub impl<T:Copy> Add<&[const T],@[T]> for @[T] {
171+
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/auto/src/libcore/dvec.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -133,18 +133,6 @@ 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-
148136
/// Returns the number of elements currently in the dvec
149137
#[inline(always)]
150138
pure fn len() -> uint {
@@ -217,7 +205,7 @@ impl<A> DVec<A> {
217205
}
218206
219207
/// Gives access to the vector as a slice with mutable contents
220-
fn borrow_mut<R>(op: fn(x: &[mut A]) -> R) -> R {
208+
fn borrow_mut<R>(op: &fn(x: &mut [A]) -> R) -> R {
221209
do self.check_out |v| {
222210
let mut v = v;
223211
let result = op(v);

branches/auto/src/libcore/hash.rs

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -186,42 +186,46 @@ fn SipState(key0: u64, key1: u64) -> SipState {
186186
state
187187
}
188188

189+
// sadly, these macro definitions can't appear later,
190+
// because they're needed in the following defs;
191+
// this design could be improved.
192+
193+
macro_rules! u8to64_le (
194+
($buf:expr, $i:expr) =>
195+
($buf[0+$i] as u64 |
196+
$buf[1+$i] as u64 << 8 |
197+
$buf[2+$i] as u64 << 16 |
198+
$buf[3+$i] as u64 << 24 |
199+
$buf[4+$i] as u64 << 32 |
200+
$buf[5+$i] as u64 << 40 |
201+
$buf[6+$i] as u64 << 48 |
202+
$buf[7+$i] as u64 << 56)
203+
)
204+
205+
macro_rules! rotl (
206+
($x:expr, $b:expr) =>
207+
(($x << $b) | ($x >> (64 - $b)))
208+
)
209+
210+
macro_rules! compress (
211+
($v0:expr, $v1:expr, $v2:expr, $v3:expr) =>
212+
({
213+
$v0 += $v1; $v1 = rotl!($v1, 13); $v1 ^= $v0;
214+
$v0 = rotl!($v0, 32);
215+
$v2 += $v3; $v3 = rotl!($v3, 16); $v3 ^= $v2;
216+
$v0 += $v3; $v3 = rotl!($v3, 21); $v3 ^= $v0;
217+
$v2 += $v1; $v1 = rotl!($v1, 17); $v1 ^= $v2;
218+
$v2 = rotl!($v2, 32);
219+
})
220+
)
221+
189222

190223
impl io::Writer for SipState {
191224

192225
// Methods for io::writer
193226
#[inline(always)]
194227
fn write(&self, msg: &[const u8]) {
195228

196-
macro_rules! u8to64_le (
197-
($buf:expr, $i:expr) =>
198-
($buf[0+$i] as u64 |
199-
$buf[1+$i] as u64 << 8 |
200-
$buf[2+$i] as u64 << 16 |
201-
$buf[3+$i] as u64 << 24 |
202-
$buf[4+$i] as u64 << 32 |
203-
$buf[5+$i] as u64 << 40 |
204-
$buf[6+$i] as u64 << 48 |
205-
$buf[7+$i] as u64 << 56)
206-
);
207-
208-
macro_rules! rotl (
209-
($x:expr, $b:expr) =>
210-
(($x << $b) | ($x >> (64 - $b)))
211-
);
212-
213-
macro_rules! compress (
214-
($v0:expr, $v1:expr, $v2:expr, $v3:expr) =>
215-
({
216-
$v0 += $v1; $v1 = rotl!($v1, 13); $v1 ^= $v0;
217-
$v0 = rotl!($v0, 32);
218-
$v2 += $v3; $v3 = rotl!($v3, 16); $v3 ^= $v2;
219-
$v0 += $v3; $v3 = rotl!($v3, 21); $v3 ^= $v0;
220-
$v2 += $v1; $v1 = rotl!($v1, 17); $v1 ^= $v2;
221-
$v2 = rotl!($v2, 32);
222-
})
223-
);
224-
225229
let length = msg.len();
226230
self.length += length;
227231

branches/auto/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-
pub impl NumCast for f32 {
287+
impl NumCast for f32 {
288288
/**
289289
* Cast `n` to an `f32`
290290
*/

branches/auto/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-
pub impl NumCast for f64 {
302+
impl NumCast for f64 {
303303
/**
304304
* Cast `n` to an `f64`
305305
*/

branches/auto/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-
pub impl NumCast for float {
423+
impl NumCast for float {
424424
/**
425425
* Cast `n` to a `float`
426426
*/

branches/auto/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-
pub impl NumCast for i16 {
20+
impl NumCast for i16 {
2121
/**
2222
* Cast `n` to a `i16`
2323
*/

branches/auto/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-
pub impl NumCast for i32 {
20+
impl NumCast for i32 {
2121
/**
2222
* Cast `n` to a `i32`
2323
*/

branches/auto/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-
pub impl NumCast for i64 {
20+
impl NumCast for i64 {
2121
/**
2222
* Cast `n` to a `i64`
2323
*/

branches/auto/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-
pub impl NumCast for i8 {
20+
impl NumCast for i8 {
2121
/**
2222
* Cast `n` to a `i8`
2323
*/

branches/auto/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-
pub impl NumCast for int {
61+
impl NumCast for int {
6262
/**
6363
* Cast `n` to a `int`
6464
*/

branches/auto/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-
pub impl NumCast for u16 {
22+
impl NumCast for u16 {
2323
/**
2424
* Cast `n` to a `u16`
2525
*/

branches/auto/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-
pub impl NumCast for u32 {
22+
impl NumCast for u32 {
2323
/**
2424
* Cast `n` to a `u32`
2525
*/

branches/auto/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-
pub impl NumCast for u64 {
22+
impl NumCast for u64 {
2323
/**
2424
* Cast `n` to a `u64`
2525
*/

branches/auto/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-
pub impl NumCast for u8 {
29+
impl NumCast for u8 {
3030
/**
3131
* Cast `n` to a `u8`
3232
*/

branches/auto/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-
pub impl iter::Times for uint {
113+
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-
pub impl NumCast for uint {
212+
impl NumCast for uint {
213213
/**
214214
* Cast `n` to a `uint`
215215
*/

branches/auto/src/libcore/option.rs

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

59-
pub impl<T:Ord> Ord for Option<T> {
59+
impl<T:Ord> Ord for Option<T> {
6060
pure fn lt(&self, other: &Option<T>) -> bool {
6161
match (self, other) {
6262
(&None, &None) => false,

branches/auto/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 buf = vec::cast_to_mut(vec::from_elem(n as uint, 0u16));
112+
let mut buf = 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/auto/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 ~const T {
16+
impl<T:Eq> Eq for ~T {
1717
#[inline(always)]
18-
pure fn eq(&self, other: &~const T) -> bool { *(*self) == *(*other) }
18+
pure fn eq(&self, other: &~T) -> bool { *(*self) == *(*other) }
1919
#[inline(always)]
20-
pure fn ne(&self, other: &~const T) -> bool { *(*self) != *(*other) }
20+
pure fn ne(&self, other: &~T) -> bool { *(*self) != *(*other) }
2121
}
2222

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

branches/auto/src/libcore/rt.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//! Runtime calls emitted by the compiler.
1212
1313
use cast::transmute;
14-
use libc::{c_char, c_uchar, c_void, size_t, uintptr_t};
14+
use libc::{c_char, c_uchar, c_void, size_t, uintptr_t, c_int};
1515
use managed::raw::BoxRepr;
1616
use str;
1717
use sys;
@@ -121,6 +121,21 @@ pub unsafe fn strdup_uniq(ptr: *c_uchar, len: uint) -> ~str {
121121
str::raw::from_buf_len(ptr, len)
122122
}
123123

124+
#[lang="start"]
125+
pub fn start(main: *u8, argc: int, argv: *c_char,
126+
crate_map: *u8) -> int {
127+
128+
extern {
129+
fn rust_start(main: *c_void, argc: c_int, argv: *c_char,
130+
crate_map: *c_void) -> c_int;
131+
}
132+
133+
unsafe {
134+
return rust_start(main as *c_void, argc as c_int, argv,
135+
crate_map as *c_void) as int;
136+
}
137+
}
138+
124139
// Local Variables:
125140
// mode: rust;
126141
// fill-column: 78;

branches/auto/src/libcore/str.rs

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,40 @@ pub pure fn split_str_nonempty(s: &a/str, sep: &b/str) -> ~[~str] {
590590
result
591591
}
592592

593+
/// Levenshtein Distance between two strings
594+
pub fn levdistance(s: &str, t: &str) -> uint {
595+
596+
let slen = str::len(s);
597+
let tlen = str::len(t);
598+
599+
if slen == 0 { return tlen; }
600+
if tlen == 0 { return slen; }
601+
602+
let mut dcol = vec::from_fn(tlen + 1, |x| x);
603+
604+
for str::each_chari(s) |i, sc| {
605+
606+
let mut current = i;
607+
dcol[0] = current + 1;
608+
609+
for str::each_chari(t) |j, tc| {
610+
611+
let mut next = dcol[j + 1];
612+
613+
if sc == tc {
614+
dcol[j + 1] = current;
615+
} else {
616+
dcol[j + 1] = ::cmp::min(current, next);
617+
dcol[j + 1] = ::cmp::min(dcol[j + 1], dcol[j]) + 1;
618+
}
619+
620+
current = next;
621+
}
622+
}
623+
624+
return dcol[tlen];
625+
}
626+
593627
/**
594628
* Splits a string into a vector of the substrings separated by LF ('\n')
595629
*/
@@ -2328,7 +2362,7 @@ pub trait OwnedStr {
23282362
fn push_char(&mut self, c: char);
23292363
}
23302364

2331-
pub impl OwnedStr for ~str {
2365+
impl OwnedStr for ~str {
23322366
fn push_str(&mut self, v: &str) {
23332367
push_str(self, v);
23342368
}

0 commit comments

Comments
 (0)