cleanup shebang handling in the lexer#59687
Conversation
|
(rust_highfive has picked a reviewer for you, use r? to override) |
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
| debug!("Skipping a shebang"); | ||
| if loc.line == 1 && loc.col == CharPos(0) { | ||
| // FIXME: Add shebang "token", return it | ||
| let is_beginning_of_file = self.pos == self.source_file.start_pos; |
There was a problem hiding this comment.
So, the new code accepts shebang at the start of anything that compiler treats as a source file - out-of-line mod, perhaps command line or macro?
And I'm not even sure what the old code does.
I rather wish this thing never existed in the language.
There was a problem hiding this comment.
My reading is that the old code did the same, but in a more elaborate way, by binary searching in a single-element slice. I’ve manually checked that shebangs are accepted in the outofline modules today.
There was a problem hiding this comment.
For the referrnce, here’s the original commit that added the code: #2430
Accidentally, it also added this _adj function, which I would like to get rid of next
|
@bors r+ rollup |
|
📌 Commit fdb8752 has been approved by |
cleanup shebang handling in the lexer
Rollup of 5 pull requests Successful merges: - #59665 (improve worst-case performance of HashSet.is_subset) - #59687 (cleanup shebang handling in the lexer) - #59690 (Mark unix::ffi::OsStrExt methods as inline) - #59702 (Use declare_lint_pass! and impl_lint_pass! in more places) - #59712 (wasm32: Default to a "static" relocation model) Failed merges: r? @ghost
No description provided.