Skip to content

Commit d0d630e

Browse files
committed
---
yaml --- r: 28158 b: refs/heads/try c: c0c8d3a h: refs/heads/master v: v3
1 parent b2d744c commit d0d630e

File tree

16 files changed

+35
-27
lines changed

16 files changed

+35
-27
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: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
5-
refs/heads/try: ee2ce036ccd53d8c19689d86cf8b3bd5cf37f40f
5+
refs/heads/try: c0c8d3aa8fdd054372f91c997913b33146bdf9bd
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// NB: transitionary, de-mode-ing.
2+
#[forbid(deprecated_mode)];
3+
#[forbid(deprecated_pattern)];
4+
15
import T = inst::T;
26
import cmp::{Eq, Ord};
37
import num::from_int;
@@ -21,8 +25,8 @@ const bytes : uint = (inst::bits / 8);
2125
const min_value: T = (-1 as T) << (bits - 1);
2226
const max_value: T = min_value - 1 as T;
2327

24-
pure fn min(&&x: T, &&y: T) -> T { if x < y { x } else { y } }
25-
pure fn max(&&x: T, &&y: T) -> T { if x > y { x } else { y } }
28+
pure fn min(x: &T, y: &T) -> T { if *x < *y { *x } else { *y } }
29+
pure fn max(x: &T, y: &T) -> T { if *x > *y { *x } else { *y } }
2630

2731
pure fn add(x: &T, y: &T) -> T { *x + *y }
2832
pure fn sub(x: &T, y: &T) -> T { *x - *y }
@@ -155,7 +159,7 @@ fn parse_buf(buf: ~[u8], radix: uint) -> Option<T> {
155159
}
156160

157161
/// Parse a string to an int
158-
fn from_str(s: ~str) -> Option<T> { parse_buf(str::to_bytes(s), 10u) }
162+
fn from_str(s: &str) -> Option<T> { parse_buf(str::to_bytes(s), 10u) }
159163

160164
/// Convert to a string in a given base
161165
fn to_str(n: T, radix: uint) -> ~str {
@@ -235,7 +239,7 @@ fn test_to_str() {
235239

236240
#[test]
237241
fn test_interfaces() {
238-
fn test<U:num::Num>(ten: U) {
242+
fn test<U:num::Num>(+ten: U) {
239243
assert (ten.to_int() == 10);
240244

241245
let two: U = from_int(2);

branches/try/src/libcore/io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ type ByteBuf = {buf: &[const u8], mut pos: uint};
284284
285285
impl ByteBuf: Reader {
286286
fn read(buf: &[mut u8], len: uint) -> uint {
287-
let count = uint::min(len, self.buf.len() - self.pos);
287+
let count = uint::min(&len, &(self.buf.len() - self.pos));
288288
289289
vec::u8::memcpy(buf,
290290
vec::const_view(self.buf, self.pos, self.buf.len()),

branches/try/src/libcore/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ pure fn eq_slice(a: &str, b: &str) -> bool {
676676
let a_len = a.len();
677677
let b_len = b.len();
678678
if a_len != b_len { return false; }
679-
let mut end = uint::min(a_len, b_len);
679+
let mut end = uint::min(&a_len, &b_len);
680680

681681
let mut i = 0u;
682682
while i < end {

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// NB: transitionary, de-mode-ing.
2+
#[forbid(deprecated_mode)];
3+
#[forbid(deprecated_pattern)];
4+
15
import T = inst::T;
26
import cmp::{Eq, Ord};
37

@@ -20,8 +24,8 @@ const bytes : uint = (inst::bits / 8);
2024
const min_value: T = 0 as T;
2125
const max_value: T = 0 as T - 1 as T;
2226

23-
pure fn min(&&x: T, &&y: T) -> T { if x < y { x } else { y } }
24-
pure fn max(&&x: T, &&y: T) -> T { if x > y { x } else { y } }
27+
pure fn min(x: &T, y: &T) -> T { if *x < *y { *x } else { *y } }
28+
pure fn max(x: &T, y: &T) -> T { if *x > *y { *x } else { *y } }
2529

2630
pure fn add(x: &T, y: &T) -> T { *x + *y }
2731
pure fn sub(x: &T, y: &T) -> T { *x - *y }
@@ -138,10 +142,10 @@ fn parse_buf(buf: &[const u8], radix: uint) -> Option<T> {
138142
}
139143

140144
/// Parse a string to an int
141-
fn from_str(s: ~str) -> Option<T> { parse_buf(str::to_bytes(s), 10u) }
145+
fn from_str(s: &str) -> Option<T> { parse_buf(str::to_bytes(s), 10u) }
142146

143147
/// Parse a string as an unsigned integer.
144-
fn from_str_radix(buf: ~str, radix: u64) -> Option<u64> {
148+
fn from_str_radix(buf: &str, radix: u64) -> Option<u64> {
145149
if str::len(buf) == 0u { return None; }
146150
let mut i = str::len(buf) - 1u;
147151
let mut power = 1u64, n = 0u64;

branches/try/src/libcore/vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,7 +1430,7 @@ impl<T: Eq> @[T]: Eq {
14301430

14311431
pure fn lt<T: Ord>(a: &[T], b: &[T]) -> bool {
14321432
let (a_len, b_len) = (a.len(), b.len());
1433-
let mut end = uint::min(a_len, b_len);
1433+
let mut end = uint::min(&a_len, &b_len);
14341434

14351435
let mut i = 0;
14361436
while i < end {
@@ -1821,7 +1821,7 @@ mod u8 {
18211821
pure fn cmp(a: &~[u8], b: &~[u8]) -> int {
18221822
let a_len = len(*a);
18231823
let b_len = len(*b);
1824-
let n = uint::min(a_len, b_len) as libc::size_t;
1824+
let n = uint::min(&a_len, &b_len) as libc::size_t;
18251825
let r = unsafe {
18261826
libc::memcmp(unsafe::to_ptr(*a) as *libc::c_void,
18271827
unsafe::to_ptr(*b) as *libc::c_void, n) as int

branches/try/src/libstd/arena.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl &Arena {
135135
fn alloc_pod_grow(n_bytes: uint, align: uint) -> *u8 {
136136
// Allocate a new chunk.
137137
let chunk_size = at_vec::capacity(self.pod_head.data);
138-
let new_min_chunk_size = uint::max(n_bytes, chunk_size);
138+
let new_min_chunk_size = uint::max(&n_bytes, &chunk_size);
139139
self.chunks = @cons(copy self.pod_head, self.chunks);
140140
self.pod_head =
141141
chunk(uint::next_power_of_two(new_min_chunk_size + 1u), true);
@@ -177,7 +177,7 @@ impl &Arena {
177177
fn alloc_nonpod_grow(n_bytes: uint, align: uint) -> (*u8, *u8) {
178178
// Allocate a new chunk.
179179
let chunk_size = at_vec::capacity(self.head.data);
180-
let new_min_chunk_size = uint::max(n_bytes, chunk_size);
180+
let new_min_chunk_size = uint::max(&n_bytes, &chunk_size);
181181
self.chunks = @cons(copy self.head, self.chunks);
182182
self.head =
183183
chunk(uint::next_power_of_two(new_min_chunk_size + 1u), false);

branches/try/src/libstd/net_tcp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ impl tcp_socket_buf: io::Reader {
772772
}
773773
}
774774

775-
let count = uint::min(len, self.data.buf.len());
775+
let count = uint::min(&len, &self.data.buf.len());
776776

777777
let mut data = ~[];
778778
self.data.buf <-> data;

branches/try/src/libstd/par.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ fn map_slices<A: copy send, B: copy send>(
3030
~[f()(0u, xs)]
3131
}
3232
else {
33-
let num_tasks = uint::min(max_tasks, len / min_granularity);
33+
let num_tasks = uint::min(&max_tasks, &(len / min_granularity));
3434

3535
let items_per_task = len / num_tasks;
3636

3737
let mut futures = ~[];
3838
let mut base = 0u;
3939
log(info, ~"spawning tasks");
4040
while base < len {
41-
let end = uint::min(len, base + items_per_task);
41+
let end = uint::min(&len, &(base + items_per_task));
4242
// FIXME: why is the ::<A, ()> annotation required here? (#2617)
4343
do vec::as_buf::<A, ()>(xs) |p, _len| {
4444
let f = f();

branches/try/src/libstd/rope.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ mod node {
10021002
right : right,
10031003
char_len: char_len(left) + char_len(right),
10041004
byte_len: byte_len(left) + byte_len(right),
1005-
height: uint::max(height(left), height(right)) + 1u
1005+
height: uint::max(&height(left), &height(right)) + 1u
10061006
})
10071007
}
10081008

branches/try/src/libsyntax/ast_util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,8 +563,8 @@ fn compute_id_range(visit_ids_fn: fn(fn@(node_id))) -> id_range {
563563
let min = @mut int::max_value;
564564
let max = @mut int::min_value;
565565
do visit_ids_fn |id| {
566-
*min = int::min(*min, id);
567-
*max = int::max(*max, id + 1);
566+
*min = int::min(min, &id);
567+
*max = int::max(max, &(id + 1));
568568
}
569569
return {min:*min, max:*max};
570570
}

branches/try/src/libsyntax/parse/comments.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ fn trim_whitespace_prefix_and_push_line(&lines: ~[~str],
182182
s: ~str, col: uint) unsafe {
183183
let mut s1;
184184
let len = str::len(s);
185-
if all_whitespace(s, 0u, uint::min(len, col)) {
185+
if all_whitespace(s, 0u, uint::min(&len, &col)) {
186186
if col < len {
187187
s1 = str::slice(s, col, len);
188188
} else { s1 = ~""; }

branches/try/src/rustc/back/rpath.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ fn get_relative_to(abs1: &Path, abs2: &Path) -> Path {
128128
assert len1 > 0u;
129129
assert len2 > 0u;
130130

131-
let max_common_path = uint::min(len1, len2) - 1u;
131+
let max_common_path = uint::min(&len1, &len2) - 1u;
132132
let mut start_idx = 0u;
133133
while start_idx < max_common_path
134134
&& split1[start_idx] == split2[start_idx] {

branches/try/src/rustc/driver/rustc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Options:
8181
fn describe_warnings() {
8282
let lint_dict = lint::get_lint_dict();
8383
let mut max_key = 0u;
84-
for lint_dict.each_key |k| { max_key = uint::max(k.len(), max_key); }
84+
for lint_dict.each_key |k| { max_key = uint::max(&k.len(), &max_key); }
8585
fn padded(max: uint, s: ~str) -> ~str {
8686
str::from_bytes(vec::from_elem(max - s.len(), ' ' as u8)) + s
8787
}

branches/try/src/rustc/middle/trans/foreign.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
8282
3 /* double */ => 8u,
8383
10 /* struct */ => {
8484
do vec::foldl(0u, struct_tys(ty)) |a, t| {
85-
uint::max(a, ty_align(t))
85+
uint::max(&a, &ty_align(t))
8686
}
8787
}
8888
11 /* array */ => {

branches/try/src/rustc/middle/ty.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1856,9 +1856,9 @@ fn type_size(cx: ctxt, ty: t) -> uint {
18561856
let variants = substd_enum_variants(cx, did, substs);
18571857
variants.foldl( // find max size of any variant
18581858
0,
1859-
|m, v| uint::max(m,
1859+
|m, v| uint::max(&m,
18601860
// find size of this variant:
1861-
v.args.foldl(0, |s, a| s + type_size(cx, a))))
1861+
&v.args.foldl(0, |s, a| s + type_size(cx, a))))
18621862
}
18631863
18641864
ty_param(_) | ty_self => {

0 commit comments

Comments
 (0)