Skip to content

Commit 0fbe890

Browse files
committed
---
yaml --- r: 24319 b: refs/heads/master c: 72ae426 h: refs/heads/master i: 24317: 818538d 24315: bef3f9b 24311: 330a20a 24303: 93f8015 24287: c102ae0 24255: 235abf4 24191: 6a67df1 24063: fff145a v: v3
1 parent d87aeae commit 0fbe890

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
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: 9b4db176307e91e85361270b667fb22885a21b8b
2+
refs/heads/master: 72ae42627b023a6f453316df7735fd9cb4e9283b
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be

trunk/src/libcore/extfmt.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,10 @@ mod ct {
270270
}
271271
}
272272
273-
// OLD CODE -- eventually remove
273+
// Functions used by the fmt extension at runtime. For now there are a lot of
274+
// decisions made a runtime. If it proves worthwhile then some of these
275+
// conditions can be evaluated at compile-time. For now though it's cleaner to
276+
// implement it 0this way, I think.
274277
mod rt {
275278
#[legacy_exports];
276279
const flag_none : u32 = 0u32;
@@ -286,7 +289,7 @@ mod rt {
286289
type Conv = {flags: u32, width: Count, precision: Count, ty: Ty};
287290
288291
pure fn conv_int(cv: Conv, i: int) -> ~str {
289-
let radix = 10u;
292+
let radix = 10;
290293
let prec = get_int_precision(cv);
291294
let mut s : ~str = int_to_str_prec(i, radix, prec);
292295
if 0 <= i {
@@ -320,13 +323,13 @@ mod rt {
320323
let mut s = str::from_char(c);
321324
return unsafe { pad(cv, s, PadNozero) };
322325
}
323-
pure fn conv_str(cv: Conv, s: &str) -> ~str {
326+
pure fn conv_str(cv: Conv, +s: &str) -> ~str {
324327
// For strings, precision is the maximum characters
325328
// displayed
326329
let mut unpadded = match cv.precision {
327330
CountImplied => s.to_unique(),
328331
CountIs(max) => if max as uint < str::char_len(s) {
329-
str::substr(s, 0, max as uint)
332+
str::substr(s, 0u, max as uint)
330333
} else {
331334
s.to_unique()
332335
}
@@ -336,7 +339,7 @@ mod rt {
336339
pure fn conv_float(cv: Conv, f: float) -> ~str {
337340
let (to_str, digits) = match cv.precision {
338341
CountIs(c) => (float::to_str_exact, c as uint),
339-
CountImplied => (float::to_str, 6)
342+
CountImplied => (float::to_str, 6u)
340343
};
341344
let mut s = unsafe { to_str(f, digits) };
342345
if 0.0 <= f {
@@ -348,8 +351,8 @@ mod rt {
348351
}
349352
return unsafe { pad(cv, s, PadFloat) };
350353
}
351-
pure fn conv_poly<T>(cv: Conv, v: T) -> ~str {
352-
let s = sys::log_str(&v);
354+
pure fn conv_poly<T>(cv: Conv, v: &T) -> ~str {
355+
let s = sys::log_str(v);
353356
return conv_str(cv, s);
354357
}
355358
@@ -460,7 +463,7 @@ mod rt {
460463
}
461464
}
462465

463-
// NEW CODE
466+
// Remove after snapshot
464467

465468
// Functions used by the fmt extension at runtime. For now there are a lot of
466469
// decisions made a runtime. If it proves worthwhile then some of these

trunk/src/libsyntax/ext/fmt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span,
3939
-> @ast::expr {
4040
fn make_path_vec(_cx: ext_ctxt, ident: @~str) -> ~[ast::ident] {
4141
let intr = _cx.parse_sess().interner;
42-
return ~[intr.intern(@~"extfmt"), intr.intern(@~"rt2"),
42+
return ~[intr.intern(@~"extfmt"), intr.intern(@~"rt"),
4343
intr.intern(ident)];
4444
}
4545
fn make_rt_path_expr(cx: ext_ctxt, sp: span, nm: @~str) -> @ast::expr {

0 commit comments

Comments
 (0)