What type is `3`? There's know way to know. Use `3i` for int, `3u` for uint, etc.
On Sat, Jan 11, 2014 at 12:17 PM, Renato Lenzi <[email protected]> wrote: > The code is trivial: > > fn main() > { > let x = 3; > println(x.to_str()); > } > > the error is this (on Win7) > > d:\Rust09\bin>rustc 00025.rs > 00025.rs:4:11: 4:22 error: multiple applicable methods in scope > 00025.rs:4 println(x.to_str()); > ^~~~~~~~~~~ > 00025.rs:4:11: 4:22 note: candidate #1 is `std::int::ToStr$int::to_str` > 00025.rs:4 println(x.to_str()); > ^~~~~~~~~~~ > 00025.rs:4:11: 4:22 note: candidate #2 is `std::i8::ToStr$i8::to_str` > 00025.rs:4 println(x.to_str()); > ^~~~~~~~~~~ > 00025.rs:4:11: 4:22 note: candidate #3 is `std::i16::ToStr$i16::to_str` > 00025.rs:4 println(x.to_str()); > ^~~~~~~~~~~ > 00025.rs:4:11: 4:22 note: candidate #4 is `std::i32::ToStr$i32::to_str` > 00025.rs:4 println(x.to_str()); > ^~~~~~~~~~~ > 00025.rs:4:11: 4:22 note: candidate #5 is `std::i64::ToStr$i64::to_str` > 00025.rs:4 println(x.to_str()); > ^~~~~~~~~~~ > 00025.rs:4:11: 4:22 note: candidate #6 is `std::uint::ToStr$uint::to_str` > 00025.rs:4 println(x.to_str()); > ^~~~~~~~~~~ > 00025.rs:4:11: 4:22 note: candidate #7 is `std::u8::ToStr$u8::to_str` > 00025.rs:4 println(x.to_str()); > ^~~~~~~~~~~ > 00025.rs:4:11: 4:22 note: candidate #8 is `std::u16::ToStr$u16::to_str` > 00025.rs:4 println(x.to_str()); > ^~~~~~~~~~~ > 00025.rs:4:11: 4:22 note: candidate #9 is `std::u32::ToStr$u32::to_str` > 00025.rs:4 println(x.to_str()); > ^~~~~~~~~~~ > 00025.rs:4:11: 4:22 note: candidate #10 is `std::u64::ToStr$u64::to_str` > 00025.rs:4 println(x.to_str()); > > ^~~~~~~~~~~ > error: aborting due to previous error > task 'rustc' failed at 'explicit failure', > C:\bot\slave\dist2-win\build\src\libs > yntax\diagnostic.rs:75 > task '<main>' failed at 'explicit failure', > C:\bot\slave\dist2-win\build\src\lib > rustc\lib.rs:453 > > any idea? > thanks. > > _______________________________________________ > Rust-dev mailing list > [email protected] > https://mail.mozilla.org/listinfo/rust-dev > _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
