Skip to content

Commit e1a4921

Browse files
committed
Unwrap crates and source files
This unwraps the text to follow our style guide.
1 parent 4165999 commit e1a4921

1 file changed

Lines changed: 13 additions & 45 deletions

File tree

src/crates-and-source-files.md

Lines changed: 13 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -12,52 +12,28 @@ r[crate.syntax]
1212
> Although Rust, like any other language, can be implemented by an interpreter as well as a compiler, the only existing implementation is a compiler, and the language has always been designed to be compiled. For these reasons, this section assumes a compiler.
1313
1414
r[crate.compile-time]
15-
Rust's semantics obey a *phase distinction* between compile-time and
16-
run-time.[^phase-distinction] Semantic rules that have a *static
17-
interpretation* govern the success or failure of compilation, while
18-
semantic rules that have a *dynamic interpretation* govern the behavior of the
19-
program at run-time.
15+
Rust's semantics obey a *phase distinction* between compile-time and run-time.[^phase-distinction] Semantic rules that have a *static interpretation* govern the success or failure of compilation, while semantic rules that have a *dynamic interpretation* govern the behavior of the program at run-time.
2016

2117
r[crate.unit]
22-
The compilation model centers on artifacts called _crates_. Each compilation
23-
processes a single crate in source form, and if successful, produces a single
24-
crate in binary form: either an executable or some sort of
25-
library.[^cratesourcefile]
18+
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 some sort of library.[^cratesourcefile]
2619

2720
r[crate.module]
28-
A _crate_ is a unit of compilation and linking, as well as versioning,
29-
distribution, and runtime loading. A crate contains a _tree_ of nested
30-
[module] scopes. The top level of this tree is a module that is
31-
anonymous (from the point of view of paths within the module) and any item
32-
within a crate has a canonical [module path] denoting its location
33-
within the crate's module tree.
21+
A _crate_ is a unit of compilation and linking, as well as versioning, distribution, and runtime loading. A crate contains a _tree_ of nested [module] scopes. 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] denoting its location within the crate's module tree.
3422

3523
r[crate.input-source]
36-
The Rust compiler is always invoked with a single source file as input, and
37-
always produces a single output crate. The processing of that source file may
38-
result in other source files being loaded as modules. Source files have the
39-
extension `.rs`.
24+
The Rust compiler is always invoked with a single source file as input, and always produces a single output crate. The processing of that source file may result in other source files being loaded as modules. Source files have the extension `.rs`.
4025

4126
r[crate.module-def]
42-
A Rust source file describes a module, the name and location of which —
43-
in the module tree of the current crate — are defined from outside the
44-
source file: either by an explicit [Module][grammar-Module] item in a referencing
45-
source file, or by the name of the crate itself.
27+
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 [Module][grammar-Module] item in a referencing source file, or by the name of the crate itself.
4628

4729
r[crate.inline-module]
48-
Every source file is a
49-
module, but not every module needs its own source file: [module
50-
definitions][module] can be nested within one file.
30+
Every source file is a module, but not every module needs its own source file: [module definitions][module] can be nested within one file.
5131

5232
r[crate.items]
53-
Each source file contains a sequence of zero or more [Item] definitions, and
54-
may optionally begin with any number of [attributes]
55-
that apply to the containing module, most of which influence the behavior of
56-
the compiler.
33+
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, most of which influence the behavior of the compiler.
5734

5835
r[crate.attributes]
59-
The anonymous crate module can have additional attributes that
60-
apply to the crate as a whole.
36+
The anonymous crate module can have additional attributes that apply to the crate as a whole.
6137

6238
> [!NOTE]
6339
> The file's contents may be preceded by a [shebang].
@@ -81,9 +57,7 @@ r[crate.main.general]
8157
A crate that contains a `main` [function] can be compiled to an executable.
8258

8359
r[crate.main.restriction]
84-
If a `main` function is present, it must take no arguments, must not declare any
85-
[trait or lifetime bounds], must not have any [where clauses], and its return
86-
type must implement the [`Termination`] trait.
60+
If a `main` function is present, it must take no arguments, must not declare any [trait or lifetime bounds], must not have any [where clauses], and its return type must implement the [`Termination`] trait.
8761

8862
```rust
8963
fn main() {}
@@ -139,24 +113,18 @@ r[crate.crate_name]
139113
## The `crate_name` attribute
140114

141115
r[crate.crate_name.general]
142-
The *`crate_name` [attribute]* may be applied at the crate level to specify the
143-
name of the crate with the [MetaNameValueStr] syntax.
116+
The *`crate_name` [attribute]* may be applied at the crate level to specify the name of the crate with the [MetaNameValueStr] syntax.
144117

145118
```rust
146119
#![crate_name = "mycrate"]
147120
```
148121

149122
r[crate.crate_name.restriction]
150-
The crate name must not be empty, and must only contain [Unicode alphanumeric]
151-
or `_` (U+005F) characters.
123+
The crate name must not be empty, and must only contain [Unicode alphanumeric] or `_` (U+005F) characters.
152124

153-
[^phase-distinction]: This distinction would also exist in an interpreter.
154-
Static checks like syntactic analysis, type checking, and lints should
155-
happen before the program is executed regardless of when it is executed.
125+
[^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.
156126

157-
[^cratesourcefile]: A crate is somewhat analogous to an *assembly* in the
158-
ECMA-335 CLI model, a *library* in the SML/NJ Compilation Manager, a *unit*
159-
in the Owens and Flatt module system, or a *configuration* in Mesa.
127+
[^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* in the Owens and Flatt module system, or a *configuration* in Mesa.
160128

161129
[Unicode alphanumeric]: char::is_alphanumeric
162130
[`!`]: types/never.md

0 commit comments

Comments
 (0)