tree-sitter / tree-sitter-rust

Rust grammar for tree-sitter
MIT License
338 stars 96 forks source link

Support for shebang #183

Closed blt-r closed 1 year ago

blt-r commented 1 year ago

rustc already can ignore the shebang. And cargo-script RFC was accepted (https://github.com/rust-lang/cargo/issues/12207).

This is a valid rust:

#!/usr/bin/env -S cargo +nightly -Zscript

fn main() {
    println!("Hello from cargo script")
}

But it isn't parsed

blt-r commented 1 year ago

It is also documented in https://doc.rust-lang.org/reference/crates-and-source-files.html#shebang