Skip to content

rusti: use prevents any statements from being executed afterwards #5937

Closed
@danluu

Description

@danluu
rusti> use core::rand::RngUtil;
()
<anon>:31:0: 31:24 error: `use` and `extern mod` declarations must precede items
<anon>:31 use core::rand::RngUtil;
          ^~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
rust: task failed at 'explicit failure', /Users/danluu/Downloads/rust-0.6/src/libsyntax/diagnostic.rs:99
rusti> assert!(true);
<anon>:31:0: 31:24 error: `use` and `extern mod` declarations must precede items
<anon>:31 use core::rand::RngUtil;
          ^~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
rust: task failed at 'explicit failure', /Users/danluu/Downloads/rust-0.6/src/libsyntax/diagnostic.rs:99

Is this considered to be worth fixing? I think I hack in a kludge that would fix this, but there's this big comment in rusti.c:

/**
 * The AST (or the rest of rustc) are not sendable yet,
 * so recorded things are printed to strings. A terrible hack that
 * needs changes to rustc in order to be outed. This is unfortunately
 * going to cause the REPL to regress in parser performance,
 * because it has to parse the statements and view_items on each
 * input.
 */

If that change will fix it anyway, I'm not sure it's worth making a temporary fix.

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