Closed
Description
It seems the Hello World example in the tutorial doesn't compile.
Pasting the following code into a file called hello.rs
:
fn main(args: ~[~str]) {
io::println(~"hello world from '" + args[0] + ~"'!");
}
and then running rustc hello.rs
returns the following:
hello.rs:2:40: 2:46 error: mismatched types: expected `str/&<R0>` but found `~str` (str/&<R0> vs ~-ptr)
hello.rs:2 io::println(~"hello world from '" + args[0] + ~"'!");
^~~~~~
hello.rs:2:50: 2:55 error: mismatched types: expected `str/&<R1>` but found `~str` (str/&<R1> vs ~-ptr)
hello.rs:2 io::println(~"hello world from '" + args[0] + ~"'!");
^~~~~
hello.rs:1:0: 1:0 error: Wrong type in main function: found `extern fn(~[~str])`, expecting `extern fn(~[str]) -> ()` or `extern fn() -> ()`
hello.rs:1 fn main(args: ~[~str]) {
^
error: aborting due to 3 previous errors
I don't know rust, so I'm not sure what's wrong here or whether the fault is on my end. Any help is appreciated!
Metadata
Metadata
Assignees
Labels
No labels