You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/rust.md
+5Lines changed: 5 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -550,6 +550,9 @@ location of which -- in the module tree of the current crate -- is defined
550
550
from outside the source file: either by an explicit `source_directive` in
551
551
a referencing crate file, or by the filename of the source file itself.
552
552
553
+
A source file that contains a `main` function can be compiled to an
554
+
executable. If a `main` function is present, it must have no [type parameters](#type-parameters)
555
+
and no [constraints](#constraints). Its return type must be [`nil`](#primitive-types) and it must either have no arguments, or a single argument of type `[str]`.
553
556
554
557
# Items and attributes
555
558
@@ -592,6 +595,8 @@ the name of the enclosing item, or is private to the enclosing item (in the
592
595
case of functions). The exact locations in which sub-items may be declared is
593
596
given by the grammar.
594
597
598
+
### Type Parameters
599
+
595
600
All items except modules may be *parametrized* by type. Type parameters are
596
601
given as a comma-separated list of identifiers enclosed in angle brackets
597
602
(`<...>`), after the name of the item and before its definition. The type
0 commit comments