Skip to content

Commit dd77e99

Browse files
committed
Make requested and CI stylistic changes to destructors.md identifiers
1 parent 7d7bf59 commit dd77e99

File tree

1 file changed

+25
-30
lines changed

1 file changed

+25
-30
lines changed

src/destructors.md

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Destructors
2-
r[destructors]
32

4-
5-
r[destructors.general]
3+
r[destructors.intro]
64
When an [initialized] [variable] or [temporary] goes out of
75
[scope](#drop-scopes), its *destructor* is run, or it is *dropped*. [Assignment]
86
also runs the destructor of its left-hand operand, if it's initialized. If a
@@ -62,78 +60,77 @@ core::mem::forget(partial_move.1);
6260

6361
## Drop scopes
6462

65-
r[destructor.scope]
66-
63+
r[destructors.scope]
6764

68-
r[destructor.scope.general]
65+
r[destructors.scope.intro]
6966
Each variable or temporary is associated to a *drop scope*. When control flow
7067
leaves a drop scope all variables associated to that scope are dropped in
7168
reverse order of declaration (for variables) or creation (for temporaries).
7269

73-
r[destructor.scope.desugaring]
70+
r[destructors.scope.desugaring]
7471
Drop scopes are determined after replacing [`for`], [`if let`], and
7572
[`while let`] expressions with the equivalent expressions using [`match`].
7673

77-
r[destructor.scope.operators]
74+
r[destructors.scope.operators]
7875
Overloaded operators are not distinguished from built-in operators and [binding
7976
modes] are not considered.
8077

81-
r[destructor.scope.list]
78+
r[destructors.scope.list]
8279
Given a function, or closure, there are drop scopes for:
8380

84-
r[destructor.scope.function]
81+
r[destructors.scope.function]
8582
* The entire function
8683

87-
r[destructor.scope.statement]
84+
r[destructors.scope.statement]
8885
* Each [statement]
8986

90-
r[destructor.scope.expression]
87+
r[destructors.scope.expression]
9188
* Each [expression]
9289

93-
r[destructor.scope.block]
90+
r[destructors.scope.block]
9491
* Each block, including the function body
9592
* In the case of a [block expression], the scope for the block and the
9693
expression are the same scope.
9794

98-
r[destructor.scope.match-arm]
95+
r[destructors.scope.match-arm]
9996
* Each arm of a `match` expression
10097

101-
r[destructor.scope.nesting]
98+
r[destructors.scope.nesting]
10299
Drop scopes are nested within one another as follows. When multiple scopes are
103100
left at once, such as when returning from a function, variables are dropped
104101
from the inside outwards.
105102

106-
r[destructor.scope.nesting.function]
103+
r[destructors.scope.nesting.function]
107104
* The entire function scope is the outer most scope.
108105

109-
r[destructor.scope.nesting.function-body]
106+
r[destructors.scope.nesting.function-body]
110107
* The function body block is contained within the scope of the entire function.
111108

112-
r[destructor.scope.nesting.expr-statement]
109+
r[destructors.scope.nesting.expr-statement]
113110
* The parent of the expression in an expression statement is the scope of the
114111
statement.
115112

116-
r[destructor.scope.nesting.let-initializer]
113+
r[destructors.scope.nesting.let-initializer]
117114
* The parent of the initializer of a [`let` statement] is the `let` statement's
118115
scope.
119116

120-
r[destructor.scope.nesting.statement]
117+
r[destructors.scope.nesting.statement]
121118
* The parent of a statement scope is the scope of the block that contains the
122119
statement.
123120

124-
r[destructor.scope.nesting.match-guard]
121+
r[destructors.scope.nesting.match-guard]
125122
* The parent of the expression for a `match` guard is the scope of the arm that
126123
the guard is for.
127124

128-
r[destructor.scope.nesting.match-arm]
125+
r[destructors.scope.nesting.match-arm]
129126
* The parent of the expression after the `=>` in a `match` expression is the
130127
scope of the arm that it's in.
131128

132-
r[destructor.scope.nesting.match]
129+
r[destructors.scope.nesting.match]
133130
* The parent of the arm scope is the scope of the `match` expression that it
134131
belongs to.
135132

136-
r[destructor.scope.nesting.other]
133+
r[destructors.scope.nesting.other]
137134
* The parent of all other scopes is the scope of the immediately enclosing
138135
expression.
139136

@@ -167,9 +164,9 @@ patterns_in_parameters(
167164

168165
### Scopes of local variables
169166

170-
r[destructor.scope.bindings]
167+
r[destructors.scope.bindings]
171168

172-
r[destructor.scope.bindings.general]
169+
r[destructors.scope.bindings.intro]
173170
Local variables declared in a `let` statement are associated to the scope of
174171
the block that contains the `let` statement. Local variables declared in a
175172
`match` expression are associated to the arm scope of the `match` arm that they
@@ -197,13 +194,12 @@ unspecified pattern will be used to determine the drop order.
197194

198195
r[destructors.scope.temporary]
199196

200-
201-
r[destructor.scope.temporary.general]
197+
r[destructors.scope.temporary.intro]
202198
The *temporary scope* of an expression is the scope that is used for the
203199
temporary variable that holds the result of that expression when used in a
204200
[place context], unless it is [promoted].
205201

206-
r[destructor.scope.temporary.enclosing]
202+
r[destructors.scope.temporary.enclosing]
207203
Apart from lifetime extension, the temporary scope of an expression is the
208204
smallest scope that contains the expression and is one of the following:
209205

@@ -341,7 +337,6 @@ temporary scope.
341337

342338
r[destructors.scope.lifetime-extension.patterns]
343339

344-
345340
r[destructors.scope.lifetime-extension.patterns.extending]
346341
An *extending pattern* is either
347342

0 commit comments

Comments
 (0)