@@ -735,15 +735,26 @@ Rust syntax is restricted in two ways:
735735
736736# Crates and source files
737737
738- Rust is a * compiled* language. Its semantics obey a * phase distinction* between
739- compile-time and run-time. Those semantic rules that have a * static
738+ Although Rust, like any other language, can be implemented by an interpreter as
739+ well as a compiler, the only existing implementation is a compiler &mdash ;
740+ from now on referred to as * the* Rust compiler &mdash ; and the language has
741+ always been designed to be compiled. For these reasons, this section assumes a
742+ compiler.
743+
744+ Rust's semantics obey a * phase distinction* between compile-time and
745+ run-time.[ ^ phase-distinction ] Those semantic rules that have a * static
740746interpretation* govern the success or failure of compilation. Those semantics
741747that have a * dynamic interpretation* govern the behavior of the program at
742748run-time.
743749
750+ [ ^ phase-distinction ] : This distinction would also exist in an interpreter.
751+ Static checks like syntactic analysis, type checking, and lints should
752+ happen before the program is executed regardless of when it is executed.
753+
744754The compilation model centers on artifacts called _ crates_ . Each compilation
745755processes a single crate in source form, and if successful, produces a single
746- crate in binary form: either an executable or a library.[ ^ cratesourcefile ]
756+ crate in binary form: either an executable or some sort of
757+ library.[ ^ cratesourcefile ]
747758
748759[ ^ cratesourcefile ] : A crate is somewhat analogous to an * assembly* in the
749760 ECMA-335 CLI model, a * library* in the SML/NJ Compilation Manager, a * unit*
@@ -764,21 +775,25 @@ extension `.rs`.
764775A Rust source file describes a module, the name and location of which &mdash ;
765776in the module tree of the current crate &mdash ; are defined from outside the
766777source file: either by an explicit ` mod_item ` in a referencing source file, or
767- by the name of the crate itself.
778+ by the name of the crate itself. Every source file is a module, but not every
779+ module needs its own source file: [ module definitions] ( #modules ) can be nested
780+ within one file.
768781
769782Each source file contains a sequence of zero or more ` item ` definitions, and
770- may optionally begin with any number of ` attributes ` that apply to the
771- containing module. Attributes on the anonymous crate module define important
772- metadata that influences the behavior of the compiler.
783+ may optionally begin with any number of [ attributes] (#Items and attributes)
784+ that apply to the containing module, most of which influence the behavior of
785+ the compiler. The anonymous crate module can have additional attributes that
786+ apply to the crate as a whole.
773787
774788``` no_run
775- // Crate name
789+ // Specify the crate name.
776790#![crate_name = "projx"]
777791
778- // Specify the output type
792+ // Specify the type of output artifact.
779793#![crate_type = "lib"]
780794
781- // Turn on a warning
795+ // Turn on a warning.
796+ // This can be done in any module, not just the anonymous crate module.
782797#![warn(non_camel_case_types)]
783798```
784799
0 commit comments