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
There's been some editorial drift as we've revised the text for these
attributes. Let's align the ones that have been templatized with the
revised template.
Copy file name to clipboardExpand all lines: src/attributes/testing.md
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ The *`test` [attribute][attributes]* marks a function to be executed as a test.
24
24
> ```
25
25
26
26
r[attributes.testing.test.syntax]
27
-
The `test` attribute uses the [MetaWord] syntax and thus does not take any inputs.
27
+
The `test` attribute uses the [MetaWord] syntax.
28
28
29
29
r[attributes.testing.test.allowed-positions]
30
30
The `test` attribute may only be applied to [free functions] that are monomorphic, that take no arguments, and where the return type implements the [`Termination`] trait.
@@ -35,10 +35,10 @@ The `test` attribute may only be applied to [free functions] that are monomorphi
35
35
> * `Result<T, E> where T: Termination, E: Debug`
36
36
37
37
r[attributes.testing.test.duplicates]
38
-
Only the first instance of `test` on a function is honored.
38
+
Only the first use of `test` on a function has effect.
39
39
40
40
> [!NOTE]
41
-
> Subsequent `test` attributes are currently ignored and `rustc` warns about these.
41
+
> `rustc` lints against any use following the first. This may become an error in the future.
42
42
43
43
<!-- TODO: This is a minor lie. Currently rustc warns that duplicates are ignored, but it then generates multiple test entries with the same name. I would vote for rejecting this in the future. -->
44
44
@@ -92,7 +92,7 @@ The *`ignore` [attribute][attributes]* can be used with the [`test` attribute][a
92
92
> The `rustc` test harness supports the `--include-ignored` flag to force ignored tests to be run.
93
93
94
94
r[attributes.testing.ignore.syntax]
95
-
The `ignore` attribute uses either the [MetaWord] or [MetaNameValueStr] syntax.
95
+
The `ignore` attribute uses the [MetaWord] and [MetaNameValueStr] syntaxes.
96
96
97
97
r[attributes.testing.ignore.reason]
98
98
The [MetaNameValueStr] form of the `ignore` attribute provides a way to specify a reason why the test is ignored.
@@ -107,16 +107,16 @@ The [MetaNameValueStr] form of the `ignore` attribute provides a way to specify
107
107
> ```
108
108
109
109
r[attributes.testing.ignore.allowed-positions]
110
-
The `ignore` attribute may be applied to functions annotated with the `test` attribute.
110
+
The `ignore` attribute may only be applied to functions annotated with the `test` attribute.
111
111
112
112
> [!NOTE]
113
-
> `rustc` currently warns when `ignore` is used in some other situations. This may become an error in the future.
113
+
> `rustc` ignores use in other positions but lints against it. This may become an error in the future.
114
114
115
115
r[attributes.testing.ignore.duplicates]
116
-
Only the first instance of `ignore` on a function is honored.
116
+
Only the first use of `ignore` on a function has effect.
117
117
118
118
> [!NOTE]
119
-
> `rustc` currently ignores duplicate `ignore` attributes. This may become an error in the future.
119
+
> `rustc` lints against any use following the first. This may become an error in the future.
120
120
121
121
r[attributes.testing.ignore.behavior]
122
122
Ignored tests are still compiled when in test mode, but they are not executed.
@@ -138,7 +138,7 @@ The *`should_panic` [attribute][attributes]* causes a test to pass only if the [
138
138
> ```
139
139
140
140
r[attributes.testing.should_panic.syntax]
141
-
The `should_panic` attribute has one of the following forms:
The `should_panic` attribute may only be applied to functions annotated with the `test` attribute.
169
169
170
170
> [!NOTE]
171
-
> `rustc` currently accepts this attribute in other positions with a warning. This may become a hard error in the future.
171
+
> `rustc` ignores use in other positions but lints against it. This may become an error in the future.
172
172
173
173
r[attributes.testing.should_panic.duplicates]
174
-
Only the first instance of `should_panic` on a function is honored.
174
+
Only the first use of `should_panic` on a function has effect.
175
175
176
176
> [!NOTE]
177
-
> `rustc` currently ignores subsequent `should_panic` attributes and emits a future-compatibility warning. This may become a hard error in the future.
177
+
> `rustc` lints against any use following the first with a future-compatibility warning. This may become an error in the future.
178
178
179
179
r[attributes.testing.should_panic.expected]
180
180
When the [MetaNameValueStr] form or the [MetaListNameValueStr] form with the `expected` key is used, the given string must appear somewhere within the panic message for the test to pass.
Copy file name to clipboardExpand all lines: src/conditional-compilation.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -364,13 +364,13 @@ The syntax for the `cfg` attribute is:
364
364
```
365
365
366
366
r[cfg.attr.allowed-positions]
367
-
The `cfg` attribute is allowed anywhere attributes are allowed.
367
+
The `cfg` attribute may be used anywhere attributes are allowed.
368
368
369
369
r[cfg.attr.duplicates]
370
-
Multiple`cfg`attributes may be specified. The form to which the attribute is attached will not be included if any of the `cfg` predicates are false except as described in [cfg.attr.crate-level-attrs].
370
+
The`cfg`attribute may be used any number of times on a form. The form to which the attributes are attached will not be included if any of the `cfg` predicates are false except as described in [cfg.attr.crate-level-attrs].
371
371
372
372
r[cfg.attr.effect]
373
-
If the predicate is true, the form is rewritten to not have the `cfg`attribute on it. If the predicate is false, the form is removed from the source code.
373
+
If the predicates are true, the form is rewritten to not have the `cfg`attributes on it. If any predicate is false, the form is removed from the source code.
374
374
375
375
r[cfg.attr.crate-level-attrs]
376
376
When a crate-level `cfg` has a false predicate, the crate itself still exists. Any crate attributes preceding the `cfg` are kept, and any crate attributes following the `cfg` are removed as well as removing all of the following crate contents.
The `proc_macro_derive` attribute may only be applied to a `pub` function with the [Rust ABI][items.fn.extern] defined in the root of the crate with a type of `fn(TokenStream) -> TokenStream` where [`TokenStream`] comes from the [`proc_macro` crate]. The function may be `const` and may use `extern` to explicitly specify the Rust ABI, but it may not use any other [qualifiers][FunctionQualifiers] (e.g. it may not be `async` or `unsafe`).
187
187
188
188
r[macro.proc.derive.duplicates]
189
-
The `proc_macro_derive` attribute may be specified only once on a function.
189
+
The `proc_macro_derive` attribute may be used only once on a function.
190
190
191
191
r[macro.proc.derive.namespace]
192
192
The `proc_macro_derive` attribute publicly defines the derive macro in the [macro namespace] in the root of the crate.
0 commit comments