Auto merge of #73596 - petrochenkov:shebang2, r=Mark-Simulacrum

rustc_lexer: Simplify shebang parsing once more

Fixes https://github.com/rust-lang/rust/issues/73250 (beta regression)

Treat any line starting with `!#` as a shebang candidate, not only lines with something non-whitespace.
This way we no longer need to define what `is_whitespace` means ([Linux shebang whitespace](https://github.com/torvalds/linux/blob/master/fs/binfmt_script.c), ASCII whitespace, Rust lexer whitespace, etc), which is nice.

This change makes some invalid Rust code valid (see the regression above), but still never interprets a fragment of valid Rust code as a shebang.

(This PR also removes one duplicate test.)
This commit is contained in:
bors 2020-06-26 22:42:44 +00:00
commit dda8a7fde9
4 changed files with 21 additions and 20 deletions

View file

@ -0,0 +1,4 @@
#!
// check-pass
fn main() {}

View file

@ -0,0 +1,5 @@
#!
// check-pass
// ignore-tidy-end-whitespace
fn main() {}

View file

@ -1,5 +0,0 @@
#!/usr/bin/env rustx
// run-pass
pub fn main() { println!("Hello World"); }