Skip to content

Commit 415cafe

Browse files
committed
Adjust position of rules attached to headers
Adjusts the position of rules with headers to match the style from #1710
1 parent cff9c6f commit 415cafe

9 files changed

+69
-138
lines changed

src/keywords.md

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
# Keywords
2-
31
r[lex.keywords]
2+
# Keywords
43

54
Rust divides keywords into three categories:
65

76
* [strict](#strict-keywords)
87
* [reserved](#reserved-keywords)
98
* [weak](#weak-keywords)
109

11-
## Strict keywords
12-
1310
r[lex.keywords.strict]
11+
## Strict keywords
1412

1513
r[lex.keywords.strict.intro]
1614
These keywords can only be used in their correct contexts. They cannot
@@ -71,9 +69,8 @@ The following keywords were added beginning in the 2018 edition.
7169
> KW_AWAIT : `await`\
7270
> KW_DYN : `dyn`
7371
74-
## Reserved keywords
75-
7672
r[lex.keywords.reserved]
73+
## Reserved keywords
7774

7875
r[lex.keywords.reserved.intro]
7976
These keywords aren't used yet, but they are reserved for future use. They have
@@ -107,9 +104,8 @@ The following keywords are reserved beginning in the 2024 edition.
107104
> **<sup>Lexer 2024+</sup>**\
108105
> KW_GEN : `gen`
109106
110-
## Weak keywords
111-
112107
r[lex.keywords.weak]
108+
## Weak keywords
113109

114110
r[lex.keywords.weak.intro]
115111
These keywords have special meaning only in certain contexts. For example, it

src/lifetime-elision.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
# Lifetime elision
2-
31
r[lifetime-elision]
2+
# Lifetime elision
43

54
Rust has rules that allow lifetimes to be elided in various places where the
65
compiler can infer a sensible default choice.
76

8-
## Lifetime elision in functions
9-
107
r[lifetime-elision.function]
8+
## Lifetime elision in functions
119

1210
r[lifetime-elision.function.intro]
1311
In order to make common patterns more ergonomic, lifetime arguments can be
@@ -91,9 +89,8 @@ fn frob(s: &str, t: &str) -> &str; // ILLEGAL
9189
# }
9290
```
9391

94-
## Default trait object lifetimes
95-
9692
r[lifetime-elision.trait-object]
93+
## Default trait object lifetimes
9794

9895
r[lifetime-elision.trait-object.intro]
9996
The assumed lifetime of references held by a [trait object] is called its

src/macros.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
# Macros
2-
31
r[macro]
2+
# Macros
43

54
r[macro.intro]
65
The functionality and syntax of Rust can be extended with custom definitions
@@ -13,9 +12,8 @@ There are two ways to define new macros:
1312
* [Procedural Macros] define function-like macros, custom derives, and custom
1413
attributes using functions that operate on input tokens.
1514

16-
## Macro Invocation
17-
1815
r[macro.invocation]
16+
## Macro Invocation
1917

2018
r[macro.invocation.syntax]
2119
> **<sup>Syntax</sup>**\

src/memory-allocation-and-lifetime.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
# Memory allocation and lifetime
2-
31
r[alloc]
2+
# Memory allocation and lifetime
43

54
r[alloc.static]
65
The _items_ of a program are those functions, modules, and types that have their

src/names.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
# Names
2-
31
r[names]
2+
# Names
43

54
r[names.intro]
65
An *entity* is a language construct that can be referred to in some way within
@@ -36,9 +35,8 @@ and labels to entity declarations.
3635
r[names.visibility]
3736
Access to certain names may be restricted based on their [*visibility*].
3837

39-
## Explicitly declared entities
40-
4138
r[names.explicit]
39+
## Explicitly declared entities
4240

4341
r[names.explicit.list]
4442
Entities that explicitly introduce a name in the source code are:
@@ -87,9 +85,8 @@ r[names.explicit.macro-invocation]
8785
Additionally, [macro invocations] and [attributes] can introduce names by
8886
expanding to one of the above items.
8987

90-
## Implicitly declared entities
91-
9288
r[names.implicit]
89+
## Implicitly declared entities
9390

9491
r[names.implicit.list]
9592
The following entities are implicitly defined by the language, or are

src/paths.md

+13-26
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
# Paths
2-
31
r[paths]
2+
# Paths
43

54
r[paths.intro]
65
A *path* is a sequence of one or more path segments separated by `::` tokens.
@@ -16,9 +15,8 @@ x::y::z;
1615

1716
## Types of paths
1817

19-
### Simple Paths
20-
2118
r[paths.simple]
19+
### Simple Paths
2220

2321
r[paths.simple.syntax]
2422
> **<sup>Syntax</sup>**\
@@ -40,9 +38,8 @@ mod m {
4038
}
4139
```
4240

43-
### Paths in expressions
44-
4541
r[paths.expr]
42+
### Paths in expressions
4643

4744
r[paths.expr.syntax]
4845
> **<sup>Syntax</sup>**\
@@ -99,9 +96,8 @@ r[paths.expr.impl-trait-params]
9996
The synthetic type parameters corresponding to `impl Trait` types are implicit,
10097
and these cannot be explicitly specified.
10198

102-
## Qualified paths
103-
10499
r[paths.qualified]
100+
## Qualified paths
105101

106102
r[paths.qualified.syntax]
107103
> **<sup>Syntax</sup>**\
@@ -137,9 +133,8 @@ S::f(); // Calls the inherent impl.
137133
<S as T2>::f(); // Calls the T2 trait function.
138134
```
139135

140-
### Paths in types
141-
142136
r[paths.type]
137+
### Paths in types
143138

144139
r[paths.type.syntax]
145140
> **<sup>Syntax</sup>**\
@@ -179,16 +174,14 @@ fn i<'a>() -> impl Iterator<Item = ops::Example<'a>> {
179174
type G = std::boxed::Box<dyn std::ops::FnOnce(isize) -> isize>;
180175
```
181176

182-
## Path qualifiers
183-
184177
r[paths.qualifiers]
178+
## Path qualifiers
185179

186180
Paths can be denoted with various leading qualifiers to change the meaning of
187181
how it is resolved.
188182

189-
### `::`
190-
191183
r[paths.qualifiers.global-root]
184+
### `::`
192185

193186
r[paths.qualifiers.global-root.intro]
194187
Paths starting with `::` are considered to be *global paths* where the segments of the path
@@ -227,9 +220,8 @@ mod b {
227220
# fn main() {}
228221
```
229222

230-
### `self`
231-
232223
r[paths.qualifiers.mod-self]
224+
### `self`
233225

234226
r[paths.qualifiers.mod-self.intro]
235227
`self` resolves the path relative to the current module.
@@ -254,9 +246,8 @@ impl S {
254246
# fn main() {}
255247
```
256248

257-
### `Self`
258-
259249
r[paths.qualifiers.type-self]
250+
### `Self`
260251

261252
r[paths.qualifiers.type-self.intro]
262253
`Self`, with a capital "S", is used to refer to the current type being implemented or defined. It may be used in the following situations:
@@ -319,9 +310,8 @@ struct NonEmptyList<T> {
319310
}
320311
```
321312

322-
### `super`
323-
324313
r[paths.qualifiers.super]
314+
### `super`
325315

326316
r[paths.qualifiers.super.intro]
327317
`super` in a path resolves to the parent module.
@@ -361,9 +351,8 @@ mod a {
361351
# fn main() {}
362352
```
363353

364-
### `crate`
365-
366354
r[paths.qualifiers.crate]
355+
### `crate`
367356

368357
r[paths.qualifiers.crate.intro]
369358
`crate` resolves the path relative to the current crate.
@@ -381,9 +370,8 @@ mod a {
381370
# fn main() {}
382371
```
383372

384-
### `$crate`
385-
386373
r[paths.qualifiers.macro-crate]
374+
### `$crate`
387375

388376
r[paths.qualifiers.macro-crate.allowed-positions]
389377
`$crate` is only used within [macro transcribers], and can only be used as the first
@@ -406,9 +394,8 @@ macro_rules! inc {
406394
# fn main() { }
407395
```
408396

409-
## Canonical paths
410-
411397
r[paths.canonical]
398+
## Canonical paths
412399

413400
r[paths.canonical.intro]
414401
Items defined in a module or implementation have a *canonical path* that

0 commit comments

Comments
 (0)