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
+50-70
Original file line number
Diff line number
Diff line change
@@ -570,53 +570,29 @@ Semantic rules called "dynamic semantics" govern the behavior of programs at run
570
570
A program that fails to compile due to violation of a compile-time rule has no defined dynamic semantics; the compiler should halt with an error report, and produce no executable artifact.
571
571
572
572
The compilation model centres on artifacts called _crates_.
573
-
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.
573
+
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.^[A crate is somewhat
574
+
analogous to an *assembly* in the ECMA-335 CLI model, a *library* in the
575
+
SML/NJ Compilation Manager, a *unit* in the Owens and Flatt module system,
576
+
or a *configuration* in Mesa.]
574
577
575
578
A _crate_ is a unit of compilation and linking, as well as versioning, distribution and runtime loading.
576
579
A crate contains a _tree_ of nested [module](#modules) scopes.
577
580
The top level of this tree is a module that is anonymous (from the point of view of paths within the module) and any item within a crate has a canonical [module path](#paths) denoting its location within the crate's module tree.
578
581
579
-
Crates are provided to the Rust compiler through two kinds of file:
580
-
581
-
-_crate files_, that end in `.rc` and each define a `crate`.
582
-
-_source files_, that end in `.rs` and each define a `module`.
583
-
584
-
> **Note:** The functionality of crate files will be merged into source files in future versions of Rust.
585
-
> The separate processing of crate files, both their grammar and file extension, will be removed.
586
-
587
-
The Rust compiler is always invoked with a single crate file as input, and always produces a single output crate.
588
-
589
-
When the Rust compiler is invoked with a crate file, it reads the _explicit_
590
-
definition of the crate it's compiling from that file, and populates the
591
-
crate with modules derived from all the source files referenced by the
592
-
crate, reading and processing all the referenced modules at once.
593
-
594
-
When the Rust compiler is invoked with a source file, it creates an _implicit_ crate and treats the source file as if it is the sole module populating this explicit crate.
595
-
The module name is derived from the source file name, with the `.rs` extension removed.
596
-
597
-
## Crate files
582
+
The Rust compiler is always invoked with a single source file as input, and always produces a single output crate.
583
+
The processing of that source file may result in other source files being loaded as modules.
584
+
Source files typically have the extension `.rs` but, by convention,
585
+
source files that represent crates have the extension `.rc`, called *crate files*.
0 commit comments