Skip to content

Commit de0b878

Browse files
author
Alexis Hunt
committed
Update links in nested directories.
1 parent 12f8291 commit de0b878

32 files changed

+307
-302
lines changed

src/expressions/array-expr.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,16 @@
88
> &nbsp;&nbsp; | `[` [_Expression_] ( `,` [_Expression_] )<sup>\*</sup> `,`<sup>?</sup> `]`\
99
> &nbsp;&nbsp; | `[` [_Expression_] `;` [_Expression_] `]`
1010
11-
An _[array](types.html#array-and-slice-types) expression_ can be written by
12-
enclosing zero or more comma-separated expressions of uniform type in square
13-
brackets. This produces and array containing each of these values in the
14-
order they are written.
11+
An _[array] expression_ can be written by enclosing zero or more comma-separated
12+
expressions of uniform type in square brackets. This produces and array
13+
containing each of these values in the order they are written.
1514

1615
Alternatively there can be exactly two expressions inside the brackets,
1716
separated by a semi-colon. The expression after the `;` must be a have type
18-
`usize` and be a [constant expression](expressions.html#constant-expressions),
19-
such as a [literal](tokens.html#literals) or a [constant
20-
item](items/constant-items.html). `[a; b]` creates an array containing `b`
21-
copies of the value of `a`. If the expression after the semi-colon has a value
22-
greater than 1 then this requires that the type of `a` is
23-
[`Copy`](special-types-and-traits.html#copy).
17+
`usize` and be a [constant expression], such as a [literal] or a [constant
18+
item]. `[a; b]` creates an array containing `b` copies of the value of `a`. If
19+
the expression after the semi-colon has a value greater than 1 then this
20+
requires that the type of `a` is [`Copy`].
2421

2522
```rust
2623
[1, 2, 3, 4];
@@ -34,9 +31,8 @@ greater than 1 then this requires that the type of `a` is
3431

3532
> **<sup>Syntax</sup>**\
3633
> _IndexExpression_ :\
37-
> &nbsp;&nbsp; [_Expression_] `[` [_Expression_] `]`
3834
39-
[Array and slice](types.html#array-and-slice-types)-typed expressions can be
35+
[Array and slice]-typed expressions can be
4036
indexed by writing a square-bracket-enclosed expression of type `usize` (the
4137
index) after them. When the array is mutable, the resulting [memory location]
4238
can be assigned to.
@@ -71,10 +67,15 @@ arr[10]; // warning: index out of bounds
7167
```
7268

7369
The array index expression can be implemented for types other than arrays and slices
74-
by implementing the [Index] and [IndexMut] traits.
75-
76-
[_Expression_]: expressions.html
77-
[memory location]: expressions.html#place-expressions-and-value-expressions
78-
[Index]: ../std/ops/trait.Index.html
79-
[IndexMut]: ../std/ops/trait.IndexMut.html
80-
[constant expression]: expressions.html#constant-expressions
70+
by implementing the [`Index`] and [`IndexMut`] traits.
71+
72+
[_Expression_]: /expressions.html
73+
[memory location]: /expressions.html#place-expressions-and-value-expressions
74+
[`Index`]: ../../std/ops/trait.Index.html
75+
[`IndexMut`]: ../../std/ops/trait.IndexMut.html
76+
[constant expression]: ../expressions.html#constant-expressions
77+
[literal]: ../tokens.html#literals
78+
[Array and slice]: ../types.html#array-and-slice-types
79+
[constant item]: ../items/constant-items.htm
80+
[`Copy`]: ../special-types-and-traits.html#copy
81+
[array]: ../types.html#array-and-slice-types

src/expressions/block-expr.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,14 @@ fn is_unix_platform() -> bool {
7575
}
7676
```
7777

78-
[_InnerAttribute_]: attributes.html
79-
[_Statement_]: statements.html
80-
[_Expression_]: expressions.html
81-
[expression]: expressions.html
82-
[statements]: statements.html
83-
[value expressions]: expressions.html#place-expressions-and-value-expressions
84-
[outer attributes]: attributes.html
85-
[inner attributes]: attributes.html
86-
[expression statement]: statements.html#expression-statements
87-
[`cfg`]: attributes.html#conditional-compilation
88-
[the lint check attributes]: attributes.html#lint-check-attributes
78+
[_InnerAttribute_]: ../attributes.html
79+
[_Statement_]: ../statements.html
80+
[_Expression_]: ../expressions.html
81+
[expression]: ../expressions.html
82+
[statements]: ../statements.html
83+
[value expressions]: ../expressions.html#place-expressions-and-value-expressions
84+
[outer attributes]: ../attributes.html
85+
[inner attributes]: ../attributes.html
86+
[expression statement]: ../statements.html#expression-statements
87+
[`cfg`]: ../attributes.html#conditional-compilation
88+
[the lint check attributes]: ../attributes.html#lint-check-attributes

src/expressions/call-expr.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
A _call expression_ consists of an expression followed by a parenthesized
1111
expression-list. It invokes a function, providing zero or more input variables.
1212
If the function eventually returns, then the expression completes. For
13-
[non-function types](types.html#function-item-types), the expression f(...) uses
13+
[non-function types], the expression `f(...)` uses
1414
the method on one of the [`std::ops::Fn`], [`std::ops::FnMut`] or
1515
[`std::ops::FnOnce`] traits, which differ in whether they take the type by
1616
reference, mutable reference, or take ownership respectively. An automatic
@@ -93,9 +93,9 @@ fn main() {
9393

9494
Refer to [RFC 132] for further details and motivations.
9595

96-
[`std::ops::Fn`]: ../std/ops/trait.Fn.html
97-
[`std::ops::FnMut`]: ../std/ops/trait.FnMut.html
98-
[`std::ops::FnOnce`]: ../std/ops/trait.FnOnce.html
96+
[`std::ops::Fn`]: ../../std/ops/trait.Fn.html
97+
[`std::ops::FnMut`]: ../../std/ops/trait.FnMut.html
98+
[`std::ops::FnOnce`]: ../../std/ops/trait.FnOnce.html
9999
[RFC 132]: https://github.com/rust-lang/rfcs/blob/master/text/0132-ufcs.md
100-
101-
[_Expression_]: expressions.html
100+
[non-function types]: ../types.html#function-item-types
101+
[_Expression_]: ../expressions.html

src/expressions/closure-expr.md

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,20 @@ functions, as an abbreviation for defining and capturing a separate function.
2525

2626
Significantly, closure expressions _capture their environment_, which regular
2727
[function definitions] do not. Without the `move` keyword, the closure expression
28-
[infers how it captures each variable from its environment](types.html#capture-modes),
29-
preferring to capture by shared reference, effectively borrowing
30-
all outer variables mentioned inside the closure's body. If needed the compiler
31-
will infer that instead mutable references should be taken, or that the values
32-
should be moved or copied (depending on their type) from the environment. A
33-
closure can be forced to capture its environment by copying or moving values by
34-
prefixing it with the `move` keyword. This is often used to ensure that the
35-
closure's type is `'static`.
28+
[infers] how it captures each variable from its environment, preferring to
29+
capture by shared reference, effectively borrowing all outer variables mentioned
30+
inside the closure's body. If needed the compiler will infer that instead
31+
mutable references should be taken, or that the values should be moved or copied
32+
(depending on their type) from the environment. A closure can be forced to
33+
capture its environment by copying or moving values by prefixing it with the
34+
`move` keyword. This is often used to ensure that the closure's type is
35+
`'static`.
3636

37-
The compiler will determine which of the [closure
38-
traits](types.html#call-traits-and-coercions) the closure's type will implement by how it
39-
acts on its captured variables. The closure will also implement
40-
[`Send`](special-types-and-traits.html#send) and/or
41-
[`Sync`](special-types-and-traits.html#sync) if all of its captured types do.
42-
These traits allow functions to accept closures using generics, even though the
43-
exact types can't be named.
37+
The compiler will determine which of the [closure traits] the closure's type
38+
will implement by how it acts on its captured variables. The closure will also
39+
implement [`Send`] and/or [`Sync`] if all of its captured types do. These traits
40+
allow functions to accept closures using generics, even though the exact types
41+
can't be named.
4442

4543
In this example, we define a function `ten_times` that takes a higher-order
4644
function argument, and we then call it with a closure expression as an argument,
@@ -61,10 +59,13 @@ let word = "konnichiwa".to_owned();
6159
ten_times(move |j| println!("{}, {}", word, j));
6260
```
6361

64-
[block]: expressions/block-expr.html
65-
[function definitions]: items/functions.html
66-
67-
[_Expression_]: expressions.html
68-
[_BlockExpression_]: expressions/block-expr.html
69-
[_TypeNoBounds_]: types.html
70-
[_FunctionParameters_]: items/functions.html
62+
[block]: block-expr.html
63+
[function definitions]: ../items/functions.html
64+
[_Expression_]: ../expressions.html
65+
[_BlockExpression_]: block-expr.html
66+
[_TypeNoBounds_]: ../types.html
67+
[_FunctionParameters_]: ../items/functions.html
68+
[infers]: ../types.html#capture-modes
69+
[closure traits]: ../types.html#call-traits-and-coercions
70+
[`Send`]: ../special-types-and-traits.html#send
71+
[`Sync`]: ../special-types-and-traits.html#sync

src/expressions/field-expr.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ automatically dereferenced as many times as necessary to make the field access
2626
possible. In cases of ambiguity, we prefer fewer autoderefs to more.
2727

2828
Finally, the fields of a struct or a reference to a struct are treated as
29-
separate entities when borrowing. If the struct does not implement
30-
[`Drop`](special-types-and-traits.html#drop) and is stored in a local variable,
31-
this also applies to moving out of each of its fields. This also does not apply
32-
if automatic dereferencing is done though user defined types.
29+
separate entities when borrowing. If the struct does not implement [`Drop`] and
30+
is stored in a local variable, this also applies to moving out of each of its
31+
fields. This also does not apply if automatic dereferencing is done though user
32+
defined types.
3333

3434
```rust
3535
struct A { f1: String, f2: String, f3: String }
@@ -45,10 +45,11 @@ let c: &String = &x.f2; // Can borrow again
4545
let d: String = x.f3; // Move out of x.f3
4646
```
4747

48-
[_Expression_]: expressions.html
49-
[IDENTIFIER]: identifiers.html
50-
[method call expression]: expressions/method-call-expr.html
51-
[struct]: items/structs.html
52-
[union]: items/unions.html
53-
[place expression]: expressions.html#place-expressions-and-value-expressions
54-
[mutable]: expressions.html#mutability
48+
[_Expression_]: ../expressions.html
49+
[IDENTIFIER]: ../identifiers.html
50+
[method call expression]: method-call-expr.html
51+
[struct]: ../items/structs.html
52+
[union]: ../items/unions.html
53+
[place expression]: ../expressions.html#place-expressions-and-value-expressions
54+
[mutable]: ../expressions.html#mutability
55+
[`Drop`]: ../special-types-and-traits.html#drop

src/expressions/grouped-expr.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ assert_eq!( a.f (), "The method f");
3535
assert_eq!((a.f)(), "The field f");
3636
```
3737

38-
[_Expression_]: expressions.html
38+
[_Expression_]: ../expressions.html

src/expressions/if-expr.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,5 @@ let a = if let Some(1) = x {
9292
assert_eq!(a, 3);
9393
```
9494

95-
[_Expression_]: expressions.html
96-
[_BlockExpression_]: expressions/block-expr.html
95+
[_Expression_]: ../expressions.html
96+
[_BlockExpression_]: block-expr.html

src/expressions/literal-expr.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@
1212
> &nbsp;&nbsp; | [FLOAT_LITERAL]\
1313
> &nbsp;&nbsp; | [BOOLEAN_LITERAL]
1414
15-
A _literal expression_ consists of one of the [literal](tokens.html#literals)
16-
forms described earlier. It directly describes a number, character, string,
17-
or boolean value.
15+
A _literal expression_ consists of one of the [literal] forms described earlier.
16+
It directly describes a number, character, string, or boolean value.
1817

1918
```rust
2019
"hello"; // string type
2120
'5'; // character type
2221
5; // integer type
2322
```
2423

25-
[CHAR_LITERAL]: tokens.html#character-literals
26-
[STRING_LITERAL]: tokens.html#string-literals
27-
[RAW_STRING_LITERAL]: tokens.html#raw-string-literals
28-
[BYTE_LITERAL]: tokens.html#byte-literals
29-
[BYTE_STRING_LITERAL]: tokens.html#byte-string-literals
30-
[RAW_BYTE_STRING_LITERAL]: tokens.html#raw-byte-string-literals
31-
[INTEGER_LITERAL]: tokens.html#integer-literals
32-
[FLOAT_LITERAL]: tokens.html#floating-point-literals
33-
[BOOLEAN_LITERAL]: tokens.html#boolean-literals
24+
[CHAR_LITERAL]: ../tokens.html#character-literals
25+
[STRING_LITERAL]: ../tokens.html#string-literals
26+
[RAW_STRING_LITERAL]: ../tokens.html#raw-string-literals
27+
[BYTE_LITERAL]: ../tokens.html#byte-literals
28+
[BYTE_STRING_LITERAL]: ../tokens.html#byte-string-literals
29+
[RAW_BYTE_STRING_LITERAL]: ../tokens.html#raw-byte-string-literals
30+
[INTEGER_LITERAL]: ../tokens.html#integer-literals
31+
[FLOAT_LITERAL]: ../tokens.html#floating-point-literals
32+
[BOOLEAN_LITERAL]: ../tokens.html#boolean-literals
33+
[literal]: ../tokens.html#literals

src/expressions/loop-expr.md

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,17 @@
99
> &nbsp;&nbsp; &nbsp;&nbsp; | [_IteratorLoopExpression_]\
1010
> &nbsp;&nbsp; )
1111
12-
[_LoopLabel_]: #loop-labels
13-
[_InfiniteLoopExpression_]: #infinite-loops
14-
[_PredicateLoopExpression_]: #predicate-loops
15-
[_PredicatePatternLoopExpression_]: #predicate-pattern-loops
16-
[_IteratorLoopExpression_]: #iterator-loops
17-
1812
Rust supports four loop expressions:
1913

20-
* A [`loop` expression](#infinite-loops) denotes an infinite loop.
21-
* A [`while` expression](#predicate-loops) loops until a predicate is false.
22-
* A [`while let` expression](#predicate-pattern-loops) tests a refutable pattern.
23-
* A [`for` expression](#iterator-loops) extracts values from an iterator,
14+
* A [`loop` expression] denotes an infinite loop.
15+
* A [`while` expression] loops until a predicate is false.
16+
* A [`while let` expression] tests a refutable pattern.
17+
* A [`for` expression] extracts values from an iterator,
2418
looping until the iterator is empty.
2519

26-
All four types of loop support [`break` expressions](#break-expressions),
27-
[`continue` expressions](#continue-expressions), and [labels](#loop-labels).
28-
Only `loop` supports [evaluation to non-trivial values](#break-and-loop-values).
20+
All four types of loop support [`break` expressions],
21+
[`continue` expressions], and [labels].
22+
Only `loop` supports [evaluation to non-trivial values][loop values].
2923

3024
## Infinite loops
3125

@@ -37,8 +31,8 @@ A `loop` expression repeats execution of its body continuously:
3731
`loop { println!("I live."); }`.
3832

3933
A `loop` expression without an associated `break` expression is diverging and
40-
has type [`!`](types.html#never-type). A `loop` expression containing
41-
associated [`break` expression(s)](#break-expressions) may terminate, and must
34+
has type [`!`]. A `loop` expression containing
35+
associated [`break` expression(s)][`break` expressions] may terminate, and must
4236
have type compatible with the value of the `break` expression(s).
4337

4438
## Predicate loops
@@ -129,8 +123,7 @@ a lifetime preceding the loop expression, as in `'foo: loop { break 'foo; }`,
129123
`'bar: while false {}`, `'humbug: for _ in 0..0 {}`.
130124
If a label is present, then labeled `break` and `continue` expressions nested
131125
within this loop may exit out of this loop or return control to its head.
132-
See [break expressions](#break-expressions) and [continue
133-
expressions](#continue-expressions).
126+
See [break expressions] and [continue expressions].
134127

135128
## `break` expressions
136129

@@ -153,7 +146,7 @@ assert_eq!(last, 12);
153146
```
154147

155148
A `break` expression is normally associated with the innermost `loop`, `for` or
156-
`while` loop enclosing the `break` expression, but a [label](#loop-labels) can
149+
`while` loop enclosing the `break` expression, but a [label][labels] can
157150
be used to specify which enclosing loop is affected. Example:
158151

159152
```rust
@@ -165,7 +158,7 @@ be used to specify which enclosing loop is affected. Example:
165158
```
166159

167160
A `break` expression is only permitted in the body of a loop, and has one of
168-
the forms `break`, `break 'label` or ([see below](#break-and-loop-values))
161+
the forms `break`, `break 'label` or ([see below][loop values])
169162
`break EXPR` or `break 'label EXPR`.
170163

171164
## `continue` expressions
@@ -209,9 +202,21 @@ and the `loop` must have a type compatible with each `break` expression.
209202
`break` without an expression is considered identical to `break` with
210203
expression `()`.
211204

212-
[IDENTIFIER]: identifiers.html
213-
214-
[_Expression_]: expressions.html
215-
[_BlockExpression_]: expressions/block-expr.html
216-
217-
[LIFETIME_OR_LABEL]: tokens.html#lifetimes-and-loop-labels
205+
[IDENTIFIER]: ../identifiers.html
206+
[_Expression_]: ../expressions.html
207+
[_BlockExpression_]: block-expr.html
208+
[LIFETIME_OR_LABEL]: ../tokens.html#lifetimes-and-loop-labels
209+
[_LoopLabel_]: #loop-labels
210+
[_InfiniteLoopExpression_]: #infinite-loops
211+
[_PredicateLoopExpression_]: #predicate-loops
212+
[_PredicatePatternLoopExpression_]: #predicate-pattern-loops
213+
[_IteratorLoopExpression_]: #iterator-loops
214+
[`loop` expression]: #infinite-loops
215+
[`while` expression]: #predicate-loops
216+
[`while let` expression`]: #predicate-pattern-loops
217+
[`for` expression]: #iterator-loops
218+
[`break` expressions]: #break-expressions
219+
[`continue` expressions]: #continue-expressions
220+
[labels]: #loop-labels
221+
[loop values]: #break-and-loop-values
222+
[`!`]: ../types.html#never-type

src/expressions/match-expr.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,14 @@ let message = match maybe_digit {
201201
Outer attributes are allowed on match arms. The only attributes that have
202202
meaning on match arms are [`cfg`], `cold`, and the [lint check attributes].
203203
204-
[_Expression_]: expressions.html
205-
[_BlockExpression_]: expressions/block-expr.html#block-expressions
206-
[place expression]: expressions.html#place-expressions-and-value-expressions
207-
[value expression]: expressions.html#place-expressions-and-value-expressions
208-
[`char`]: types.html#textual-types
209-
[numeric types]: types.html#numeric-types
210-
[_InnerAttribute_]: attributes.html
211-
[_OuterAttribute_]: attributes.html
212-
[`cfg`]: attributes.html#conditional-compilation
213-
[lint check attributes]: attributes.html#lint-check-attributes
214-
[range]: expressions/range-expr.html
204+
[_Expression_]: ../expressions.html
205+
[_BlockExpression_]: block-expr.html#block-expressions
206+
[place expression]: ../expressions.html#place-expressions-and-value-expressions
207+
[value expression]: ../expressions.html#place-expressions-and-value-expressions
208+
[`char`]: ../types.html#textual-types
209+
[numeric types]: ../types.html#numeric-types
210+
[_InnerAttribute_]: ../attributes.html
211+
[_OuterAttribute_]: ../attributes.html
212+
[`cfg`]: ../attributes.html#conditional-compilation
213+
[lint check attributes]: ../attributes.html#lint-check-attributes
214+
[range]: range-expr.html

0 commit comments

Comments
 (0)