Skip to content

Commit 0985126

Browse files
author
Elliott Slaughter
committed
---
yaml --- r: 23628 b: refs/heads/master c: 3cd54ab h: refs/heads/master v: v3
1 parent e1af892 commit 0985126

File tree

9 files changed

+58
-72
lines changed

9 files changed

+58
-72
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 7d57b4864a90776d46898f97a3f4b9b6519cf38d
2+
refs/heads/master: 3cd54ab1f2f351484a2869120c580b13b2ca7eec
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be

trunk/src/libstd/cmp.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,34 @@
11
#[deny(non_camel_case_types)];
2-
#[forbid(deprecated_mode)];
3-
#[forbid(deprecated_pattern)];
42
/// Additional general-purpose comparison functionality.
53
64
const fuzzy_epsilon: float = 1.0e-6;
75

86
trait FuzzyEq {
9-
pure fn fuzzy_eq(other: &self) -> bool;
7+
pure fn fuzzy_eq(&&other: self) -> bool;
108
}
119

1210
impl float: FuzzyEq {
13-
pure fn fuzzy_eq(other: &float) -> bool {
14-
return float::abs(self - *other) < fuzzy_epsilon;
11+
pure fn fuzzy_eq(&&other: float) -> bool {
12+
return float::abs(self - other) < fuzzy_epsilon;
1513
}
1614
}
1715

1816
impl f32: FuzzyEq {
19-
pure fn fuzzy_eq(other: &f32) -> bool {
20-
return f32::abs(self - *other) < (fuzzy_epsilon as f32);
17+
pure fn fuzzy_eq(&&other: f32) -> bool {
18+
return f32::abs(self - other) < (fuzzy_epsilon as f32);
2119
}
2220
}
2321

2422
impl f64: FuzzyEq {
25-
pure fn fuzzy_eq(other: &f64) -> bool {
26-
return f64::abs(self - *other) < (fuzzy_epsilon as f64);
23+
pure fn fuzzy_eq(&&other: f64) -> bool {
24+
return f64::abs(self - other) < (fuzzy_epsilon as f64);
2725
}
2826
}
2927

3028
#[test]
3129
fn test_fuzzy_equals() {
32-
assert ((&1.0).fuzzy_eq(&1.0));
33-
assert ((&1.0f32).fuzzy_eq(&1.0f32));
34-
assert ((&1.0f64).fuzzy_eq(&1.0f64));
30+
assert ((1.0).fuzzy_eq(1.0));
31+
assert ((1.0f32).fuzzy_eq(1.0f32));
32+
assert ((1.0f64).fuzzy_eq(1.0f64));
3533
}
3634

trunk/src/libstd/dbg.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#[deny(non_camel_case_types)];
2-
#[forbid(deprecated_mode)];
3-
#[forbid(deprecated_pattern)];
42
//! Unsafe debugging functions for inspecting values.
53
64
import unsafe::reinterpret_cast;
@@ -28,19 +26,19 @@ fn debug_tydesc<T>() {
2826
rustrt::debug_tydesc(sys::get_type_desc::<T>());
2927
}
3028

31-
fn debug_opaque<T>(+x: T) {
29+
fn debug_opaque<T>(x: T) {
3230
rustrt::debug_opaque(sys::get_type_desc::<T>(), ptr::addr_of(x) as *());
3331
}
3432

3533
fn debug_box<T>(x: @T) {
3634
rustrt::debug_box(sys::get_type_desc::<T>(), ptr::addr_of(x) as *());
3735
}
3836

39-
fn debug_tag<T>(+x: T) {
37+
fn debug_tag<T>(x: T) {
4038
rustrt::debug_tag(sys::get_type_desc::<T>(), ptr::addr_of(x) as *());
4139
}
4240

43-
fn debug_fn<T>(+x: T) {
41+
fn debug_fn<T>(x: T) {
4442
rustrt::debug_fn(sys::get_type_desc::<T>(), ptr::addr_of(x) as *());
4543
}
4644

trunk/src/libstd/list.rs

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
//! A standard linked list
2-
#[forbid(deprecated_mode)];
3-
#[forbid(deprecated_pattern)];
42
53
import core::cmp::Eq;
64
import core::option;
@@ -30,9 +28,9 @@ fn from_vec<T: copy>(v: &[T]) -> @list<T> {
3028
* * z - The initial value
3129
* * f - The function to apply
3230
*/
33-
fn foldl<T: copy, U>(+z: T, ls: @list<U>, f: fn((&T), (&U)) -> T) -> T {
31+
fn foldl<T: copy, U>(z: T, ls: @list<U>, f: fn(T, U) -> T) -> T {
3432
let mut accum: T = z;
35-
do iter(ls) |elt| { accum = f(&accum, &elt);}
33+
do iter(ls) |elt| { accum = f(accum, elt);}
3634
accum
3735
}
3836

@@ -43,12 +41,12 @@ fn foldl<T: copy, U>(+z: T, ls: @list<U>, f: fn((&T), (&U)) -> T) -> T {
4341
* When function `f` returns true then an option containing the element
4442
* is returned. If `f` matches no elements then none is returned.
4543
*/
46-
fn find<T: copy>(ls: @list<T>, f: fn((&T)) -> bool) -> Option<T> {
44+
fn find<T: copy>(ls: @list<T>, f: fn(T) -> bool) -> Option<T> {
4745
let mut ls = ls;
4846
loop {
4947
ls = match *ls {
5048
cons(hd, tl) => {
51-
if f(&hd) { return Some(hd); }
49+
if f(hd) { return Some(hd); }
5250
tl
5351
}
5452
nil => return None
@@ -57,7 +55,7 @@ fn find<T: copy>(ls: @list<T>, f: fn((&T)) -> bool) -> Option<T> {
5755
}
5856

5957
/// Returns true if a list contains an element with the given value
60-
fn has<T: copy Eq>(ls: @list<T>, +elt: T) -> bool {
58+
fn has<T: copy Eq>(ls: @list<T>, elt: T) -> bool {
6159
for each(ls) |e| {
6260
if e == elt { return true; }
6361
}
@@ -112,13 +110,10 @@ pure fn append<T: copy>(l: @list<T>, m: @list<T>) -> @list<T> {
112110
}
113111
}
114112

115-
/*
116-
/// Push one element into the front of a list, returning a new list
117-
/// THIS VERSION DOESN'T ACTUALLY WORK
118-
pure fn push<T: copy>(ll: &mut @list<T>, +vv: T) {
119-
ll = &mut @cons(vv, *ll)
113+
/// Push an element to the front of a list
114+
fn push<T: copy>(&l: list<T>, v: T) {
115+
l = cons(v, @l);
120116
}
121-
*/
122117

123118
/// Iterate over a list
124119
fn iter<T>(l: @list<T>, f: fn(T)) {
@@ -206,7 +201,7 @@ mod tests {
206201

207202
#[test]
208203
fn test_foldl() {
209-
fn add(a: &uint, b: &int) -> uint { return *a + (*b as uint); }
204+
fn add(&&a: uint, &&b: int) -> uint { return a + (b as uint); }
210205
let l = from_vec(~[0, 1, 2, 3, 4]);
211206
let empty = @list::nil::<int>;
212207
assert (list::foldl(0u, l, add) == 10u);
@@ -215,23 +210,23 @@ mod tests {
215210

216211
#[test]
217212
fn test_foldl2() {
218-
fn sub(a: &int, b: &int) -> int {
219-
*a - *b
213+
fn sub(&&a: int, &&b: int) -> int {
214+
a - b
220215
}
221216
let l = from_vec(~[1, 2, 3, 4]);
222217
assert (list::foldl(0, l, sub) == -10);
223218
}
224219

225220
#[test]
226221
fn test_find_success() {
227-
fn match_(i: &int) -> bool { return *i == 2; }
222+
fn match_(&&i: int) -> bool { return i == 2; }
228223
let l = from_vec(~[0, 1, 2]);
229224
assert (list::find(l, match_) == option::Some(2));
230225
}
231226

232227
#[test]
233228
fn test_find_fail() {
234-
fn match_(_i: &int) -> bool { return false; }
229+
fn match_(&&_i: int) -> bool { return false; }
235230
let l = from_vec(~[0, 1, 2]);
236231
let empty = @list::nil::<int>;
237232
assert (list::find(l, match_) == option::None::<int>);
@@ -256,11 +251,6 @@ mod tests {
256251
assert (list::len(empty) == 0u);
257252
}
258253

259-
#[test]
260-
fn test_append() {
261-
assert from_vec(~[1,2,3,4])
262-
== list::append(list::from_vec(~[1,2]), list::from_vec(~[3,4]));
263-
}
264254
}
265255

266256
// Local Variables:

trunk/src/libstd/prettyprint.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#[forbid(deprecated_mode)];
2-
#[forbid(deprecated_pattern)];
3-
41
import io::Writer;
52
import io::WriterUtil;
63
import serialization::serializer;

trunk/src/libstd/rope.rs

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
* * access to a character by index is logarithmic (linear in strings);
2424
*/
2525

26-
#[forbid(deprecated_mode)];
27-
#[forbid(deprecated_pattern)];
2826

2927
/// The type of ropes.
3028
type rope = node::root;
@@ -438,7 +436,7 @@ mod iterator {
438436
node::content(x) => return node::leaf_iterator::start(x)
439437
}
440438
}
441-
fn next(it: &node::leaf_iterator::t) -> Option<node::leaf> {
439+
fn next(it: node::leaf_iterator::t) -> Option<node::leaf> {
442440
return node::leaf_iterator::next(it);
443441
}
444442
}
@@ -449,7 +447,7 @@ mod iterator {
449447
node::content(x) => return node::char_iterator::start(x)
450448
}
451449
}
452-
fn next(it: &node::char_iterator::t) -> Option<char> {
450+
fn next(it: node::char_iterator::t) -> Option<char> {
453451
return node::char_iterator::next(it)
454452
}
455453
}
@@ -753,7 +751,7 @@ mod node {
753751
* * forest - The forest. This vector is progressively rewritten during
754752
* execution and should be discarded as meaningless afterwards.
755753
*/
756-
fn tree_from_forest_destructive(forest: &[mut @node]) -> @node {
754+
fn tree_from_forest_destructive(forest: ~[mut @node]) -> @node {
757755
let mut i;
758756
let mut len = vec::len(forest);
759757
while len > 1u {
@@ -802,7 +800,7 @@ mod node {
802800
let mut offset = 0u;//Current position in the buffer
803801
let it = leaf_iterator::start(node);
804802
loop {
805-
match (leaf_iterator::next(&it)) {
803+
match (leaf_iterator::next(it)) {
806804
option::None => break,
807805
option::Some(x) => {
808806
//FIXME (#2744): Replace with memcpy or something similar
@@ -863,7 +861,7 @@ mod node {
863861
let mut forest = ~[mut];
864862
let it = leaf_iterator::start(node);
865863
loop {
866-
match (leaf_iterator::next(&it)) {
864+
match (leaf_iterator::next(it)) {
867865
option::None => break,
868866
option::Some(x) => vec::push(forest, @leaf(x))
869867
}
@@ -1020,7 +1018,7 @@ mod node {
10201018
let itb = char_iterator::start(b);
10211019
let mut result = 0;
10221020
while result == 0 {
1023-
match ((char_iterator::next(&ita), char_iterator::next(&itb))) {
1021+
match ((char_iterator::next(ita), char_iterator::next(itb))) {
10241022
(option::None, option::None) => break,
10251023
(option::Some(chara), option::Some(charb)) => {
10261024
result = char::cmp(chara, charb);
@@ -1123,7 +1121,7 @@ mod node {
11231121
}
11241122
}
11251123

1126-
fn next(it: &t) -> Option<leaf> {
1124+
fn next(it: t) -> Option<leaf> {
11271125
if it.stackpos < 0 { return option::None; }
11281126
loop {
11291127
let current = it.stack[it.stackpos];
@@ -1164,7 +1162,7 @@ mod node {
11641162
}
11651163
}
11661164

1167-
fn next(it: &t) -> Option<char> {
1165+
fn next(it: t) -> Option<char> {
11681166
loop {
11691167
match (get_current_or_next_leaf(it)) {
11701168
option::None => return option::None,
@@ -1179,36 +1177,36 @@ mod node {
11791177
};
11801178
}
11811179

1182-
fn get_current_or_next_leaf(it: &t) -> Option<leaf> {
1183-
match ((*it).leaf) {
1184-
option::Some(_) => return (*it).leaf,
1180+
fn get_current_or_next_leaf(it: t) -> Option<leaf> {
1181+
match (it.leaf) {
1182+
option::Some(_) => return it.leaf,
11851183
option::None => {
1186-
let next = leaf_iterator::next(&((*it).leaf_iterator));
1184+
let next = leaf_iterator::next(it.leaf_iterator);
11871185
match (next) {
11881186
option::None => return option::None,
11891187
option::Some(_) => {
1190-
(*it).leaf = next;
1191-
(*it).leaf_byte_pos = 0u;
1188+
it.leaf = next;
1189+
it.leaf_byte_pos = 0u;
11921190
return next;
11931191
}
11941192
}
11951193
}
11961194
}
11971195
}
11981196

1199-
fn get_next_char_in_leaf(it: &t) -> Option<char> {
1200-
match copy (*it).leaf {
1197+
fn get_next_char_in_leaf(it: t) -> Option<char> {
1198+
match copy it.leaf {
12011199
option::None => return option::None,
12021200
option::Some(aleaf) => {
1203-
if (*it).leaf_byte_pos >= aleaf.byte_len {
1201+
if it.leaf_byte_pos >= aleaf.byte_len {
12041202
//We are actually past the end of the leaf
1205-
(*it).leaf = option::None;
1203+
it.leaf = option::None;
12061204
return option::None
12071205
} else {
12081206
let {ch, next} =
12091207
str::char_range_at(*aleaf.content,
1210-
(*it).leaf_byte_pos + aleaf.byte_offset);
1211-
(*it).leaf_byte_pos = next - aleaf.byte_offset;
1208+
it.leaf_byte_pos + aleaf.byte_offset);
1209+
it.leaf_byte_pos = next - aleaf.byte_offset;
12121210
return option::Some(ch)
12131211
}
12141212
}
@@ -1276,7 +1274,7 @@ mod tests {
12761274
let rope_iter = iterator::char::start(r);
12771275
let mut equal = true;
12781276
while equal {
1279-
match (node::char_iterator::next(&rope_iter)) {
1277+
match (node::char_iterator::next(rope_iter)) {
12801278
option::None => {
12811279
if string_iter < string_len {
12821280
equal = false;
@@ -1303,7 +1301,7 @@ mod tests {
13031301
let mut len = 0u;
13041302
let it = iterator::char::start(r);
13051303
loop {
1306-
match (node::char_iterator::next(&it)) {
1304+
match (node::char_iterator::next(it)) {
13071305
option::None => break,
13081306
option::Some(_) => len += 1u
13091307
}

trunk/src/libstd/tempfile.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
//! Temporary files and directories
22
3-
#[forbid(deprecated_mode)];
4-
#[forbid(deprecated_pattern)];
5-
63
import core::option;
74
import option::{None, Some};
85
import rand;

trunk/src/rustc/middle/trans/type_use.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ fn type_needs_inner(cx: ctx, use: uint, ty: ty::t,
140140
ty::ty_fn(_) | ty::ty_ptr(_) | ty::ty_rptr(_, _)
141141
| ty::ty_trait(_, _, _) => false,
142142
ty::ty_enum(did, substs) => {
143-
if option::is_none(list::find(enums_seen, |id| *id == did)) {
143+
if option::is_none(list::find(enums_seen, |id| id == did)) {
144144
let seen = @cons(did, enums_seen);
145145
for vec::each(*ty::enum_variants(cx.ccx.tcx, did)) |v| {
146146
for vec::each(v.args) |aty| {

trunk/src/snapshots.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
S 2012-08-29 8aca44e
2+
macos-i386 3c09a69757fc2b704d922ee2cbce7830c65fb976
3+
macos-x86_64 9c9ede896ce8a723858146d8d5ae736816ec1063
4+
freebsd-x86_64 31f22c5bdef7b25b9be943718092fa7629ddca71
5+
linux-i386 2aee9ad037adef883c9f859ae5eb74aaab54c513
6+
linux-x86_64 807dd19b0b93768eb6a40ac489a3e7740413c865
7+
winnt-i386 e8d937d5d1734e3e8a7e8bd9158b7e4350776506
8+
19
S 2012-08-24 e55c5ce
210
macos-i386 7aa0d796fcf79073ed82d0c58ac2d4863203c5d0
311
macos-x86_64 e0b9a4a1080b7c163fd41d759b7ba31f34f4a084

0 commit comments

Comments
 (0)