Skip to content

Commit 96618fa

Browse files
authored
Merge pull request #1770 from ehuss/fix-header-rules
Fix header rules
2 parents 3842281 + 3678a65 commit 96618fa

27 files changed

+7
-72
lines changed

src/attributes/codegen.md

-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
r[attributes.codegen]
22
# Code generation attributes
33

4-
54
The following [attributes] are used for controlling code generation.
65

76
r[attributes.codegen.hint]
@@ -44,14 +43,12 @@ There are three ways to use the inline attribute:
4443
r[attributes.codegen.cold]
4544
### The `cold` attribute
4645

47-
4846
The *`cold` [attribute]* suggests that the attributed function is unlikely to
4947
be called.
5048

5149
r[attributes.codegen.no_builtins]
5250
## The `no_builtins` attribute
5351

54-
5552
The *`no_builtins` [attribute]* may be applied at the crate level to disable
5653
optimizing certain code patterns to invocations of library functions that are
5754
assumed to exist.
@@ -143,13 +140,11 @@ be used with a `target_feature` attribute.
143140
r[attributes.codegen.target_feature.availability]
144141
### Available features
145142

146-
147143
The following is a list of the available feature names.
148144

149145
r[attributes.codegen.target_feature.x86]
150146
#### `x86` or `x86_64`
151147

152-
153148
Executing code with unsupported features is undefined behavior on this platform.
154149
Hence on this platform usage of `#[target_feature]` functions follows the
155150
[above restrictions][attributes.codegen.target_feature.safety-restrictions].
@@ -218,7 +213,6 @@ Feature | Implicitly Enables | Description
218213
r[attributes.codegen.target_feature.aarch64]
219214
#### `aarch64`
220215

221-
222216
On this platform the usage of `#[target_feature]` functions follows the
223217
[above restrictions][attributes.codegen.target_feature.safety-restrictions].
224218

@@ -232,7 +226,6 @@ Reference Manual], or elsewhere on [developer.arm.com].
232226
> The following pairs of features should both be marked as enabled or disabled together if used:
233227
> - `paca` and `pacg`, which LLVM currently implements as one feature.
234228
235-
236229
Feature | Implicitly Enables | Feature Name
237230
---------------|--------------------|-------------------
238231
`aes` | `neon` | FEAT_AES & FEAT_PMULL --- Advanced <abbr title="Single Instruction Multiple Data">SIMD</abbr> AES & PMULL instructions
@@ -283,7 +276,6 @@ Feature | Implicitly Enables | Feature Name
283276
r[attributes.codegen.target_feature.riscv]
284277
#### `riscv32` or `riscv64`
285278

286-
287279
On this platform the usage of `#[target_feature]` functions follows the
288280
[above restrictions][attributes.codegen.target_feature.safety-restrictions].
289281

@@ -345,7 +337,6 @@ Feature | Implicitly Enables | Description
345337
r[attributes.codegen.target_feature.wasm]
346338
#### `wasm32` or `wasm64`
347339

348-
349340
Safe `#[target_feature]` functions may always be used in safe contexts on Wasm
350341
platforms. It is impossible to cause undefined behavior via the
351342
`#[target_feature]` attribute because attempting to use instructions
@@ -539,7 +530,6 @@ It is a compilation error to use the `instruction_set` attribute on a target tha
539530
r[attributes.codegen.instruction_set.arm]
540531
### On ARM
541532

542-
543533
For the `ARMv4T` and `ARMv5te` architectures, the following are supported:
544534
* `arm::a32` --- Generate the function as A32 "ARM" code.
545535
* `arm::t32` --- Generate the function as T32 "Thumb" code.

src/attributes/debugger.md

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
r[attributes.debugger]
22
# Debugger attributes
33

4-
54
The following [attributes] are used for enhancing the debugging experience when using third-party debuggers like GDB or WinDbg.
65

76
r[attributes.debugger.debugger_visualizer]

src/attributes/diagnostics.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -549,9 +549,8 @@ error[E0277]: My Message for `ImportantTrait<i32>` implemented for `String`
549549
= note: Note 2
550550
```
551551

552-
### The `diagnostic::do_not_recommend` attribute
553-
554552
r[attributes.diagnostic.do_not_recommend]
553+
### The `diagnostic::do_not_recommend` attribute
555554

556555
r[attributes.diagnostic.do_not_recommend.intro]
557556
The `#[diagnostic::do_not_recommend]` attribute is a hint to the compiler to not show the annotated trait implementation as part of a diagnostic message.

src/attributes/limits.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
r[attributes.limits]
22
# Limits
33

4-
54
The following [attributes] affect compile-time limits.
65

76
r[attributes.limits.recursion_limit]
@@ -44,7 +43,6 @@ a!{}
4443
r[attributes.limits.type_length_limit]
4544
## The `type_length_limit` attribute
4645

47-
4846
> [!NOTE]
4947
> This limit is only enforced when the nightly `-Zenforce-type-length-limit` flag is active.
5048
>

src/attributes/testing.md

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
r[attributes.testing]
22
# Testing attributes
33

4-
54
The following [attributes] are used for specifying functions for performing
65
tests. Compiling a crate in "test" mode enables building the test functions
76
along with a test harness for executing the tests. Enabling the test mode also

src/behavior-considered-undefined.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,10 @@ r[undefined.pointed-to]
9696

9797
The span of bytes a pointer or reference "points to" is determined by the pointer value and the size of the pointee type (using `size_of_val`).
9898

99+
r[undefined.misaligned]
99100
### Places based on misaligned pointers
100101
[based on a misaligned pointer]: #places-based-on-misaligned-pointers
101102

102-
r[undefined.misaligned]
103-
104103
r[undefined.misaligned.general]
105104
A place is said to be "based on a misaligned pointer" if the last `*` projection
106105
during place computation was performed on a pointer that was not aligned for its
@@ -137,11 +136,10 @@ more aligned than the type that contains it, i.e., `repr(packed)`. This means
137136
that being based on an aligned pointer is always sufficient to ensure that the
138137
new reference is aligned, but it is not always necessary.
139138

139+
r[undefined.dangling]
140140
### Dangling pointers
141141
[dangling]: #dangling-pointers
142142

143-
r[undefined.dangling]
144-
145143
r[undefined.dangling.general]
146144
A reference/pointer is "dangling" if not all of the bytes it
147145
[points to] are part of the same live allocation (so in particular they all have to be
@@ -160,11 +158,10 @@ In particular, the dynamic size of a Rust value (as determined by `size_of_val`)
160158
must never exceed `isize::MAX`, since it is impossible for a single allocation
161159
to be larger than `isize::MAX`.
162160

161+
r[undefined.validity]
163162
### Invalid values
164163
[invalid-values]: #invalid-values
165164

166-
r[undefined.validity]
167-
168165
r[undefined.validity.general]
169166
The Rust compiler assumes that all values produced during program execution are
170167
"valid", and producing an invalid value is hence immediate UB.

src/comments.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
r[comments.syntax]
22
# Comments
33

4-
54
> **<sup>Lexer</sup>**\
65
> LINE_COMMENT :\
76
> &nbsp;&nbsp; &nbsp;&nbsp; `//` (~\[`/` `!` `\n`] | `//`) ~`\n`<sup>\*</sup>\
@@ -37,7 +36,6 @@ r[comments.syntax]
3736
r[comments.normal]
3837
## Non-doc comments
3938

40-
4139
Comments follow the general C++ style of line (`//`) and
4240
block (`/* ... */`) comment forms. Nested block comments are supported.
4341

src/conditional-compilation.md

-4
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ r[cfg.target_has_atomic.stdlib]
263263
When this cfg is present, all of the stable [`core::sync::atomic`] APIs are available for
264264
the relevant atomic width.
265265

266-
267266
r[cfg.target_has_atomic.values]
268267
Possible values:
269268

@@ -277,14 +276,12 @@ Possible values:
277276
r[cfg.test]
278277
### `test`
279278

280-
281279
Enabled when compiling the test harness. Done with `rustc` by using the
282280
[`--test`] flag. See [Testing] for more on testing support.
283281

284282
r[cfg.debug_assertions]
285283
### `debug_assertions`
286284

287-
288285
Enabled by default when compiling without optimizations.
289286
This can be used to enable extra debugging code in development but not in
290287
production. For example, it controls the behavior of the standard library's
@@ -293,7 +290,6 @@ production. For example, it controls the behavior of the standard library's
293290
r[cfg.proc_macro]
294291
### `proc_macro`
295292

296-
297293
Set when the crate being compiled is being compiled with the `proc_macro`
298294
[crate type].
299295

src/const_eval.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,10 @@ r[const-eval.const-expr.loop]
107107
r[const-eval.const-expr.if-match]
108108
* [if], [`if let`] and [match] expressions.
109109

110+
r[const-eval.const-context]
110111
## Const context
111112
[const context]: #const-context
112113

113-
r[const-eval.const-context]
114-
115114
r[const-eval.const-context.general]
116115
A _const context_ is one of the following:
117116

src/destructors.md

-5
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ r[destructors.scope.nesting.other]
136136
r[destructors.scope.params]
137137
### Scopes of function parameters
138138

139-
140139
All function parameters are in the scope of the entire function body, so are
141140
dropped last when evaluating the function. Each actual function parameter is
142141
dropped after any bindings introduced in that parameter's pattern.
@@ -266,7 +265,6 @@ match PrintOnDrop("Matched value in final expression") {
266265
r[destructors.scope.operands]
267266
### Operands
268267

269-
270268
Temporaries are also created to hold the result of operands to an expression
271269
while the other operands are evaluated. The temporaries are associated to the
272270
scope of the expression with that operand. Since the temporaries are moved from
@@ -298,7 +296,6 @@ loop {
298296
r[destructors.scope.const-promotion]
299297
### Constant promotion
300298

301-
302299
Promotion of a value expression to a `'static` slot occurs when the expression
303300
could be written in a constant and borrowed, and that borrow could be dereferenced
304301
where
@@ -311,7 +308,6 @@ always has the type `&'static Option<_>`, as it contains nothing disallowed).
311308
r[destructors.scope.lifetime-extension]
312309
### Temporary lifetime extension
313310

314-
315311
> [!NOTE]
316312
> The exact rules for temporary lifetime extension are subject to change. This is describing the current behavior only.
317313
@@ -368,7 +364,6 @@ scope of the initializer expression is extended.
368364
r[destructors.scope.lifetime-extension.exprs]
369365
#### Extending based on expressions
370366

371-
372367
For a let statement with an initializer, an *extending expression* is an
373368
expression which is one of the following:
374369

src/dynamically-sized-types.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
# Dynamically Sized Types
2-
31
r[dynamic-sized]
2+
# Dynamically Sized Types
43

54
r[dynamic-sized.intro]
65
Most types have a fixed size that is known at compile time and implement the

src/identifiers.md

-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ Identifiers are restricted to the ASCII subset of [`XID_Start`] and [`XID_Contin
5656
r[ident.normalization]
5757
## Normalization
5858

59-
6059
Identifiers are normalized using Normalization Form C (NFC) as defined in [Unicode Standard Annex #15][UAX15]. Two identifiers are equal if their NFC forms are equal.
6160

6261
[Procedural][proc-macro] and [declarative][mbe] macros receive normalized identifiers in their input.

src/inline-assembly.md

-1
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,6 @@ assert_eq!(s, "Hello World!");
14731473
r[asm.target-specific-directives]
14741474
#### Target Specific Directive Support
14751475

1476-
14771476
r[asm.target-specific-directives.dwarf-unwinding]
14781477
##### Dwarf Unwinding
14791478

src/input-format.md

-3
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,11 @@ It is an error if the file is not valid UTF-8.
1818
r[input.byte-order-mark]
1919
## Byte order mark removal
2020

21-
2221
If the first character in the sequence is `U+FEFF` ([BYTE ORDER MARK]), it is removed.
2322

2423
r[input.crlf]
2524
## CRLF normalization
2625

27-
2826
Each pair of characters `U+000D` (CR) immediately followed by `U+000A` (LF) is replaced by a single `U+000A` (LF).
2927

3028
Other occurrences of the character `U+000D` (CR) are left in place (they are treated as [whitespace]).
@@ -56,7 +54,6 @@ This prevents an [inner attribute] at the start of a source file being removed.
5654
r[input.tokenization]
5755
## Tokenization
5856

59-
6057
The resulting sequence of characters is then converted into tokens as described in the remainder of this chapter.
6158

6259
[inner attribute]: attributes.md

src/linkage.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
r[link]
22
# Linkage
33

4-
54
> [!NOTE]
65
> This section is described more in terms of the compiler than of the language.
76
@@ -251,9 +250,8 @@ a statically linked binary on MSVC you would execute:
251250
RUSTFLAGS='-C target-feature=+crt-static' cargo build --target x86_64-pc-windows-msvc
252251
```
253252

254-
## Mixed Rust and foreign codebases
255-
256253
r[link.foreign-code]
254+
## Mixed Rust and foreign codebases
257255

258256
r[link.foreign-code.foreign-linkers]
259257
If you are mixing Rust with foreign code (e.g. C, C++) and wish to make a single

src/macro-ambiguity.md

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
r[macro.ambiguity]
22
# Appendix: Macro Follow-Set Ambiguity Formal Specification
33

4-
54
This page documents the formal specification of the follow rules for [Macros
65
By Example]. They were originally specified in [RFC 550], from which the bulk
76
of this text is copied, and expanded upon in subsequent RFCs.

src/macros-by-example.md

-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ instance, the matcher `(())` will match `{()}` but not `{{}}`. The character
8787
r[macro.decl.transcription.fragment]
8888
### Forwarding a matched fragment
8989

90-
9190
When forwarding a matched fragment to another macro-by-example, matchers in
9291
the second macro will see an opaque AST of the fragment type. The second macro
9392
can't use literal tokens to match the fragments in the matcher, only a

src/names/preludes.md

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ Edition | `no_std` not applied | `no_std` applied
3535
2021 | [`std::prelude::rust_2021`] | [`core::prelude::rust_2021`]
3636
2024 | [`std::prelude::rust_2024`] | [`core::prelude::rust_2024`]
3737

38-
3938
> [!NOTE]
4039
> [`std::prelude::rust_2015`] and [`std::prelude::rust_2018`] have the same contents as [`std::prelude::v1`].
4140
>

src/procedural-macros.md

-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ with any token, such as through getting a `Span` from another token.
6969
r[macro.proc.hygiene]
7070
### Procedural macro hygiene
7171
72-
7372
Procedural macros are *unhygienic*. This means they behave as if the output
7473
token stream was simply written inline to the code it's next to. This means that
7574
it's affected by external items and also affects external imports.

src/statements-and-expressions.md

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
r[stmt-expr]
22
# Statements and expressions
33

4-
54
Rust is _primarily_ an expression language.
65
This means that most forms of value-producing or effect-causing evaluation are directed by the uniform syntax category of _expressions_.
76
Each kind of expression can typically _nest_ within each other kind of expression, and rules for evaluation of expressions involve specifying both the value produced by the expression and the order in which its sub-expressions are themselves evaluated.

src/statements.md

-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ Rust has two kinds of statement: [declaration statements](#declaration-statement
1919
r[statement.decl]
2020
## Declaration statements
2121

22-
2322
A *declaration statement* is one that introduces one or more *names* into the enclosing statement block.
2423
The declared names may denote new variables or new [items][item].
2524

@@ -147,7 +146,6 @@ if true {
147146
r[statement.attribute]
148147
## Attributes on Statements
149148

150-
151149
Statements accept [outer attributes].
152150
The attributes that have meaning on a statement are [`cfg`], and [the lint check attributes].
153151

0 commit comments

Comments
 (0)