Skip to content

Commit e7b8fe9

Browse files
author
Alexis Hunt
committed
Move all links to bottom.
1 parent de0b878 commit e7b8fe9

18 files changed

+149
-123
lines changed

src/crates-and-source-files.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
1010
> **<sup>Lexer</sup>**\
1111
> UTF8BOM : `\uFEFF`\
12-
> SHEBANG : `#!` ~[`[` `\n`] ~`\n`<sup>*</sup>
12+
> SHEBANG : `#!` ~[`[` `\n`] ~`\n`<sup>\*</sup>
1313
1414

1515
> Note: Although Rust, like any other language, can be implemented by an
@@ -78,11 +78,11 @@ type must be one of the following:
7878
> Note: The implementation of which return types are allowed is determined by
7979
> the unstable [`Termination`] trait.
8080
81-
The optional [_UTF8 byte order mark_] (UTF8BOM production) indicates that the
81+
The optional [_UTF8 byte order mark_] \(UTF8BOM production) indicates that the
8282
file is encoded in UTF8. It can only occur at the beginning of the file and
8383
is ignored by the compiler.
8484

85-
A source file can have a [_shebang_] (SHEBANG production), which indicates
85+
A source file can have a [_shebang_] \(SHEBANG production), which indicates
8686
to the operating system what program to use to execute this file. It serves
8787
essentially to treat the source file as an executable script. The shebang
8888
can only occur at the beginning of the file (but after the optional

src/expressions.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ A *value expression* is an expression that represents an actual value.
8787
The left operand of an [assignment][assign] or [compound assignment] expression
8888
is a place expression context, as is the single operand of a unary [borrow], and
8989
the operand of any [implicit borrow]. The discriminant or subject of a
90-
[match expression][match] and right side of a [let statement] is also a place
90+
[match expression][match] and right side of a [let statement][let] is also a place
9191
expression context. All other expression contexts are value expression contexts.
9292

9393
> Note: Historically, place expressions were called *lvalues* and value
@@ -102,7 +102,7 @@ the remaining situations if that type is [`Sized`], then it may be possible to
102102
move the value. Only the following place expressions may be moved out of:
103103

104104
* [Variables] which are not currently borrowed.
105-
* [Temporary values](#temporary-lifetimes).
105+
* [Temporary values].
106106
* [Fields][field] of a place expression which can be moved out of and
107107
doesn't implement [`Drop`].
108108
* The result of [dereferencing] an expression with type [`Box<T>`] and that can
@@ -145,9 +145,9 @@ of a value expression to a `'static` slot occurs when the expression could be
145145
written in a constant, borrowed, and dereferencing that borrow where the
146146
expression was the originally written, without changing the runtime behavior.
147147
That is, the promoted expression can be evaluated at compile-time and the
148-
resulting value does not contain [interior mutability] or [destructors] (these
149-
properties are determined based on the value where possible, e.g. `&None`
150-
always has the type `&'static Option<_>`, as it contains nothing disallowed).
148+
resulting value does not contain [interior mutability] or [destructors] \(these
149+
properties are determined based on the value where possible, e.g. `&None` always
150+
has the type `&'static Option<_>`, as it contains nothing disallowed).
151151
Otherwise, the lifetime of temporary values is typically
152152

153153
- the innermost enclosing statement; the tail expression of a block is
@@ -233,9 +233,9 @@ Implicit borrows may be taken in the following expressions:
233233

234234
Certain types of expressions can be evaluated at compile time. These are called
235235
_constant expressions_. Certain places, such as in
236-
[constants](items/constant-items.html) and [statics](items/static-items.html),
236+
[constants] and [statics](static variables),
237237
require a constant expression, and are always evaluated at compile time. In
238-
other places, such as in [`let` statements](statements.html#let-statements),
238+
other places, such as in [`let` statements][let],
239239
constant expressions may be evaluated at compile time. If errors, such as out
240240
of bounds [array indexing] or [overflow] occurs,
241241
then it is a compiler error if the value must be evaluated at compile time,
@@ -246,7 +246,7 @@ also constant expressions and do not cause any [`Drop::drop`][destructors] calls
246246
to be ran.
247247

248248
* [Literals].
249-
* [Paths] to [functions](items/functions.html) and constants.
249+
* [Paths] to [functions] and constants.
250250
Recursively defining constants is not allowed.
251251
* [Tuple expressions].
252252
* [Array expressions].
@@ -302,6 +302,8 @@ exist in `core::ops` and `core::cmp` with the same names.
302302
[negation]: expressions/operator-expr.html#negation-operators
303303
[overflow]: expressions/operator-expr.html#overflow
304304

305+
[functions]: items/functions.html
306+
[constants]: items/constant-items.html
305307
[destructors]: destructors.html
306308
[interior mutability]: interior-mutability.html
307309
[`Box<T>`]: ../std/boxed/struct.Box.html
@@ -311,7 +313,6 @@ exist in `core::ops` and `core::cmp` with the same names.
311313
[implicit borrow]: #implicit-borrows
312314
[implicitly mutably borrowed]: #implicit-borrows
313315
[let]: statements.html#let-statements
314-
[let statement]: statements.html#let-statements
315316
[Mutable `static` items]: items/static-items.html#mutable-statics
316317
[slice]: types.html#array-and-slice-types
317318
[static variables]: items/static-items.html

src/influences.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ that have since been removed):
1818
* C#: attributes
1919
* Ruby: <strike>block syntax</strike>
2020
* NIL, Hermes: <strike>typestate</strike>
21-
* [Unicode Annex #31](http://www.unicode.org/reports/tr31/): identifier and
22-
pattern syntax
21+
* [Unicode Annex #31]: identifier and pattern syntax
22+
23+
[Unicode Annex #31]: http://www.unicode.org/reports/tr31/

src/interior-mutability.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,3 @@ across threads.
2626
[`std::cell::UnsafeCell<T>`]: ../std/cell/struct.UnsafeCell.html
2727
[`std::cell::RefCell<T>`]: ../std/cell/struct.RefCell.html
2828
[`std::sync::atomic`]: ../std/sync/atomic/index.html
29-
30-

src/items.md

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,24 @@ nested set of [modules]. Every crate has a single "outermost" anonymous module;
55
all further items within the crate have [paths] within the module tree of the
66
crate.
77

8-
[modules]: items/modules.html
9-
[paths]: paths.html
10-
118
Items are entirely determined at compile-time, generally remain fixed during
129
execution, and may reside in read-only memory.
1310

1411
There are several kinds of items:
1512

16-
* [modules](items/modules.html)
17-
* [`extern crate` declarations](items/extern-crates.html)
18-
* [`use` declarations](items/use-declarations.html)
19-
* [function definitions](items/functions.html)
20-
* [type definitions](items/type-aliases.html)
21-
* [struct definitions](items/structs.html)
22-
* [enumeration definitions](items/enumerations.html)
23-
* [union definitions](items/unions.html)
24-
* [constant items](items/constant-items.html)
25-
* [static items](items/static-items.html)
26-
* [trait definitions](items/traits.html)
27-
* [implementations](items/implementations.html)
28-
* [`extern` blocks](items/external-blocks.html)
13+
* [modules]
14+
* [`extern crate` declarations]
15+
* [`use` declarations]
16+
* [function definitions]
17+
* [type definitions]
18+
* [struct definitions]
19+
* [enumeration definitions]
20+
* [union definitions]
21+
* [constant items]
22+
* [static items]
23+
* [trait definitions]
24+
* [implementations]
25+
* [`extern` blocks]
2926

3027
Some items form an implicit scope for the declaration of sub-items. In other
3128
words, within a function or module, declarations of items can (in many cases)
@@ -36,3 +33,19 @@ as if the item was declared outside the scope &mdash; it is still a static item
3633
qualified by the name of the enclosing item, or is private to the enclosing
3734
item (in the case of functions). The grammar specifies the exact locations in
3835
which sub-item declarations may appear.
36+
37+
[modules]: items/modules.html
38+
[paths]: paths.html
39+
[modules]: items/modules.html
40+
[`extern crate` declarations]: items/extern-crates.html
41+
[`use` declarations]: items/use-declarations.html
42+
[function definitions]: items/functions.html
43+
[type definitions]: items/type-aliases.html
44+
[struct definitions]: items/structs.html
45+
[enumeration definitions]: items/enumerations.html
46+
[union definitions]: items/unions.html
47+
[constant items]: items/constant-items.html
48+
[static items]: items/static-items.html
49+
[trait definitions]: items/traits.html
50+
[implementations]: items/implementations.html
51+
[`extern` blocks]: items/external-blocks.html

src/keywords.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
Rust divides keywords into three categories:
44

5-
* [strict](#strict-keywords)
6-
* [reserved](#reserved-keywords)
7-
* [weak](#weak-keywords)
5+
* [strict]
6+
* [reserved]
7+
* [weak]
88

99
## Strict keywords
1010

@@ -111,3 +111,6 @@ is possible to declare a variable or method with the name `union`.
111111
[union]: items/unions.html
112112
[variants]: items/enumerations.html
113113
[trait object]: types.html#trait-objects
114+
[strict]: #strict-keywords
115+
[reserved]: #reserved-keywords
116+
[weak]: #weak-keywords

src/lifetime-elision.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ It is an error to elide lifetime parameters that cannot be inferred. The
1212
placeholder lifetime, `'_`, can also be used to have a lifetime inferred in the
1313
same way. For lifetimes in paths, using `'_` is preferred. Trait object
1414
lifetimes follow different rules discussed
15-
[below](#default-trait-object-lifetimes).
15+
[below][trait object lifetimes].
1616

1717
* Each elided lifetime in the parameters becomes a distinct lifetime parameter.
1818
* If there is exactly one lifetime used in the parameters (elided or not), that
@@ -179,3 +179,4 @@ const RESOLVED_STATIC: &dyn Fn(&Foo, &Bar) -> &Baz = ..
179179
[static]: items/static-items.html
180180
[trait object]: types.html#trait-objects
181181
[type aliases]: items/type-aliases.html
182+
[trait object lifetimes]: #default-trait-object-lifetimes

src/linkage.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ statically and dynamically. This section will explore the various methods to
55
link Rust crates together, and more information about native libraries can be
66
found in the [FFI section of the book][ffi].
77

8-
[ffi]: ../book/ffi.html
9-
108
In one session of compilation, the compiler can generate multiple artifacts
119
through the usage of either command line flags or the `crate_type` attribute.
1210
If one or more command line flags are specified, all `crate_type` attributes will
@@ -196,12 +194,13 @@ fn main() {
196194
}
197195
```
198196

199-
[cargo]: http://doc.crates.io/environment-variables.html#environment-variables-cargo-sets-for-build-scripts
200-
201197
To use this feature locally, you typically will use the `RUSTFLAGS` environment
202198
variable to specify flags to the compiler through Cargo. For example to compile
203199
a statically linked binary on MSVC you would execute:
204200

205201
```ignore,notrust
206202
RUSTFLAGS='-C target-feature=+crt-static' cargo build --target x86_64-pc-windows-msvc
207203
```
204+
205+
[ffi]: ../book/ffi.html
206+
[cargo]: http://doc.crates.io/environment-variables.html#environment-variables-cargo-sets-for-build-scripts

src/macros-by-example.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,6 @@ syntax named by _designator_. Valid designators are:
3232
* `meta`: the contents of an [attribute]
3333
* `lifetime`: a lifetime. Examples: `'static`, `'a`.
3434

35-
[item]: items.html
36-
[block]: expressions/block-expr.html
37-
[statement]: statements.html
38-
[pattern]: expressions/match-expr.html
39-
[expression]: expressions.html
40-
[type]: types.html
41-
[identifier]: identifiers.html
42-
[keyword]: keywords.html
43-
[path]: paths.html
44-
[token]: tokens.html
45-
[attribute]: attributes.html
46-
4735
In the transcriber, the
4836
designator is already known, and so only the name of a matched nonterminal comes
4937
after the dollar sign.
@@ -88,3 +76,14 @@ Rust syntax is restricted in two ways:
8876
requiring a distinctive token in front can solve the problem.
8977

9078
[RFC 550]: https://github.com/rust-lang/rfcs/blob/master/text/0550-macro-future-proofing.md
79+
[item]: items.html
80+
[block]: expressions/block-expr.html
81+
[statement]: statements.html
82+
[pattern]: expressions/match-expr.html
83+
[expression]: expressions.html
84+
[type]: types.html
85+
[identifier]: identifiers.html
86+
[keyword]: keywords.html
87+
[path]: paths.html
88+
[token]: tokens.html
89+
[attribute]: attributes.html

src/paths.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ mod without { // ::without
164164

165165
# fn main() {}
166166
```
167+
167168
[item]: items.html
168169
[variable]: variables.html
169170
[identifiers]: identifiers.html

src/special-types-and-traits.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ mutability aren't placed in memory marked as read only.
2727

2828
[`std::marker::PhantomData<T>`] is a zero-sized, minimum alignment, type that
2929
is considered to own a `T` for the purposes of [variance], [drop check] and
30-
[auto traits](#auto-traits).
30+
[auto traits].
3131

3232
## Operator Traits
3333

@@ -165,3 +165,4 @@ compiler, not by [implementation items].
165165
[Type parameters]: types.html#type-parameters
166166
[variance]: subtyping.html#variance
167167
[`!`]: types.html#never-type
168+
[auto traits]: #auto-traits

src/statements.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
A *statement* is a component of a [block], which is in turn a component of an
44
outer [expression] or [function].
55

6-
Rust has two kinds of statement: [declaration
7-
statements](#declaration-statements) and [expression
8-
statements](#expression-statements).
6+
Rust has two kinds of statement: [declaration statements] and [expression
7+
statements].
98

109
## Declaration statements
1110

@@ -106,3 +105,5 @@ statement are [`cfg`], and [the lint check attributes].
106105
[outer attributes]: attributes.html
107106
[`cfg`]: attributes.html#conditional-compilation
108107
[the lint check attributes]: attributes.html#lint-check-attributes
108+
[declaration statements]: #declaration-statements
109+
[expression statements]: #expression-statements

src/tokens.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,6 @@ to call a method named `f64` on `2`.
474474
The representation semantics of floating-point numbers are described in
475475
["Machine Types"].
476476

477-
["Machine Types"]: types.html#machine-types
478-
479477
### Boolean literals
480478

481479
> **<sup>Lexer</sup>**\
@@ -499,8 +497,6 @@ Lifetime parameters and [loop labels] use LIFETIME_OR_LABEL tokens. Any
499497
LIFETIME_TOKEN will be accepted by the lexer, and for example, can be used in
500498
macros.
501499

502-
[loop labels]: expressions/loop-expr.html
503-
504500
## Symbols
505501

506502
Symbols are a general class of printable [tokens] that play structural
@@ -519,3 +515,5 @@ They are catalogued in [the Symbols section][symbols] of the Grammar document.
519515
[tuples]: types.html#tuple-types
520516
[tuple structs]: items/structs.html
521517
[tuple variants]: items/enumerations.html
518+
[loop labels]: expressions/loop-expr.html
519+
["Machine Types"]: types.html#machine-types

src/trait-bounds.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ fn call_on_ref_zero<F>(f: F) where F: for<'a> Fn(&'a i32) {
137137
[LIFETIME_OR_LABEL]: tokens.html#lifetimes-and-loop-labels
138138
[_TraitPath_]: paths.html
139139
[`Sized`]: special-types-and-traits.html#sized
140-
141140
[associated types]: items/associated-items.html#associated-types
142141
[supertraits]: items/traits.html#supertraits
143142
[generic]: items/generics.html

src/type-coercions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
Coercions are defined in [RFC 401]. [RFC 1558] then expanded on that.
44
A coercion is implicit and has no syntax.
55

6-
[RFC 401]: https://github.com/rust-lang/rfcs/blob/master/text/0401-coercions.md
7-
[RFC 1558]: https://github.com/rust-lang/rfcs/blob/master/text/1558-closure-to-fn-coercion.md
8-
96
## Coercion sites
107

118
A coercion can only occur at certain coercion sites in a program; these are
@@ -39,7 +36,7 @@ sites are:
3936
```
4037

4138
For method calls, the receiver (`self` parameter) can only take advantage
42-
of [unsized coercions](#unsized-coercions).
39+
of [unsized coercions].
4340

4441
* Instantiations of struct or variant fields
4542

@@ -184,3 +181,6 @@ unsized coercion to `Foo<U>`.
184181
185182
[Unsize]: ../std/marker/trait.Unsize.html
186183
[CoerceUnsized]: ../std/ops/trait.CoerceUnsized.html
184+
[RFC 401]: https://github.com/rust-lang/rfcs/blob/master/text/0401-coercions.md
185+
[RFC 1558]: https://github.com/rust-lang/rfcs/blob/master/text/1558-closure-to-fn-coercion.md
186+
[unsized coercions]: #unsized-coercions

0 commit comments

Comments
 (0)