diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index b5f09ff346a..681a76e26f0 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -975,10 +975,8 @@ declare_lint! { /// ### Example /// /// ```rust - /// #[no_mangle] - /// fn foo(t: T) { - /// - /// } + /// #[unsafe(no_mangle)] + /// fn foo(t: T) {} /// ``` /// /// {{produces}} diff --git a/compiler/rustc_lint/src/foreign_modules.rs b/compiler/rustc_lint/src/foreign_modules.rs index 636779fe9b4..49c34d0edcc 100644 --- a/compiler/rustc_lint/src/foreign_modules.rs +++ b/compiler/rustc_lint/src/foreign_modules.rs @@ -35,12 +35,12 @@ declare_lint! { /// /// ```rust /// mod m { - /// extern "C" { + /// unsafe extern "C" { /// fn foo(); /// } /// } /// - /// extern "C" { + /// unsafe extern "C" { /// fn foo(_: u32); /// } /// ``` diff --git a/compiler/rustc_lint/src/types.rs b/compiler/rustc_lint/src/types.rs index 68b1f435a4c..7e242a9f567 100644 --- a/compiler/rustc_lint/src/types.rs +++ b/compiler/rustc_lint/src/types.rs @@ -696,7 +696,7 @@ declare_lint! { /// ### Example /// /// ```rust - /// extern "C" { + /// unsafe extern "C" { /// static STATIC: String; /// } /// ``` diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 10bf4ec77ed..97850a2afc1 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -2780,7 +2780,7 @@ declare_lint! { /// /// ```rust /// enum Void {} - /// extern { + /// unsafe extern { /// static EXTERN: Void; /// } /// ``` @@ -4011,7 +4011,7 @@ declare_lint! { /// ```rust /// #![warn(ffi_unwind_calls)] /// - /// extern "C-unwind" { + /// unsafe extern "C-unwind" { /// fn foo(); /// } /// @@ -4755,7 +4755,7 @@ declare_lint! { /// /// ### Example /// - /// ```rust + /// ```rust,edition2021 /// #![warn(missing_unsafe_on_extern)] /// #![allow(dead_code)] /// @@ -4792,7 +4792,7 @@ declare_lint! { /// /// ### Example /// - /// ```rust + /// ```rust,edition2021 /// #![warn(unsafe_attr_outside_unsafe)] /// /// #[no_mangle]