Skip to content

Commit 2c413c5

Browse files
authored
Rollup merge of rust-lang#92840 - hafeoz:master, r=ehuss
Fix some lints documentation Several lints documentation failed to show the output of the example (mostly due to `ignore` attribute): - [irrefutable_let_patterns](https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html#irrefutable-let-patterns) - [asm_sub_register](https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html#asm-sub-register) - [bad_asm_style](https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html#bad-asm-style) - [ineffective_unstable_trait_impl](https://doc.rust-lang.org/rustc/lints/listing/deny-by-default.html#ineffective-unstable-trait-impl) - duplicate_macro_attributes This pull request fixes these lints output so that they can be displayed properly.
2 parents 87f4baa + 7cc6a73 commit 2c413c5

File tree

1 file changed

+37
-5
lines changed

1 file changed

+37
-5
lines changed

compiler/rustc_lint_defs/src/builtin.rs

+37-5
Original file line numberDiff line numberDiff line change
@@ -1805,7 +1805,7 @@ declare_lint! {
18051805
///
18061806
/// ### Example
18071807
///
1808-
/// ```
1808+
/// ```rust
18091809
/// if let _ = 123 {
18101810
/// println!("always runs!");
18111811
/// }
@@ -2431,7 +2431,19 @@ declare_lint! {
24312431
/// }
24322432
/// ```
24332433
///
2434-
/// {{produces}}
2434+
/// This will produce:
2435+
///
2436+
/// ```text
2437+
/// warning: formatting may not be suitable for sub-register argument
2438+
/// --> src/main.rs:7:19
2439+
/// |
2440+
/// 7 | asm!("mov {0}, {0}", in(reg) 0i16);
2441+
/// | ^^^ ^^^ ---- for this argument
2442+
/// |
2443+
/// = note: `#[warn(asm_sub_register)]` on by default
2444+
/// = help: use the `x` modifier to have the register formatted as `ax`
2445+
/// = help: or use the `r` modifier to keep the default formatting of `rax`
2446+
/// ```
24352447
///
24362448
/// ### Explanation
24372449
///
@@ -2470,7 +2482,17 @@ declare_lint! {
24702482
/// }
24712483
/// ```
24722484
///
2473-
/// {{produces}}
2485+
/// This will produce:
2486+
///
2487+
/// ```text
2488+
/// warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead
2489+
/// --> src/main.rs:8:14
2490+
/// |
2491+
/// 8 | ".att_syntax",
2492+
/// | ^^^^^^^^^^^
2493+
/// |
2494+
/// = note: `#[warn(bad_asm_style)]` on by default
2495+
/// ```
24742496
///
24752497
/// ### Explanation
24762498
///
@@ -2788,7 +2810,7 @@ declare_lint! {
27882810
///
27892811
/// ### Example
27902812
///
2791-
/// ```compile_fail
2813+
/// ```rust,compile_fail
27922814
/// #![feature(staged_api)]
27932815
///
27942816
/// #[derive(Clone)]
@@ -3618,7 +3640,17 @@ declare_lint! {
36183640
/// fn foo() {}
36193641
/// ```
36203642
///
3621-
/// {{produces}}
3643+
/// This will produce:
3644+
///
3645+
/// ```text
3646+
/// warning: duplicated attribute
3647+
/// --> src/lib.rs:2:1
3648+
/// |
3649+
/// 2 | #[test]
3650+
/// | ^^^^^^^
3651+
/// |
3652+
/// = note: `#[warn(duplicate_macro_attributes)]` on by default
3653+
/// ```
36223654
///
36233655
/// ### Explanation
36243656
///

0 commit comments

Comments
 (0)