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: src/introduction.md
+63-76
Original file line number
Diff line number
Diff line change
@@ -1,102 +1,96 @@
1
1
# Introduction
2
2
3
-
This book is the primary reference for the Rust programming language. It
4
-
provides three kinds of material:
3
+
This book is the primary reference for the Rust programming language.
4
+
It provides three kinds of material:
5
5
6
6
- Chapters that informally describe each language construct and their use.
7
-
- Chapters that informally describe the memory model, concurrency model,
8
-
runtime services, linkage model, and debugging facilities.
9
-
- Appendix chapters providing rationale and references to languages that
10
-
influenced the design.
7
+
- Chapters that informally describe the memory model, concurrency model, runtime services, linkage model, and debugging facilities.
8
+
- Appendix chapters providing rationale and references to languages that influenced the design.
11
9
12
10
<divclass="warning">
13
11
14
-
Warning: This book is incomplete. Documenting everything takes a while. See
15
-
the [GitHub issues] for what is not documented in this book.
12
+
Warning:
13
+
This book is incomplete. Documenting everything takes a while.
14
+
See the [GitHub issues] for what is not documented in this book.
16
15
17
16
</div>
18
17
19
-
## What *The Reference* is Not
18
+
## Rust releases
20
19
21
-
This book does not serve as an introduction to the language. Background
22
-
familiarity with the language is assumed. A separate [book] is available to
23
-
help acquire such background familiarity.
20
+
Rust has a new language release every six weeks.
21
+
The first stable release of the language was Rust 1.0.0, followed by Rust 1.1.0 and so on.
22
+
Tools (`rustc`, `cargo`, etc.) and documentation ([Standard library], this book, etc.) are released with the language release.
24
23
25
-
This book also does not serve as a reference to the [standard library]
26
-
included in the language distribution. Those libraries are documented
27
-
separately by extracting documentation attributes from their source code. Many
28
-
of the features that one might expect to be language features are library
29
-
features in Rust, so what you're looking for may be there, not here.
24
+
The latest release of this book, matching the latest Rust version, can always be found at <https://doc.rust-lang.org/reference/>.
25
+
Prior versions can be found by adding the Rust version before the "reference" directory.
26
+
For example, the Reference for Rust 1.49.0 is located at <https://doc.rust-lang.org/1.49.0/reference/>.
30
27
31
-
Similarly, this book does not usually document the specifics of `rustc` as a
32
-
tool or of Cargo. `rustc` has its own [book][rustc book]. Cargo has a
33
-
[book][cargo book] that contains a [reference][cargo reference]. There are a few
34
-
pages such as [linkage] that still describe how `rustc` works.
28
+
## What *The Reference* is not
35
29
36
-
This book also only serves as a reference to what is available in stable
37
-
Rust. For unstable features being worked on, see the [Unstable Book].
30
+
This book does not serve as an introduction to the language.
31
+
Background familiarity with the language is assumed.
32
+
A separate [book] is available to help acquire such background familiarity.
38
33
39
-
Rust compilers, including `rustc`, will perform optimizations. The reference
40
-
does not specify what optimizations are allowed or disallowed. Instead, think of
41
-
the compiled program as a black box. You can only probe by running it, feeding
42
-
it input and observing its output. Everything that happens that way must conform
43
-
to what the reference says.
34
+
This book also does not serve as a reference to the [standard library] included in the language distribution.
35
+
Those libraries are documented separately by extracting documentation attributes from their source code.
36
+
Many of the features that one might expect to be language features are library features in Rust, so what you're looking for may be there, not here.
44
37
45
-
Finally, this book is not normative. It may include details that are
46
-
specific to `rustc`itself, and should not be taken as a specification for
47
-
the Rust language. We intend to produce such a book someday, and until then,
48
-
the reference is the closest thing we have to one.
38
+
Similarly, this book does not usually document the specifics of `rustc` as a tool or of Cargo.
39
+
`rustc`has its own [book][rustc book].
40
+
Cargo has a [book][cargo book] that contains a [reference][cargo reference].
41
+
There are a few pages such as [linkage] that still describe how `rustc` works.
49
42
50
-
## How to Use This Book
43
+
This book also only serves as a reference to what is available in stable Rust.
44
+
For unstable features being worked on, see the [Unstable Book].
51
45
52
-
This book does not assume you are reading this book sequentially. Each
53
-
chapter generally can be read standalone, but will cross-link to other chapters
54
-
for facets of the language they refer to, but do not discuss.
46
+
Rust compilers, including `rustc`, will perform optimizations.
47
+
The reference does not specify what optimizations are allowed or disallowed.
48
+
Instead, think of the compiled program as a black box.
49
+
You can only probe by running it, feeding it input and observing its output.
50
+
Everything that happens that way must conform to what the reference says.
51
+
52
+
Finally, this book is not normative.
53
+
It may include details that are specific to `rustc` itself, and should not be taken as a specification for the Rust language.
54
+
We intend to produce such a book someday, and until then, the reference is the closest thing we have to one.
55
+
56
+
## How to use this book
57
+
58
+
This book does not assume you are reading this book sequentially.
59
+
Each chapter generally can be read standalone, but will cross-link to other chapters for facets of the language they refer to, but do not discuss.
55
60
56
61
There are two main ways to read this document.
57
62
58
-
The first is to answer a specific question. If you know which chapter answers
59
-
that question, you can jump to that chapter in the table of contents. Otherwise,
60
-
you can press `s` or the click the magnifying glass on the top bar to search for
61
-
keywords related to your question. For example, say you wanted to know when a
62
-
temporary value created in a let statement is dropped. If you didn't already
63
-
know that the [lifetime of temporaries] is defined in the [expressions chapter],
64
-
you could search "temporary let" and the first search result will take you to
65
-
that section.
63
+
The first is to answer a specific question.
64
+
If you know which chapter answers that question, you can jump to that chapter in the table of contents.
65
+
Otherwise, you can press `s` or the click the magnifying glass on the top bar to search for keywords related to your question.
66
+
For example, say you wanted to know when a temporary value created in a let statement is dropped.
67
+
If you didn't already know that the [lifetime of temporaries] is defined in the [expressions chapter], you could search "temporary let" and the first search result will take you to that section.
66
68
67
69
The second is to generally improve your knowledge of a facet of the language.
68
-
In that case, just browse the table of contents until you see something you
69
-
want to know more about, and just start reading. If a link looks interesting,
70
-
click it, and read about that section.
70
+
In that case, just browse the table of contents until you see something you want to know more about, and just start reading.
71
+
If a link looks interesting, click it, and read about that section.
71
72
72
-
That said, there is no wrong way to read this book. Read it however you feel
73
-
helps you best.
73
+
That said, there is no wrong way to read this book. Read it however you feel helps you best.
74
74
75
75
### Conventions
76
76
77
-
Like all technical books, this book has certain conventions in how it displays
78
-
information. These conventions are documented here.
77
+
Like all technical books, this book has certain conventions in how it displays information.
78
+
These conventions are documented here.
79
79
80
-
* Statements that define a term contain that term in *italics*. Whenever that
81
-
term is used outside of that chapter, it is usually a link to the section that
82
-
has this definition.
80
+
* Statements that define a term contain that term in *italics*.
81
+
Whenever that term is used outside of that chapter, it is usually a link to the section that has this definition.
83
82
84
83
An *example term* is an example of a term being defined.
85
84
86
-
* Differences in the language by which edition the crate is compiled under are
87
-
in a blockquote that start with the words "Edition Differences:" in **bold**.
85
+
* Differences in the language by which edition the crate is compiled under are in a blockquote that start with the words "Edition Differences:" in **bold**.
88
86
89
-
> **Edition Differences**: In the 2015 edition, this syntax is valid that is
90
-
> disallowed as of the 2018 edition.
87
+
> **Edition Differences**: In the 2015 edition, this syntax is valid that is disallowed as of the 2018 edition.
91
88
92
-
* Notes that contain useful information about the state of the book or point out
93
-
useful, but mostly out of scope, information are in blockquotes that start
94
-
with the word "Note:" in **bold**.
89
+
* Notes that contain useful information about the state of the book or point out useful, but mostly out of scope, information are in blockquotes that start with the word "Note:" in **bold**.
95
90
96
91
> **Note**: This is an example note.
97
92
98
-
* Warnings that show unsound behavior in the language or possibly confusing
99
-
interactions of language features are in a special warning box.
93
+
* Warnings that show unsound behavior in the language or possibly confusing interactions of language features are in a special warning box.
100
94
101
95
<divclass="warning">
102
96
@@ -106,8 +100,7 @@ information. These conventions are documented here.
106
100
107
101
* Code snippets inline in the text are inside `<code>` tags.
108
102
109
-
Longer code examples are in a syntax highlighted box that has controls for
110
-
copying, executing, and showing hidden lines in the top right corner.
103
+
Longer code examples are in a syntax highlighted box that has controls for copying, executing, and showing hidden lines in the top right corner.
111
104
112
105
```rust
113
106
# // This is a hidden line.
@@ -116,8 +109,7 @@ information. These conventions are documented here.
116
109
}
117
110
```
118
111
119
-
* The grammar and lexical structure is in blockquotes with either "Lexer" or
120
-
"Syntax" in <sup>**bold superscript**</sup> as the first line.
112
+
* The grammar and lexical structure is in blockquotes with either "Lexer" or "Syntax" in <sup>**bold superscript**</sup> as the first line.
121
113
122
114
> **<sup>Syntax</sup>**\
123
115
> _ExampleGrammar_:\
@@ -130,15 +122,10 @@ information. These conventions are documented here.
130
122
131
123
We welcome contributions of all kinds.
132
124
133
-
You can contribute to this book by opening an issue or sending a pull
134
-
request to [the Rust Reference repository]. If this book does not answer
135
-
your question, and you think its answer is in scope of it, please do not
136
-
hesitate to [file an issue] or ask about it in the `t-lang/doc` stream on
137
-
[Zulip]. Knowing what people use this book for the most helps direct our
138
-
attention to making those sections the best that they can be. We also want
139
-
the reference to be as normative as possible, so if you see anything that is
140
-
wrong or is non-normative but not specifically called out, please also [file
141
-
an issue].
125
+
You can contribute to this book by opening an issue or sending a pull request to [the Rust Reference repository].
126
+
If this book does not answer your question, and you think its answer is in scope of it, please do not hesitate to [file an issue] or ask about it in the `t-lang/doc` stream on [Zulip].
127
+
Knowing what people use this book for the most helps direct our attention to making those sections the best that they can be.
128
+
We also want the reference to be as normative as possible, so if you see anything that is wrong or is non-normative but not specifically called out, please also [file an issue].
0 commit comments