I'm kinda working my way through The Rust Language
Tutorial<http://static.rust-lang.org/doc/0.7/tutorial.html>,
and the sample in section 4.3 "Loops" seems broken.
The code is as follows.
let mut x = 5;loop {
x += x - 3;
if x % 5 == 0 { break; }
println(int::to_str(x));
}
If I wrap my main function around this code, it won't compile because it
says that int::to_str(x) is unresolved. Specifically...
test.rs:7:12: 7:23 error: unresolved name
test.rs:7 println(int::to_str(x));
^~~~~~~~~~~
test.rs:7:12: 7:23 error: use of undeclared module `int`
test.rs:7 println(int::to_str(x));
^~~~~~~~~~~
test.rs:7:12: 7:23 error: unresolved name `int::to_str`.
test.rs:7 println(int::to_str(x));
If I try changing it to x.to_str(), then it gets upset because x's type is
ambiguous and it can't decide between all of the many numeric types as to
which one should receive the to_str() call.
I fixed it by declaring "x" to be an int and then just saying x.to_str()...
but why was int::to_str unresolved?
--
Sincerely,
Josh
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev