diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2020-05-29 21:51:46 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2020-05-29 22:55:58 +0300 |
| commit | 21755b58c900cd5d14422ebd980fe11390e021fe (patch) | |
| tree | e8abb136697e6f4f64903cf4e80cc5b3684f5c31 /src/test/ui/parser | |
| parent | 96dd4690c3aa70ec312448c3f2d50e6dc6fb87df (diff) | |
rustc_lexer: Optimize shebang detection slightly
Diffstat (limited to 'src/test/ui/parser')
| -rw-r--r-- | src/test/ui/parser/shebang/shebang-doc-comment.rs | 6 | ||||
| -rw-r--r-- | src/test/ui/parser/shebang/shebang-doc-comment.stderr | 8 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/test/ui/parser/shebang/shebang-doc-comment.rs b/src/test/ui/parser/shebang/shebang-doc-comment.rs new file mode 100644 index 00000000000..7dbb9eebc75 --- /dev/null +++ b/src/test/ui/parser/shebang/shebang-doc-comment.rs @@ -0,0 +1,6 @@ +#!///bin/bash +[allow(unused_variables)] +//~^^ ERROR expected `[`, found doc comment + +// Doc comment is misinterpreted as a whitespace (regular comment) during shebang detection. +// Even if it wasn't, it would still result in an error, just a different one. diff --git a/src/test/ui/parser/shebang/shebang-doc-comment.stderr b/src/test/ui/parser/shebang/shebang-doc-comment.stderr new file mode 100644 index 00000000000..f524f556837 --- /dev/null +++ b/src/test/ui/parser/shebang/shebang-doc-comment.stderr @@ -0,0 +1,8 @@ +error: expected `[`, found doc comment `///bin/bash` + --> $DIR/shebang-doc-comment.rs:1:3 + | +LL | #!///bin/bash + | ^^^^^^^^^^^ expected `[` + +error: aborting due to previous error + |
