On 10/3/12 7:13 PM, Amitava Shee wrote:
I just built rust from git source on my osx 10.6.8.

amitava$ rustc --version
rustc 0.4 (c3f9b72 2012-09-30 21:35:32 -0700)
host: x86_64-apple-darwin

I am trying to compile the following "hello.rs <http://hello.rs>"

fn main() {
   let x = ["hello","world"];
   for x.each |y| {
     io::println(y);
   }
}

I get the following error
amitava:l2 amitava$ make
rustc -g hello.rs <http://hello.rs>
hello.rs:4:16: 4:17 error: mismatched types: expected `&/str` but found
`&&static/str` (expected &/str but found &-ptr)
hello.rs:4 <http://hello.rs:4>     io::println(y);
                            ^
error: aborting due to previous error
make: *** [hello] Error 101

What am I missing?

each now returns a reference, so you want `io::println(*y)`.

Patrick


_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to