Skip to content

Commit 018fade

Browse files
committed
Reword attributes.diagnostics.deprecated.intro
This rewords the intro to be more general, as the details will be included in separate rules. This also moves the example into the intro.
1 parent 3f4ddcf commit 018fade

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/attributes/diagnostics.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,15 @@ r[attributes.diagnostics.deprecated]
303303
## The `deprecated` attribute
304304

305305
r[attributes.diagnostics.deprecated.intro]
306-
The *`deprecated` attribute* marks an item as deprecated. `rustc` will issue warnings on usage of `#[deprecated]` items. `rustdoc` will show item deprecation, including the `since` version and `note`, if available.
306+
The *`deprecated` [attribute][attributes]* marks an item as deprecated.
307+
308+
> [!EXAMPLE]
309+
> ```rust
310+
> #[deprecated(since = "5.2.0", note = "foo was rarely used. Users should instead use bar")]
311+
> pub fn foo() {}
312+
>
313+
> pub fn bar() {}
314+
> ```
307315
308316
r[attributes.diagnostics.deprecated.syntax]
309317
The `deprecated` attribute has several forms:
@@ -322,14 +330,8 @@ The `deprecated` attribute may be applied to any [item], [trait item], [enum var
322330
Tuple struct fields are ignored.
323331
-->
324332
325-
Here is an example:
326333
327-
```rust
328-
#[deprecated(since = "5.2.0", note = "foo was rarely used. Users should instead use bar")]
329-
pub fn foo() {}
330334
331-
pub fn bar() {}
332-
```
333335
334336
The [RFC][1270-deprecation.md] contains motivations and more details.
335337

0 commit comments

Comments
 (0)