mozilla/rust — Issue #1772: Shebangs as comments
Author: mcandre
Created: 2012-02-07 16:14:49+00:00
State: open

Can we treat shebangs as comments for those who like doing `#!/usr/bin/env rustx`?

It would be nice to compile or interpret the same Rust code as desired, but currently, when you try to compile Rust code with a shebang, you get an ugly syntax error.

hello.rs:

#!/usr/bin/env rustx

use std;

fn main() {
std::io::println("Hello World!");
}

expected output:

$ rustc hello.rs
$ ./hello
Hello World!

actual output:

$ rustc hello.rs
hello.rs:1:1: 1:2 error: expecting '[' but found '!'
hello.rs:1 #!/usr/bin/env rustx