Skip to content

Commit a7a2033

Browse files
committed
Apply light edits to the attributes chapter
1 parent 19cef87 commit a7a2033

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

reference-dev-guide/src/attributes.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Attributes should use the following template. Examples are given for phrasing you *should* use, but you should deviate if the attribute doesn't fit any of the examples or if they get in the way of clarity.
44

5-
When an attribute (or a new attribute position in the grammar) is added, be sure to update all the "attributes on" sections which list which attributes can be used in various positions.
5+
When an attribute (or a new attribute position in the grammar) is added, be sure to update all the "attributes on" sections that list which attributes can be used in various positions.
66

77
----
88

@@ -11,7 +11,7 @@ r[PARENT.example]
1111
## The `example` attribute
1212

1313
r[PARENT.example.intro]
14-
The *`example` [attribute][attributes]* ...give a high level description.
14+
The *`example` [attribute][attributes]* ...give a high-level description.
1515

1616
> [!EXAMPLE]
1717
> ```rust
@@ -22,7 +22,7 @@ The *`example` [attribute][attributes]* ...give a high level description.
2222
> ```
2323
2424
r[PARENT.example.syntax]
25-
Describe the accepted syntax of this attribute. You can either explain that it uses one of the pre-existing grammars like `MetaWord` or define an explicit grammar. If there are different forms, briefly describe the syntax here, and link to the appropriate rules below that explain the behavior of the different forms. Examples:
25+
Describe the accepted syntax of this attribute. You can either explain that it uses one of the pre-existing grammars, like `MetaWord`, or define an explicit grammar. If there are different forms, briefly describe the syntax here and link to the appropriate rules below that explain the behavior of the different forms. Examples:
2626
2727
----
2828
@@ -50,7 +50,7 @@ The `example` attribute uses the [MetaNameValueStr] syntax. The value in the str
5050
5151
----
5252
53-
The `example` attribute has these forms:
53+
The `example` attribute has the following forms:
5454
5555
- [MetaWord]
5656
> [!EXAMPLE]
@@ -92,7 +92,7 @@ The [MetaNameValueStr] form of the `example` attribute provides a way to specify
9292
> ```
9393
9494
r[PARENT.example.allowed-positions]
95-
Explain the valid positions where this attribute may be used.
95+
Explain the valid positions where this attribute can be used.
9696
9797
See [`check_attr`](https://github.com/rust-lang/rust/blob/HEAD/compiler/rustc_passes/src/check_attr.rs) and [`builtin_attrs.rs`](https://github.com/rust-lang/rust/blob/HEAD/compiler/rustc_feature/src/builtin_attrs.rs) in the compiler. Don't forget that some attributes only work as inner or outer attributes. Examples:
9898
@@ -110,15 +110,15 @@ The `example` attribute is allowed anywhere attributes are allowed.
110110
111111
----
112112
113-
If there are unused attribute warnings, or if rustc is incorrectly accepting some positions, include a note about these.
113+
If there are unused attribute warnings, or if `rustc` is incorrectly accepting some positions, include a note about these.
114114
115115
> [!NOTE]
116116
> `rustc` ignores use in other positions but lints against it. This may become an error in the future.
117117
118118
----
119119
120120
r[PARENT.example.duplicates]
121-
Explain the behavior if the attribute is specified multiple times on an element. See [`AttributeDuplicates`](https://github.com/rust-lang/rust/blob/40d2563ea200f9327a8cb8b99a0fb82f75a7365c/compiler/rustc_feature/src/builtin_attrs.rs#L143) in the compiler. Examples:
121+
Explain the behavior when the attribute is specified multiple times on an element. See [`AttributeDuplicates`](https://github.com/rust-lang/rust/blob/40d2563ea200f9327a8cb8b99a0fb82f75a7365c/compiler/rustc_feature/src/builtin_attrs.rs#L143) in the compiler. Examples:
122122
123123
----
124124
@@ -160,7 +160,7 @@ If the `example` attribute is used more than once on an item, then the combinati
160160
----
161161
162162
r[PARENT.example.ATTR_NAME]
163-
If this attribute cannot be used with another attribute, specify each one. Do this on both attributes. Example:
163+
If this attribute cannot be used with another attribute, specify each conflicting attribute. Do this for both attributes. Example:
164164
165165
----
166166
@@ -169,7 +169,7 @@ The `example` attribute may not be used with the [`foo`] attribute.
169169
----
170170
171171
r[PARENT.example.unsafe]
172-
If this is an `unsafe` attribute, explain the safety conditions it must uphold. If not, don't include this section. Be sure to also update `attributes.safety` when adding a new unsafe attribute. Example:
172+
If this is an `unsafe` attribute, explain the safety conditions it must uphold. Otherwise, do not include this section. Be sure to also update `attributes.safety` when adding a new unsafe attribute. Example:
173173
174174
----
175175
@@ -178,7 +178,7 @@ The `example` attribute must be marked with [`unsafe`][attributes.safety] becaus
178178
----
179179
180180
r[PARENT.example.stdlib]
181-
This rule explains if the attribute is exported in the standard library. Skip this if it is not. Example:
181+
This rule explains whether the attribute is exported in the standard library. Skip this section if it is not. Example:
182182
183183
----
184184
@@ -187,4 +187,4 @@ The `example` attribute is exported in the standard library prelude as [`core::p
187187
----
188188
189189
r[PARENT.example.foo]
190-
From here on, add rules explaining all the behaviors of the attribute. If the attribute is very simple, you can just have one rule called ".behavior" to explain its behavior. More complex attributes, such as those with multiple kinds of inputs or different modes should describe each as a separate rule.
190+
From here on, add rules explaining all the behaviors of the attribute. If the attribute is very simple, you can just have one rule called `.behavior` to explain its behavior. More complex attributes, such as those with multiple kinds of inputs or different modes, should describe each as a separate rule.

0 commit comments

Comments
 (0)