From 7b74ded9a08a84bd64cf972a070b3a35f661d1ed Mon Sep 17 00:00:00 2001 From: hafeoz <95505675+hafeoz@users.noreply.github.com> Date: Thu, 13 Jan 2022 03:57:44 +0000 Subject: [PATCH 1/2] Fix lints documents --- compiler/rustc_lint/src/builtin.rs | 1 + compiler/rustc_lint_defs/src/builtin.rs | 42 ++++++++++++++++++++++--- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index c0384875a47..b613dfafbd6 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -3147,6 +3147,7 @@ declare_lint! { /// ### Example /// /// ```rust,compile_fail + /// # #![feature(asm)] /// use std::arch::asm; /// /// fn main() { diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 27a06943cbc..c2f6118227a 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -1805,7 +1805,7 @@ declare_lint! { /// /// ### Example /// - /// ``` + /// ```rust /// if let _ = 123 { /// println!("always runs!"); /// } @@ -2431,7 +2431,19 @@ declare_lint! { /// } /// ``` /// - /// {{produces}} + /// This will produce: + /// + /// ```text + /// warning: formatting may not be suitable for sub-register argument + /// --> src/main.rs:7:19 + /// | + /// 7 | asm!("mov {0}, {0}", in(reg) 0i16); + /// | ^^^ ^^^ ---- for this argument + /// | + /// = note: `#[warn(asm_sub_register)]` on by default + /// = help: use the `x` modifier to have the register formatted as `ax` + /// = help: or use the `r` modifier to keep the default formatting of `rax` + /// ``` /// /// ### Explanation /// @@ -2470,7 +2482,17 @@ declare_lint! { /// } /// ``` /// - /// {{produces}} + /// This will produce: + /// + /// ```text + /// warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead + /// --> src/main.rs:8:14 + /// | + /// 8 | ".att_syntax", + /// | ^^^^^^^^^^^ + /// | + /// = note: `#[warn(bad_asm_style)]` on by default + /// ``` /// /// ### Explanation /// @@ -2788,7 +2810,7 @@ declare_lint! { /// /// ### Example /// - /// ```compile_fail + /// ```rust,compile_fail /// #![feature(staged_api)] /// /// #[derive(Clone)] @@ -3618,7 +3640,17 @@ declare_lint! { /// fn foo() {} /// ``` /// - /// {{produces}} + /// This will produce: + /// + /// ```text + /// warning: duplicated attribute + /// --> src/lib.rs:2:1 + /// | + /// 2 | #[test] + /// | ^^^^^^^ + /// | + /// = note: `#[warn(duplicate_macro_attributes)]` on by default + /// ``` /// /// ### Explanation /// From 7cc6a739366c56f35c5c274366e53f0de850c349 Mon Sep 17 00:00:00 2001 From: hafeoz <95505675+hafeoz@users.noreply.github.com> Date: Thu, 13 Jan 2022 15:58:58 +0000 Subject: [PATCH 2/2] Remove `asm` feature from lints example --- compiler/rustc_lint/src/builtin.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index b613dfafbd6..c0384875a47 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -3147,7 +3147,6 @@ declare_lint! { /// ### Example /// /// ```rust,compile_fail - /// # #![feature(asm)] /// use std::arch::asm; /// /// fn main() {