diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-03-11 20:55:12 -0700 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-03-11 20:55:12 -0700 |
| commit | fde4c1efbbe2c3fbd29b50a9fe61283714cd8769 (patch) | |
| tree | cb4902f1543c704558fbc788ebac49478d1a01ca | |
| parent | d7ae9f1370fc14cd77f9da6b547e533cebf7e12b (diff) | |
| download | rust-fde4c1efbbe2c3fbd29b50a9fe61283714cd8769.tar.gz rust-fde4c1efbbe2c3fbd29b50a9fe61283714cd8769.zip | |
Document what the type of the main() function should be
| -rw-r--r-- | doc/rust.md | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/doc/rust.md b/doc/rust.md index 4761ecaa40e..dc68b8b6478 100644 --- a/doc/rust.md +++ b/doc/rust.md @@ -550,6 +550,9 @@ location of which -- in the module tree of the current crate -- is defined from outside the source file: either by an explicit `source_directive` in a referencing crate file, or by the filename of the source file itself. +A source file that contains a `main` function can be compiled to an +executable. If a `main` function is present, it must have no [type parameters](#type-parameters) +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]`. # Items and attributes @@ -592,6 +595,8 @@ the name of the enclosing item, or is private to the enclosing item (in the case of functions). The exact locations in which sub-items may be declared is given by the grammar. +### Type Parameters + All items except modules may be *parametrized* by type. Type parameters are given as a comma-separated list of identifiers enclosed in angle brackets (`<...>`), after the name of the item and before its definition. The type |
