Skip to content

Commit 94aa44f

Browse files
committed
Change a few rule names
These are some misc rule name changes. Some of them are to give the rules more specific names (indicating what they do, instead of using generic terms). The `allowed-positions` name is intended to be used for all attributes to have a specific rule that defines where an attribute may be used. It is not consistently used, yet. Also, some of the paragraphs mix "where it goes" with "what it does" that should probably be teased apart so that we can label those independently. I expect us to do some more cleanup to bring some consistency to the attribute rules since there are a lot of attributes, and they generally have the same requirements of what needs to be specified.
1 parent b62fbd2 commit 94aa44f

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

src/attributes/codegen.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Each [target architecture] has a set of features that may be enabled. It is an
8080
error to specify a feature for a target architecture that the crate is not
8181
being compiled for.
8282

83-
r[attributes.codegen.target_feature.precondition]
83+
r[attributes.codegen.target_feature.target-ub]
8484
It is [undefined behavior] to call a function that is compiled with a feature
8585
that is not supported on the current platform the code is running on, *except*
8686
if the platform explicitly documents this to be safe.
@@ -344,7 +344,7 @@ in the standard library for runtime feature detection on these platforms.
344344

345345
r[attributes.codegen.track_caller]
346346

347-
r[attributes.codegen.track_caller.restriction]
347+
r[attributes.codegen.track_caller.allowed-positions]
348348
The `track_caller` attribute may be applied to any function with [`"Rust"` ABI][rust-abi]
349349
with the exception of the entry point `fn main`.
350350

@@ -478,7 +478,7 @@ trait object whose methods are attributed.
478478

479479
r[attributes.codegen.instruction_set]
480480

481-
r[attributes.codegen.instruction_set.restriction]
481+
r[attributes.codegen.instruction_set.allowed-positions]
482482
The *`instruction_set` [attribute]* may be applied to a function to control which instruction set the function will be generated for.
483483

484484
r[attributes.codegen.instruction_set.behavior]

src/attributes/diagnostics.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -354,13 +354,16 @@ The [RFC][1270-deprecation.md] contains motivations and more details.
354354

355355
r[attributes.diagnostic.must_use]
356356

357-
r[attributes.diagnostic.must_use.application]
357+
r[attributes.diagnostic.must_use.intro]
358358
The *`must_use` attribute* is used to issue a diagnostic warning when a value
359-
is not "used". It can be applied to user-defined composite types
359+
is not "used".
360+
361+
r[attributes.diagnostic.must_use.allowed-positions]
362+
The `must_use` attribute can be applied to user-defined composite types
360363
([`struct`s][struct], [`enum`s][enum], and [`union`s][union]), [functions],
361364
and [traits].
362365

363-
r[attributes.diagnostic.must_use.syntax]
366+
r[attributes.diagnostic.must_use.message]
364367
The `must_use` attribute may include a message by using the
365368
[_MetaNameValueStr_] syntax such as `#[must_use = "example message"]`. The
366369
message will be given alongside the warning.

src/attributes/limits.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The following [attributes] affect compile-time limits.
88

99
r[attributes.limits.recursion_limit]
1010

11-
r[attributes.limits.recursion_limit.application]
11+
r[attributes.limits.recursion_limit.intro]
1212
The *`recursion_limit` attribute* may be applied at the [crate] level to set the
1313
maximum depth for potentially infinitely-recursive compile-time operations
1414
like macro expansion or auto-dereference.

src/attributes/testing.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The *`test` attribute* marks a function to be executed as a test.
1717
r[attributes.testing.test.enabled]
1818
These functions are only compiled when in test mode.
1919

20-
r[attributes.testing.test.target]
20+
r[attributes.testing.test.allowed-positions]
2121
Test functions must be free, monomorphic functions that take no arguments, and the return type must implement the [`Termination`] trait, for example:
2222

2323
* `()`
@@ -78,7 +78,7 @@ fn mytest() {
7878

7979
r[attributes.testing.should_panic]
8080

81-
r[attributes.testing.should_panic.target]
81+
r[attributes.testing.should_panic.intro]
8282
A function annotated with the `test` attribute that returns `()` can also be
8383
annotated with the `should_panic` attribute.
8484

src/attributes/type_system.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ r[attributes.type-system.non_exhaustive.intro]
1212
The *`non_exhaustive` attribute* indicates that a type or variant may have
1313
more fields or variants added in the future.
1414

15-
r[attributes.type-system.non_exhaustive.application]
15+
r[attributes.type-system.non_exhaustive.allowed-positions]
1616
It can be applied to [`struct`s][struct], [`enum`s][enum], and `enum` variants.
1717

1818
r[attributes.type-system.non_exhaustive.syntax]

0 commit comments

Comments
 (0)