99
1010> ** <sup >Lexer</sup >** \
1111> UTF8BOM : ` \uFEFF ` \
12- > SHEBANG : ` #! ` ~ [ ` [ ` ` \n ` ] ~ ` \n ` <sup >\* </sup >
12+ > SHEBANG : ` #! ` \ ~` \n ` <sup >\+ </sup >[ † ] ( #shebang )
1313
1414
1515> Note: Although Rust, like any other language, can be implemented by an
@@ -65,10 +65,14 @@ apply to the crate as a whole.
6565#![warn(non_camel_case_types)]
6666```
6767
68+ ## Byte order mark
69+
6870The optional [ _ UTF8 byte order mark_ ] (UTF8BOM production) indicates that the
6971file is encoded in UTF8. It can only occur at the beginning of the file and
7072is ignored by the compiler.
7173
74+ ## Shebang
75+
7276A source file can have a [ _ shebang_ ] (SHEBANG production), which indicates
7377to the operating system what program to use to execute this file. It serves
7478essentially to treat the source file as an executable script. The shebang
@@ -84,6 +88,11 @@ fn main() {
8488}
8589```
8690
91+ A restriction is imposed on the shebang syntax to avoid confusion with an
92+ [ attribute] . The ` #! ` characters must not be followed by a ` [ ` token, ignoring
93+ intervening [ comments] or [ whitespace] . If this restriction fails, then it is
94+ not treated as a shebang, but instead as the start of an attribute.
95+
8796## Preludes and ` no_std `
8897
8998All crates have a * prelude* that automatically inserts names from a specific
@@ -166,8 +175,10 @@ or `-` (U+002D) characters.
166175[ `std::prelude::v1` ] : ../std/prelude/index.html
167176[ attribute ] : attributes.md
168177[ attributes ] : attributes.md
178+ [ comments ] : comments.md
169179[ function ] : items/functions.md
170180[ module ] : items/modules.md
171181[ module path ] : paths.md
172182[ trait or lifetime bounds ] : trait-bounds.md
173183[ where clauses ] : items/generics.md#where-clauses
184+ [ whitespace ] : whitespace.md
0 commit comments