You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: reference-dev-guide/src/attributes.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
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.
4
4
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.
6
6
7
7
----
8
8
@@ -11,7 +11,7 @@ r[PARENT.example]
11
11
## The `example` attribute
12
12
13
13
r[PARENT.example.intro]
14
-
The *`example`[attribute][attributes]* ...give a highlevel description.
14
+
The *`example`[attribute][attributes]* ...give a high-level description.
15
15
16
16
> [!EXAMPLE]
17
17
> ```rust
@@ -22,7 +22,7 @@ The *`example` [attribute][attributes]* ...give a high level description.
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:
98
98
@@ -110,15 +110,15 @@ The `example` attribute is allowed anywhere attributes are allowed.
> `rustc` ignoresusein other positions but lints against it.This may become an error in the future.
117
117
118
118
----
119
119
120
120
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:
122
122
123
123
----
124
124
@@ -160,7 +160,7 @@ If the `example` attribute is used more than once on an item, then the combinati
160
160
----
161
161
162
162
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:
164
164
165
165
----
166
166
@@ -169,7 +169,7 @@ The `example` attribute may not be used with the [`foo`] attribute.
169
169
----
170
170
171
171
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:
173
173
174
174
----
175
175
@@ -178,7 +178,7 @@ The `example` attribute must be marked with [`unsafe`][attributes.safety] becaus
178
178
----
179
179
180
180
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 sectionif it is not.Example:
182
182
183
183
----
184
184
@@ -187,4 +187,4 @@ The `example` attribute is exported in the standard library prelude as [`core::p
187
187
----
188
188
189
189
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