about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2020-09-02 00:22:47 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2020-09-02 00:40:19 +0300
commitb1491eacfc2f2ff05ff2a1d3b557c30e15c5f81f (patch)
treea55ad3e4f3b06403a6d6d5ebef901e161143acd1 /src
parenteb9e7c357e26bf41c47661720e46f4498de32b83 (diff)
downloadrust-b1491eacfc2f2ff05ff2a1d3b557c30e15c5f81f.tar.gz
rust-b1491eacfc2f2ff05ff2a1d3b557c30e15c5f81f.zip
lexer: Tiny improvement to shebang detection
Lexer now discerns between regular comments and doc comments, so use that.
The change only affects the choice of reported errors.
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/parser/shebang/shebang-doc-comment.rs5
-rw-r--r--src/test/ui/parser/shebang/shebang-doc-comment.stderr8
2 files changed, 5 insertions, 8 deletions
diff --git a/src/test/ui/parser/shebang/shebang-doc-comment.rs b/src/test/ui/parser/shebang/shebang-doc-comment.rs
index 7dbb9eebc75..72866753e0e 100644
--- a/src/test/ui/parser/shebang/shebang-doc-comment.rs
+++ b/src/test/ui/parser/shebang/shebang-doc-comment.rs
@@ -1,6 +1,3 @@
 #!///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.
+//~^ ERROR expected item, found `[`
diff --git a/src/test/ui/parser/shebang/shebang-doc-comment.stderr b/src/test/ui/parser/shebang/shebang-doc-comment.stderr
index f524f556837..2227d45ec5a 100644
--- a/src/test/ui/parser/shebang/shebang-doc-comment.stderr
+++ b/src/test/ui/parser/shebang/shebang-doc-comment.stderr
@@ -1,8 +1,8 @@
-error: expected `[`, found doc comment `///bin/bash`
-  --> $DIR/shebang-doc-comment.rs:1:3
+error: expected item, found `[`
+  --> $DIR/shebang-doc-comment.rs:2:1
    |
-LL | #!///bin/bash
-   |   ^^^^^^^^^^^ expected `[`
+LL | [allow(unused_variables)]
+   | ^ expected item
 
 error: aborting due to previous error