Skip to content

Commit 09964b4

Browse files
authored
Merge pull request #2127 from fmease/upd-include-shebang
Update note about shebang removal in `include`d files
2 parents 6363385 + 70a18f5 commit 09964b4

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/input-format.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,20 @@ fn main() {
5454
r[input.shebang.inner-attribute]
5555
As an exception, if the `#!` characters are followed (ignoring intervening [comments] or [whitespace]) by a `[` token, nothing is removed. This prevents an [inner attribute] at the start of a source file being removed.
5656

57-
> [!NOTE]
58-
> The standard library [`include!`] macro applies byte order mark removal, CRLF normalization, and shebang removal to the file it reads. The [`include_str!`] and [`include_bytes!`] macros do not.
59-
6057
r[input.tokenization]
6158
## Tokenization
6259

6360
The resulting sequence of characters is then converted into tokens as described in the remainder of this chapter.
6461

62+
> [!NOTE]
63+
> The standard library [`include!`] macro applies the following transformations to the file it reads:
64+
>
65+
> - Byte order mark removal.
66+
> - CRLF normalization.
67+
> - Shebang removal when invoked in an item context (as opposed to expression or statement contexts).
68+
>
69+
> The [`include_str!`] and [`include_bytes!`] macros do not apply these transformations.
70+
6571
[inner attribute]: attributes.md
6672
[BYTE ORDER MARK]: https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8
6773
[comments]: comments.md

0 commit comments

Comments
 (0)