Skip to content

tutorial: hello world sample program won't compile #2986

Closed
@fsouza

Description

@fsouza
% rustc --version
rustc 0.3.1
host: x86_64-apple-darwin
% cat > hello.rs
fn main(args: ~[~str]) {
    io::println(~"hello world from '" + args[0] + ~"'!");
}
^D
% rustc hello.rs
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: 3:1 error: Wrong type in main function: found `extern fn(~[~str])`, expecting `extern fn(~[str]) -> ()` or `extern fn() -> ()`
hello.rs:1 fn main(args: ~[~str]) {
hello.rs:2     io::println(~"hello world from '" + args[0] + ~"'!");
hello.rs:3 }
error: aborting due to 3 previous errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions