Skip to content

Doc: http://static.rust-lang.org/doc/tutorial-ffi.html sample does not compile #5876

Closed
@mikedilger

Description

@mikedilger

New to rust, I can't debug it, but I tried the following changes to main without figuring it out:

fn main() {
    let args: ~[~str] = core::os::args();
    assert!(args.len()>1);

    /* This works */
    io::println( args[1] );

    /* This works too */
    io::println( sha1( ~"xyz" ) );

    /* This gives a compile error:
    "moving out of immutable vec content" */
    io::println( sha1( args[1] ) );
}

My rust compiled from git commit 5f13e9c

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