Update the compiler to not use printf/printfln
This commit is contained in:
parent
09a5338197
commit
409182de6d
80 changed files with 169 additions and 173 deletions
|
|
@ -24,7 +24,7 @@ fn timed(label: &str, f: &fn()) {
|
|||
let start = time::precise_time_s();
|
||||
f();
|
||||
let end = time::precise_time_s();
|
||||
printfln!(" %s: %f", label, end - start);
|
||||
println!(" {}: {}", label, end - start);
|
||||
}
|
||||
|
||||
fn ascending<M: MutableMap<uint, uint>>(map: &mut M, n_keys: uint) {
|
||||
|
|
@ -116,7 +116,7 @@ fn main() {
|
|||
}
|
||||
}
|
||||
|
||||
printfln!("%? keys", n_keys);
|
||||
println!("{} keys", n_keys);
|
||||
|
||||
io::println("\nTreeMap:");
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ fn maybe_run_test(argv: &[~str], name: ~str, test: &fn()) {
|
|||
test();
|
||||
let stop = precise_time_s();
|
||||
|
||||
printfln!("%s:\t\t%f ms", name, (stop - start) * 1000f);
|
||||
println!("{}:\t\t{} ms", name, (stop - start) * 1000f);
|
||||
}
|
||||
|
||||
fn shift_push() {
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ fn main() {
|
|||
let elapsed = (stop - start);
|
||||
let rate = (num_msgs as float) / elapsed;
|
||||
|
||||
printfln!("Sent %? messages in %? seconds", num_msgs, elapsed);
|
||||
printfln!(" %? messages / second", rate);
|
||||
printfln!(" %? μs / message", 1000000. / rate);
|
||||
println!("Sent {} messages in {} seconds", num_msgs, elapsed);
|
||||
println!(" {} messages / second", rate);
|
||||
println!(" {} μs / message", 1000000. / rate);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ fn main() {
|
|||
let elapsed = (stop - start);
|
||||
let rate = (num_msgs as float) / elapsed;
|
||||
|
||||
printfln!("Sent %? messages in %? seconds", num_msgs, elapsed);
|
||||
printfln!(" %? messages / second", rate);
|
||||
printfln!(" %? μs / message", 1000000. / rate);
|
||||
println!("Sent {} messages in {} seconds", num_msgs, elapsed);
|
||||
println!(" {} messages / second", rate);
|
||||
println!(" {} μs / message", 1000000. / rate);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,5 +35,5 @@ fn main() {
|
|||
args
|
||||
};
|
||||
let n = from_str::<int>(args[1]).unwrap();
|
||||
printfln!("Ack(3,%d): %d\n", n, ack(3, n));
|
||||
println!("Ack(3,{}): {}\n", n, ack(3, n));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ fn main() {
|
|||
let stretch_depth = max_depth + 1;
|
||||
let stretch_tree = bottom_up_tree(&stretch_arena, 0, stretch_depth);
|
||||
|
||||
printfln!("stretch tree of depth %d\t check: %d",
|
||||
println!("stretch tree of depth {}\t check: {}",
|
||||
stretch_depth,
|
||||
item_check(stretch_tree));
|
||||
|
||||
|
|
@ -79,11 +79,11 @@ fn main() {
|
|||
chk += item_check(temp_tree);
|
||||
i += 1;
|
||||
}
|
||||
printfln!("%d\t trees of depth %d\t check: %d",
|
||||
println!("{}\t trees of depth {}\t check: {}",
|
||||
iterations * 2, depth, chk);
|
||||
depth += 2;
|
||||
}
|
||||
printfln!("long lived tree of depth %d\t check: %d",
|
||||
println!("long lived tree of depth {}\t check: {}",
|
||||
max_depth,
|
||||
item_check(long_lived_tree));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,5 +94,5 @@ fn fannkuch_redux(n: i32) -> i32 {
|
|||
#[fixed_stack_segment]
|
||||
fn main() {
|
||||
let n: i32 = FromStr::from_str(os::args()[1]).unwrap();
|
||||
printfln!("Pfannkuchen(%d) = %d", n as int, fannkuch_redux(n) as int);
|
||||
println!("Pfannkuchen({}) = {}", n as int, fannkuch_redux(n) as int);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,5 +31,5 @@ fn main() {
|
|||
args
|
||||
};
|
||||
let n = from_str::<int>(args[1]).unwrap();
|
||||
printfln!("%d\n", fib(n));
|
||||
println!("{}\n", fib(n));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ struct PrintCallback(&'static str);
|
|||
|
||||
impl TableCallback for PrintCallback {
|
||||
fn f(&self, entry: &mut Entry) {
|
||||
printfln!("%d\t%s", entry.count as int, **self);
|
||||
println!("{}\t{}", entry.count as int, **self);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -279,9 +279,9 @@ fn print_frequencies(frequencies: &Table, frame: i32) {
|
|||
}
|
||||
|
||||
for vector.each |&(key, count)| {
|
||||
printfln!("%s %.3f",
|
||||
key.unpack(frame),
|
||||
(count as float * 100.0) / (total_count as float));
|
||||
println!("{} {:.3f}",
|
||||
key.unpack(frame),
|
||||
(count as float * 100.0) / (total_count as float));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ fn main() {
|
|||
let mut byte_acc: i8 = 0;
|
||||
let mut bit_num: i32 = 0;
|
||||
|
||||
printfln!("P4\n%d %d", w as int, h as int);
|
||||
println!("P4\n{} {}", w, h);
|
||||
|
||||
let mode = "w";
|
||||
let stdout = fdopen(STDOUT_FILENO as c_int, transmute(&mode[0]));
|
||||
|
|
|
|||
|
|
@ -143,9 +143,9 @@ fn main() {
|
|||
let mut bodies = BODIES;
|
||||
|
||||
offset_momentum(&mut bodies);
|
||||
printfln!("%.9f", energy(&bodies) as float);
|
||||
println!("{:.9f}", energy(&bodies) as float);
|
||||
|
||||
advance(&mut bodies, 0.01, n);
|
||||
|
||||
printfln!("%.9f", energy(&bodies) as float);
|
||||
println!("{:.9f}", energy(&bodies) as float);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,5 +63,5 @@ fn main() {
|
|||
mult_AtAv(v, u, tmp);
|
||||
}
|
||||
|
||||
printfln!("%.9f", (dot(u,v) / dot(v,v)).sqrt() as float);
|
||||
println!("{:.9f}", (dot(u,v) / dot(v,v)).sqrt() as float);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,11 +40,11 @@ fn roundtrip(id: int, n_tasks: int, p: &Port<int>, ch: &Chan<int>) {
|
|||
while (true) {
|
||||
match p.recv() {
|
||||
1 => {
|
||||
printfln!("%d\n", id);
|
||||
println!("{}\n", id);
|
||||
return;
|
||||
}
|
||||
token => {
|
||||
info!("thread: %d got token: %d", id, token);
|
||||
info2!("thread: {} got token: {}", id, token);
|
||||
ch.send(token - 1);
|
||||
if token <= n_tasks {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ struct Foo {
|
|||
|
||||
impl Foo {
|
||||
pub fn printme(&mut self) {
|
||||
printfln!("%d", self.x);
|
||||
println!("{}", self.x);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,5 +9,5 @@ fn a() -> &int {
|
|||
|
||||
fn main() {
|
||||
let fifth = a();
|
||||
printfln!("%d", *fifth);
|
||||
println!("{}", *fifth);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,5 +22,4 @@ fn main() {
|
|||
let u = Thing {x: 2};
|
||||
let _v = u.mul(&3); // This is ok
|
||||
let w = u * 3; //~ ERROR binary operation * cannot be applied to type `Thing`
|
||||
printfln!("%i", w.x);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,5 +14,5 @@ fn f<'r, T>(v: &'r T) -> &'r fn()->T { id::<&'r fn()->T>(|| *v) } //~ ERROR cann
|
|||
|
||||
fn main() {
|
||||
let v = &5;
|
||||
printfln!("%d", f(v)());
|
||||
println!("{}", f(v)());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ fn innocent_looking_victim() {
|
|||
match x {
|
||||
Some(ref msg) => {
|
||||
(f.c)(f, true);
|
||||
printfln!(msg);
|
||||
println!("{:?}", msg);
|
||||
},
|
||||
None => fail!("oops"),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ struct Foo(int, int);
|
|||
fn main() {
|
||||
let x = Foo(1, 2);
|
||||
match x { //~ ERROR non-exhaustive
|
||||
Foo(1, b) => printfln!("%d", b),
|
||||
Foo(2, b) => printfln!("%d", b)
|
||||
Foo(1, b) => println!("{}", b),
|
||||
Foo(2, b) => println!("{}", b)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,5 +33,5 @@ pub fn main()
|
|||
let z = @mut [1,2,3];
|
||||
let z2 = z;
|
||||
add(z.my_mut_slice(), z2.my_slice());
|
||||
printfln!("%d", z[0]);
|
||||
println!("{}", z[0]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,5 +12,5 @@ pub fn main()
|
|||
let z = @mut [1,2,3];
|
||||
let z2 = z;
|
||||
add(z, z2);
|
||||
printfln!("%d", z[0]);
|
||||
println!("{}", z[0]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,5 +13,5 @@ pub fn main()
|
|||
let z = @mut [1,2,3];
|
||||
let z2 = z;
|
||||
add(&mut z[0], &z2[0]);
|
||||
printfln!("%d", z[0]);
|
||||
println!("{}", z[0]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,5 +13,5 @@ pub fn main()
|
|||
let z = @mut [1,2,3];
|
||||
let z2 = z;
|
||||
add(&mut z[0], &mut z2[0]);
|
||||
printfln!("%d", z[0]);
|
||||
println!("{}", z[0]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ trait Stuff {
|
|||
|
||||
impl Stuff for Foo {
|
||||
fn printme(&self) {
|
||||
printfln!("%d", self.x);
|
||||
println!("{}", self.x);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,5 +10,5 @@ pub fn main()
|
|||
let z = @mut [1,2,3];
|
||||
let z2 = z;
|
||||
add(&z[0], &z2[0]);
|
||||
printfln!("%d", z[0]);
|
||||
println!("{}", z[0]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ pub fn main() {
|
|||
//info!("%?", bt0);
|
||||
|
||||
do 3u.to(10u) |i| {
|
||||
printfln!("%u", i);
|
||||
println!("{}", i);
|
||||
|
||||
//let bt1 = sys::frame_address();
|
||||
//info!("%?", bt1);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ pub fn main() {
|
|||
//let bt0 = sys::rusti::frame_address(1u32);
|
||||
//info!("%?", bt0);
|
||||
do cci_iter_lib::iter([1, 2, 3]) |i| {
|
||||
printf!("%d", *i);
|
||||
println!("{}", *i);
|
||||
//assert!(bt0 == sys::rusti::frame_address(2u32));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ pub fn main() {
|
|||
//let bt0 = sys::frame_address();
|
||||
//info!("%?", bt0);
|
||||
do iter(~[1u, 2u, 3u]) |i| {
|
||||
printfln!("%u", i);
|
||||
println!("{}", i);
|
||||
|
||||
//let bt1 = sys::frame_address();
|
||||
//info!("%?", bt1);
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ static k : K = K {a: 10, b: 20, c: D {d: 30, e: 40}};
|
|||
static m : int = k.c.e;
|
||||
|
||||
pub fn main() {
|
||||
printfln!(p);
|
||||
printfln!(q);
|
||||
printfln!(t);
|
||||
println!("{:?}", p);
|
||||
println!("{:?}", q);
|
||||
println!("{:?}", t);
|
||||
assert_eq!(p, 3);
|
||||
assert_eq!(q, 3);
|
||||
assert_eq!(t, 20);
|
||||
|
|
|
|||
|
|
@ -21,5 +21,5 @@ static y : AnotherPair = AnotherPair{ x: (0xf0f0f0f0_f0f0f0f0,
|
|||
pub fn main() {
|
||||
let (p, _) = y.x;
|
||||
assert_eq!(p, - 1085102592571150096);
|
||||
printfln!("0x%x", p as uint);
|
||||
println!("{:#x}", p);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ static x: &'static int = &10;
|
|||
static y: &'static Pair<'static> = &Pair {a: 15, b: x};
|
||||
|
||||
pub fn main() {
|
||||
printfln!("x = %?", *x);
|
||||
printfln!("y = {a: %?, b: %?}", y.a, *(y.b));
|
||||
println!("x = {}", *x);
|
||||
println!("y = \\{a: {}, b: {}\\}", y.a, *(y.b));
|
||||
assert_eq!(*x, 10);
|
||||
assert_eq!(*(y.b), 10);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,6 @@ pub fn main() {
|
|||
assert_eq!(z.b, 22);
|
||||
assert_eq!(w.a, 5);
|
||||
assert_eq!(w.c, 3);
|
||||
printfln!("0x%x", x.b as uint);
|
||||
printfln!("0x%x", z.c as uint);
|
||||
println!("{:#x}", x.b);
|
||||
println!("{:#x}", z.c);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ static x : [int, ..4] = [1,2,3,4];
|
|||
static y : &'static [int] = &[1,2,3,4];
|
||||
|
||||
pub fn main() {
|
||||
printfln!(x[1]);
|
||||
printfln!(y[1]);
|
||||
println!("{:?}", x[1]);
|
||||
println!("{:?}", y[1]);
|
||||
assert_eq!(x[1], 2);
|
||||
assert_eq!(x[3], 4);
|
||||
assert_eq!(x[3], y[3]);
|
||||
|
|
|
|||
|
|
@ -16,5 +16,5 @@ struct Foo {
|
|||
pub fn main() {
|
||||
let a = Foo { x: 1, y: 2 };
|
||||
let c = Foo { x: 4, .. a};
|
||||
printfln!(c);
|
||||
println!("{:?}", c);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,5 +82,5 @@ pub fn main() {
|
|||
a);
|
||||
let sum = foldl(filt, 0u, |accum, &&n: uint| accum + n );
|
||||
|
||||
printfln!("%u", sum);
|
||||
println!("{}", sum);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ pub fn main() {
|
|||
let bools2 = to_bools(Storage{storage: ~[0b01100100]});
|
||||
|
||||
for i in range(0u, 8) {
|
||||
printfln!("%u => %u vs %u", i, bools[i] as uint, bools2[i] as uint);
|
||||
println!("{} => {} vs {}", i, bools[i], bools2[i]);
|
||||
}
|
||||
|
||||
assert_eq!(bools, bools2);
|
||||
|
|
|
|||
|
|
@ -4,5 +4,5 @@ pub fn main() {
|
|||
x += 1;
|
||||
}
|
||||
assert_eq!(x, 4096);
|
||||
printfln!("x = %u", x);
|
||||
println!("x = {}", x);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,11 +40,11 @@ pub fn main() {
|
|||
|
||||
// the following compiles and works properly
|
||||
let v1: Vec2 = a * 3f;
|
||||
printfln!("%f %f", v1.x, v1.y);
|
||||
println!("{} {}", v1.x, v1.y);
|
||||
|
||||
// the following compiles but v2 will not be Vec2 yet and
|
||||
// using it later will cause an error that the type of v2
|
||||
// must be known
|
||||
let v2 = a * 3f;
|
||||
printfln!("%f %f", v2.x, v2.y); // error regarding v2's type
|
||||
println!("{} {}", v2.x, v2.y); // error regarding v2's type
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,5 +35,5 @@ impl Shape {
|
|||
|
||||
pub fn main(){
|
||||
let s = Circle(Point { x: 1f, y: 2f }, 3f);
|
||||
printfln!("%f", s.area(s));
|
||||
println!("{}", s.area(s));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ struct S {
|
|||
|
||||
impl T for S {
|
||||
fn print(&self) {
|
||||
printfln!(self);
|
||||
println!("{:?}", self);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
type ErrPrinter = &fn(&str, &str);
|
||||
|
||||
fn example_err(prog: &str, arg: &str) {
|
||||
printfln!("%s: %s", prog, arg)
|
||||
println!("{}: {}", prog, arg)
|
||||
}
|
||||
|
||||
fn exit(+print: ErrPrinter, prog: &str, arg: &str) {
|
||||
|
|
|
|||
|
|
@ -114,7 +114,6 @@ fn query(cmd: ~[~str], sb: TcpSocketBuf) -> Result {
|
|||
//io::println(cmd);
|
||||
sb.write_str(cmd);
|
||||
let res = parse_response(@sb as @io::Reader);
|
||||
//printfln!(res);
|
||||
res
|
||||
}
|
||||
|
||||
|
|
@ -122,7 +121,7 @@ fn query2(cmd: ~[~str]) -> Result {
|
|||
let _cmd = cmd_to_str(cmd);
|
||||
do io::with_str_reader(~"$3\r\nXXX\r\n") |sb| {
|
||||
let res = parse_response(@sb as @io::Reader);
|
||||
printfln!(res);
|
||||
println!("{:?}", res);
|
||||
res
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,5 +4,5 @@ pub fn main() {
|
|||
count += 1;
|
||||
}
|
||||
assert_eq!(count, 999_999);
|
||||
printfln!("%u", count);
|
||||
println!("{}", count);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,6 @@ static mut frobulator: uint = 0xdeadbeef;
|
|||
pub fn main() {
|
||||
unsafe {
|
||||
frobulator = 0xcafebabe;
|
||||
printfln!("%? %? %?", i_live_in_more_text(), magic, frobulator);
|
||||
println!("{} {} {}", i_live_in_more_text(), magic, frobulator);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,5 +35,5 @@ fn Foo(x: int, y: int) -> Foo {
|
|||
|
||||
pub fn main() {
|
||||
let foo = Foo(3, 20);
|
||||
printfln!("%d %d", foo.sum(), foo.product());
|
||||
println!("{} {}", foo.sum(), foo.product());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,5 +13,5 @@ use std::io::println;
|
|||
static FOO: int = 3;
|
||||
|
||||
pub fn main() {
|
||||
printfln!("%d", FOO);
|
||||
println!("{}", FOO);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,10 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::io::println;
|
||||
|
||||
static FOO: [int, ..3] = [1, 2, 3];
|
||||
|
||||
pub fn main() {
|
||||
printfln!("%d %d %d", FOO[0], FOO[1], FOO[2]);
|
||||
println!("{} {} {}", FOO[0], FOO[1], FOO[2]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,6 @@ fn compute(i: mytype) -> int { return i.val + 20; }
|
|||
|
||||
pub fn main() {
|
||||
let myval = mytype(Mytype{compute: compute, val: 30});
|
||||
printfln!("%d", compute(myval));
|
||||
println!("{}", compute(myval));
|
||||
assert_eq!((myval.compute)(myval), 50);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,6 @@ pub fn main() {
|
|||
let mut arena = Arena::new();
|
||||
let p = &mut arena;
|
||||
let x = p.alloc(|| 4u);
|
||||
printf!("%u", *x);
|
||||
println!("{}", *x);
|
||||
assert_eq!(*x, 4u);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,5 +30,5 @@ fn test<T:Dot> (n:int, i:int, first:T, second:T) ->int {
|
|||
}
|
||||
pub fn main() {
|
||||
let n = test(1, 0, Nil, Nil);
|
||||
printfln!("%d", n);
|
||||
println!("{}", n);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -647,9 +647,9 @@ pub fn main() {
|
|||
|
||||
let r = u.vals.clone();
|
||||
for s in r.iter() {
|
||||
printfln!("val: %s", *s);
|
||||
println!("val: {}", *s);
|
||||
}
|
||||
error!("%?", u.vals.clone());
|
||||
error2!("{:?}", u.vals.clone());
|
||||
assert_eq!(u.vals.clone(),
|
||||
~[ ~"1", ~"2", ~"3", ~"true", ~"false", ~"5", ~"4", ~"3", ~"12"]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ pub fn main() {
|
|||
visit_ty::<~[int]>(&mut v);
|
||||
|
||||
for s in v.types.iter() {
|
||||
printfln!("type: %s", (*s).clone());
|
||||
println!("type: {}", (*s).clone());
|
||||
}
|
||||
assert_eq!((*v.types).clone(), ~[~"bool", ~"int", ~"i8", ~"i16", ~"[", ~"int", ~"]"]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,6 @@ struct Foo {
|
|||
pub fn main() {
|
||||
let a = Foo { x: 1, y: 2 };
|
||||
match a {
|
||||
Foo { x: x, y: y } => printfln!("yes, %d, %d", x, y)
|
||||
Foo { x: x, y: y } => println!("yes, {}, {}", x, y)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ impl FloatExt for f64 {}
|
|||
impl FloatExt for float {}
|
||||
|
||||
|
||||
fn test_float_ext<T:FloatExt>(n: T) { printfln!(n < n) }
|
||||
fn test_float_ext<T:FloatExt>(n: T) { println!("{}", n < n) }
|
||||
|
||||
pub fn main() {
|
||||
test_float_ext(1f32);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ pub trait NumExt: Eq + Ord + Num + NumCast {}
|
|||
impl NumExt for f32 {}
|
||||
|
||||
fn num_eq_one<T:NumExt>(n: T) {
|
||||
printfln!(n == NumCast::from(1))
|
||||
println!("{}", n == NumCast::from(1))
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
|
|
|||
|
|
@ -12,5 +12,5 @@ struct Foo(int, int);
|
|||
|
||||
pub fn main() {
|
||||
let x = Foo(1, 2);
|
||||
printfln!(x);
|
||||
println!("{:?}", x);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ struct Foo(int, int);
|
|||
pub fn main() {
|
||||
let x = Foo(1, 2);
|
||||
let Foo(y, z) = x;
|
||||
printfln!("%d %d", y, z);
|
||||
println!("{} {}", y, z);
|
||||
assert_eq!(y, 1);
|
||||
assert_eq!(z, 2);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ pub fn main() {
|
|||
Foo(a, b) => {
|
||||
assert_eq!(a, 1);
|
||||
assert_eq!(b, 2);
|
||||
printfln!("%d %d", a, b);
|
||||
println!("{} {}", a, b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,5 +10,5 @@
|
|||
|
||||
pub fn main() {
|
||||
let x: [int, ..4] = [1, 2, 3, 4];
|
||||
printfln!("%d", x[0]);
|
||||
println!("{}", x[0]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@ pub fn main() {
|
|||
[1, ..ref tail] => &tail[0],
|
||||
_ => unreachable!()
|
||||
};
|
||||
printfln!("%d", *el);
|
||||
println!("{}", *el);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue