|
11 | 11 | > UTF8BOM : `\uFEFF`
|
12 | 12 | > SHEBANG : `#!` ~[`[` `\n`] ~`\n`<sup>*</sup>
|
13 | 13 |
|
14 |
| -Although Rust, like any other language, can be implemented by an interpreter as |
15 |
| -well as a compiler, the only existing implementation is a compiler, |
16 |
| -and the language has |
17 |
| -always been designed to be compiled. For these reasons, this section assumes a |
18 |
| -compiler. |
| 14 | + |
| 15 | +> Note: Although Rust, like any other language, can be implemented by an |
| 16 | +> interpreter as well as a compiler, the only existing implementation is a |
| 17 | +> compiler,and the language has always been designed to be compiled. For these |
| 18 | +> reasons, this section assumes a compiler. |
19 | 19 |
|
20 | 20 | Rust's semantics obey a *phase distinction* between compile-time and
|
21 | 21 | run-time.[^phase-distinction] Semantic rules that have a *static
|
@@ -66,9 +66,17 @@ apply to the crate as a whole.
|
66 | 66 | #![warn(non_camel_case_types)]
|
67 | 67 | ```
|
68 | 68 |
|
69 |
| -A crate that contains a `main` function can be compiled to an executable. If a |
70 |
| -`main` function is present, its return type must be `()` |
71 |
| -("[unit]") and it must take no arguments. |
| 69 | +A crate that contains a `main` [function] can be compiled to an executable. If a |
| 70 | +`main` function is present, it must take no arguments, must not declare any |
| 71 | +[trait or lifetime bounds], must not have any [where clauses], and its return |
| 72 | +type must be one of the following: |
| 73 | + |
| 74 | +* `()` |
| 75 | +<!-- * `!` --> |
| 76 | +* `Result<T, E> where T: on this list, E: Error` |
| 77 | + |
| 78 | +> Note: The implementation of which return types are allowed is determined by |
| 79 | +> the unstable [`Termination`] trait. |
72 | 80 |
|
73 | 81 | The optional [_UTF8 byte order mark_] (UTF8BOM production) indicates that the
|
74 | 82 | file is encoded in UTF8. It can only occur at the beginning of the file and
|
@@ -98,9 +106,13 @@ fn main() {
|
98 | 106 |
|
99 | 107 | [module]: items/modules.html
|
100 | 108 | [module path]: paths.html
|
101 |
| -[attributes]: items-and-attributes.html |
| 109 | +[attributes]: attributes.html |
102 | 110 | [unit]: types.html#tuple-types
|
103 | 111 | [_InnerAttribute_]: attributes.html
|
104 | 112 | [_Item_]: items.html
|
105 | 113 | [_shebang_]: https://en.wikipedia.org/wiki/Shebang_(Unix)
|
106 | 114 | [_utf8 byte order mark_]: https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8
|
| 115 | +[function]: items/functions.html |
| 116 | +[`Termination`]: ../std/process/trait.Termination.html |
| 117 | +[where clause]: items/where-clauses.html |
| 118 | +[trait or lifetime bounds]: trait-bounds.html |
0 commit comments