Skip to content

Commit 4ef5f5d

Browse files
committed
Use plural diagnostics for diagnostics chapter
This is keeping in line with using plurals throughout the rest of the naming convention. This also differentiates it from the `diagnostic` namespace. The `diagnostic` namespace remains singular, and is not nested with the plural `diagnostics` just to avoid the repetition.
1 parent d1232b4 commit 4ef5f5d

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

src/attributes/diagnostics.md

+31-31
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
# Diagnostic attributes
22

3-
r[attributes.diagnostic]
3+
r[attributes.diagnostics]
44

55
The following [attributes] are used for controlling or generating diagnostic
66
messages during compilation.
77

88
## Lint check attributes
99

10-
r[attributes.diagnostic.lint]
10+
r[attributes.diagnostics.lint]
1111

1212
A lint check names a potentially undesirable coding pattern, such as
1313
unreachable code or omitted documentation.
1414

15-
r[attributes.diagnostic.lint.level]
15+
r[attributes.diagnostics.lint.level]
1616
The lint attributes `allow`,
1717
`expect`, `warn`, `deny`, and `forbid` use the [_MetaListPaths_] syntax
1818
to specify a list of lint names to change the lint level for the entity
1919
to which the attribute applies.
2020

2121
For any lint check `C`:
2222

23-
r[attributes.diagnostic.lint.allow]
23+
r[attributes.diagnostics.lint.allow]
2424
* `#[allow(C)]` overrides the check for `C` so that violations will go
2525
unreported.
2626

27-
r[attributes.diagnostic.lint.expect]
27+
r[attributes.diagnostics.lint.expect]
2828
* `#[expect(C)]` indicates that lint `C` is expected to be emitted. The
2929
attribute will suppress the emission of `C` or issue a warning, if the
3030
expectation is unfulfilled.
3131

32-
r[attributes.diagnostic.lint.warn]
32+
r[attributes.diagnostics.lint.warn]
3333
* `#[warn(C)]` warns about violations of `C` but continues compilation.
3434

35-
r[attributes.diagnostic.lint.deny]
35+
r[attributes.diagnostics.lint.deny]
3636
* `#[deny(C)]` signals an error after encountering a violation of `C`,
3737

38-
r[attributes.diagnostic.lint.forbid]
38+
r[attributes.diagnostics.lint.forbid]
3939
* `#[forbid(C)]` is the same as `deny(C)`, but also forbids changing the lint
4040
level afterwards,
4141

@@ -58,7 +58,7 @@ pub mod m1 {
5858
}
5959
```
6060

61-
r[attributes.diagnostic.lint.override]
61+
r[attributes.diagnostics.lint.override]
6262
Lint attributes can override the level specified from a previous attribute, as
6363
long as the level does not attempt to change a forbidden lint
6464
(except for `deny`, which is allowed inside a `forbid` context, but ignored).
@@ -106,7 +106,7 @@ pub mod m3 {
106106
107107
### Lint Reasons
108108

109-
r[attributes.diagnostic.lint.reason]
109+
r[attributes.diagnostics.lint.reason]
110110
All lint attributes support an additional `reason` parameter, to give context why
111111
a certain attribute was added. This reason will be displayed as part of the lint
112112
message if the lint is emitted at the defined level.
@@ -143,9 +143,9 @@ pub fn get_path() -> PathBuf {
143143

144144
### The `#[expect]` attribute
145145

146-
r[attributes.diagnostic.expect]
146+
r[attributes.diagnostics.expect]
147147

148-
r[attributes.diagnostic.expect.intro]
148+
r[attributes.diagnostics.expect.intro]
149149
The `#[expect(C)]` attribute creates a lint expectation for lint `C`. The
150150
expectation will be fulfilled, if a `#[warn(C)]` attribute at the same location
151151
would result in a lint emission. If the expectation is unfulfilled, because
@@ -171,7 +171,7 @@ fn main() {
171171
}
172172
```
173173

174-
r[attributes.lints.expect.fulfillment]
174+
r[attributes.diagnostics.expect.fulfillment]
175175
The lint expectation is only fulfilled by lint emissions which have been suppressed by
176176
the `expect` attribute. If the lint level is modified in the scope with other level
177177
attributes like `allow` or `warn`, the lint emission will be handled accordingly and the
@@ -201,7 +201,7 @@ fn select_song() {
201201
}
202202
```
203203

204-
r[attributes.diagnostic.expect.independent]
204+
r[attributes.diagnostics.expect.independent]
205205
If the `expect` attribute contains several lints, each one is expected separately. For a
206206
lint group it's enough if one lint inside the group has been emitted:
207207

@@ -230,7 +230,7 @@ pub fn another_example() {
230230
231231
### Lint groups
232232

233-
r[attributes.diagnostic.lint.group]
233+
r[attributes.diagnostics.lint.group]
234234
Lints may be organized into named groups so that the level of related lints
235235
can be adjusted together. Using a named group is equivalent to listing out the
236236
lints within that group.
@@ -251,7 +251,7 @@ fn example() {
251251
}
252252
```
253253

254-
r[attributes.diagnostic.lint.group.warnings]
254+
r[attributes.diagnostics.lint.group.warnings]
255255
There is a special group named "warnings" which includes all lints at the
256256
"warn" level. The "warnings" group ignores attribute order and applies to all
257257
lints that would otherwise warn within the entity.
@@ -271,13 +271,13 @@ fn example_err() {
271271

272272
### Tool lint attributes
273273

274-
r[attributes.diagnostic.lint.tool]
274+
r[attributes.diagnostics.lint.tool]
275275

276-
r[attributes.diagnostic.lint.tool.intro]
276+
r[attributes.diagnostics.lint.tool.intro]
277277
Tool lints allows using scoped lints, to `allow`, `warn`, `deny` or `forbid`
278278
lints of certain tools.
279279

280-
r[attributes.diagnostic.lint.tool.activation]
280+
r[attributes.diagnostics.lint.tool.activation]
281281
Tool lints only get checked when the associated tool is active. If a lint
282282
attribute, such as `allow`, references a nonexistent tool lint, the compiler
283283
will not warn about the nonexistent lint until you use the tool.
@@ -305,14 +305,14 @@ fn foo() {
305305
306306
## The `deprecated` attribute
307307

308-
r[attributes.diagnostic.deprecated]
308+
r[attributes.diagnostics.deprecated]
309309

310-
r[attributes.diagnostic.deprecated.intro]
310+
r[attributes.diagnostics.deprecated.intro]
311311
The *`deprecated` attribute* marks an item as deprecated. `rustc` will issue
312312
warnings on usage of `#[deprecated]` items. `rustdoc` will show item
313313
deprecation, including the `since` version and `note`, if available.
314314

315-
r[attributes.diagnostic.deprecated.syntax]
315+
r[attributes.diagnostics.deprecated.syntax]
316316
The `deprecated` attribute has several forms:
317317

318318
- `deprecated` --- Issues a generic message.
@@ -352,23 +352,23 @@ The [RFC][1270-deprecation.md] contains motivations and more details.
352352

353353
## The `must_use` attribute
354354

355-
r[attributes.diagnostic.must_use]
355+
r[attributes.diagnostics.must_use]
356356

357-
r[attributes.diagnostic.must_use.intro]
357+
r[attributes.diagnostics.must_use.intro]
358358
The *`must_use` attribute* is used to issue a diagnostic warning when a value
359359
is not "used".
360360

361-
r[attributes.diagnostic.must_use.allowed-positions]
361+
r[attributes.diagnostics.must_use.allowed-positions]
362362
The `must_use` attribute can be applied to user-defined composite types
363363
([`struct`s][struct], [`enum`s][enum], and [`union`s][union]), [functions],
364364
and [traits].
365365

366-
r[attributes.diagnostic.must_use.message]
366+
r[attributes.diagnostics.must_use.message]
367367
The `must_use` attribute may include a message by using the
368368
[_MetaNameValueStr_] syntax such as `#[must_use = "example message"]`. The
369369
message will be given alongside the warning.
370370

371-
r[attributes.diagnostic.must_use.type]
371+
r[attributes.diagnostics.must_use.type]
372372
When used on user-defined composite types, if the [expression] of an
373373
[expression statement] has that type, then the `unused_must_use` lint is
374374
violated.
@@ -387,7 +387,7 @@ struct MustUse {
387387
MustUse::new();
388388
```
389389

390-
r[attributes.diagnostic.must_use.fn]
390+
r[attributes.diagnostics.must_use.fn]
391391
When used on a function, if the [expression] of an [expression statement] is a
392392
[call expression] to that function, then the `unused_must_use` lint is
393393
violated.
@@ -400,7 +400,7 @@ fn five() -> i32 { 5i32 }
400400
five();
401401
```
402402

403-
r[attributes.diagnostic.must_use.trait]
403+
r[attributes.diagnostics.must_use.trait]
404404
When used on a [trait declaration], a [call expression] of an [expression
405405
statement] to a function that returns an [impl trait] or a [dyn trait] of that trait violates
406406
the `unused_must_use` lint.
@@ -418,7 +418,7 @@ fn get_critical() -> impl Critical {
418418
get_critical();
419419
```
420420

421-
r[attributes.diagnostic.must_use.trait-function]
421+
r[attributes.diagnostics.must_use.trait-function]
422422
When used on a function in a trait declaration, then the behavior also applies
423423
when the call expression is a function from an implementation of the trait.
424424

@@ -436,7 +436,7 @@ impl Trait for i32 {
436436
5i32.use_me();
437437
```
438438

439-
r[attributes.diagnostic.must_use.trait-impl-function]
439+
r[attributes.diagnostics.must_use.trait-impl-function]
440440
When used on a function in a trait implementation, the attribute does nothing.
441441

442442
> Note: Trivial no-op expressions containing the value will not violate the

0 commit comments

Comments
 (0)