diff options
| author | bors <bors@rust-lang.org> | 2015-04-24 13:50:40 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-04-24 13:50:40 +0000 |
| commit | f191f924214aa1dcd342ada1d99775ccbb01ddd7 (patch) | |
| tree | aaba16e5f6fd64f9107b81b0c978914313f63b93 /src/doc/reference.md | |
| parent | 9d439b41777103b8b349635e68e9ccd3648aabc2 (diff) | |
| parent | 1447ee4c2031cfc0950b1bf0f658055e7a86e0c2 (diff) | |
| download | rust-f191f924214aa1dcd342ada1d99775ccbb01ddd7.tar.gz rust-f191f924214aa1dcd342ada1d99775ccbb01ddd7.zip | |
Auto merge of #24758 - Manishearth:rollup, r=Manishearth
- Successful merges: #24523, #24698, #24699, #24700, #24706, #24717, #24718, #24721, #24727 - Failed merges:
Diffstat (limited to 'src/doc/reference.md')
| -rw-r--r-- | src/doc/reference.md | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/src/doc/reference.md b/src/doc/reference.md index a61d635af7d..1cedbf299c3 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -271,7 +271,7 @@ cases mentioned in [Number literals](#number-literals) below. ##### Suffixes | Integer | Floating-point | |---------|----------------| -| `u8`, `i8`, `u16`, `i16`, `u32`, `i32`, `u64`, `i64`, `is` (`isize`), `us` (`usize`) | `f32`, `f64` | +| `u8`, `i8`, `u16`, `i16`, `u32`, `i32`, `u64`, `i64`, `isize`, `usize` | `f32`, `f64` | #### Character and string literals @@ -738,15 +738,26 @@ Rust syntax is restricted in two ways: # Crates and source files -Rust is a *compiled* language. Its semantics obey a *phase distinction* between -compile-time and run-time. Those semantic rules that have a *static +Although Rust, like any other language, can be implemented by an interpreter as +well as a compiler, the only existing implementation is a compiler — +from now on referred to as *the* Rust compiler — and the language has +always been designed to be compiled. For these reasons, this section assumes a +compiler. + +Rust's semantics obey a *phase distinction* between compile-time and +run-time.[^phase-distinction] Those semantic rules that have a *static interpretation* govern the success or failure of compilation. Those semantics that have a *dynamic interpretation* govern the behavior of the program at run-time. +[^phase-distinction]: This distinction would also exist in an interpreter. + Static checks like syntactic analysis, type checking, and lints should + happen before the program is executed regardless of when it is executed. + The compilation model centers on artifacts called _crates_. Each compilation processes a single crate in source form, and if successful, produces a single -crate in binary form: either an executable or a library.[^cratesourcefile] +crate in binary form: either an executable or some sort of +library.[^cratesourcefile] [^cratesourcefile]: A crate is somewhat analogous to an *assembly* in the ECMA-335 CLI model, a *library* in the SML/NJ Compilation Manager, a *unit* @@ -767,21 +778,25 @@ extension `.rs`. A Rust source file describes a module, the name and location of which — in the module tree of the current crate — are defined from outside the source file: either by an explicit `mod_item` in a referencing source file, or -by the name of the crate itself. +by the name of the crate itself. Every source file is a module, but not every +module needs its own source file: [module definitions](#modules) can be nested +within one file. Each source file contains a sequence of zero or more `item` definitions, and -may optionally begin with any number of `attributes` that apply to the -containing module. Attributes on the anonymous crate module define important -metadata that influences the behavior of the compiler. +may optionally begin with any number of [attributes](#Items and attributes) +that apply to the containing module, most of which influence the behavior of +the compiler. The anonymous crate module can have additional attributes that +apply to the crate as a whole. ```no_run -// Crate name +// Specify the crate name. #![crate_name = "projx"] -// Specify the output type +// Specify the type of output artifact. #![crate_type = "lib"] -// Turn on a warning +// Turn on a warning. +// This can be done in any module, not just the anonymous crate module. #![warn(non_camel_case_types)] ``` |
