From 74c4550a4e3ed2574f9a0ca75848733145923075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=C3=B3n=20Orell=20Valerian=20Liehr?= Date: Sun, 28 Dec 2025 18:03:36 +0100 Subject: [PATCH 1/3] Update note about shebang removal in `include`d files --- src/input-format.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/input-format.md b/src/input-format.md index cd67bdd63f..7920290e49 100644 --- a/src/input-format.md +++ b/src/input-format.md @@ -55,7 +55,9 @@ r[input.shebang.inner-attribute] 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. > [!NOTE] -> 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. +> The standard library [`include!`] macro applies byte order mark removal and CRLF normalization to the file it reads. +> Moreover, it applies shebang removal if invoked in an item context (as opposed to expression or statement contexts). +> The [`include_str!`] and [`include_bytes!`] macros do not perform any of these preprocessing steps. r[input.tokenization] ## Tokenization From 4e37ceada8f6782d706a5e1721edc763d406b8b2 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sat, 3 Jan 2026 10:02:38 -0800 Subject: [PATCH 2/3] Move include! macro note to the bottom This note does not belong to the input.shebang.inner-attribute rule. For lack of a better place, I'm sticking it at the bottom. --- src/input-format.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/input-format.md b/src/input-format.md index 7920290e49..1ca50d272e 100644 --- a/src/input-format.md +++ b/src/input-format.md @@ -54,16 +54,16 @@ fn main() { r[input.shebang.inner-attribute] 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. -> [!NOTE] -> The standard library [`include!`] macro applies byte order mark removal and CRLF normalization to the file it reads. -> Moreover, it applies shebang removal if invoked in an item context (as opposed to expression or statement contexts). -> The [`include_str!`] and [`include_bytes!`] macros do not perform any of these preprocessing steps. - r[input.tokenization] ## Tokenization The resulting sequence of characters is then converted into tokens as described in the remainder of this chapter. +> [!NOTE] +> The standard library [`include!`] macro applies byte order mark removal and CRLF normalization to the file it reads. +> Moreover, it applies shebang removal if invoked in an item context (as opposed to expression or statement contexts). +> The [`include_str!`] and [`include_bytes!`] macros do not perform any of these preprocessing steps. + [inner attribute]: attributes.md [BYTE ORDER MARK]: https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8 [comments]: comments.md From 70a18f53fce127b506cd21441018ace2f1508efd Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sat, 3 Jan 2026 10:08:27 -0800 Subject: [PATCH 3/3] Change the include! note to be a list --- src/input-format.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/input-format.md b/src/input-format.md index 1ca50d272e..2432da0339 100644 --- a/src/input-format.md +++ b/src/input-format.md @@ -60,9 +60,13 @@ r[input.tokenization] The resulting sequence of characters is then converted into tokens as described in the remainder of this chapter. > [!NOTE] -> The standard library [`include!`] macro applies byte order mark removal and CRLF normalization to the file it reads. -> Moreover, it applies shebang removal if invoked in an item context (as opposed to expression or statement contexts). -> The [`include_str!`] and [`include_bytes!`] macros do not perform any of these preprocessing steps. +> The standard library [`include!`] macro applies the following transformations to the file it reads: +> +> - Byte order mark removal. +> - CRLF normalization. +> - Shebang removal when invoked in an item context (as opposed to expression or statement contexts). +> +> The [`include_str!`] and [`include_bytes!`] macros do not apply these transformations. [inner attribute]: attributes.md [BYTE ORDER MARK]: https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8