diff --git a/Cargo.lock b/Cargo.lock
index bdfb51761760f..424f44e34f8e4 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4457,6 +4457,7 @@ dependencies = [
  "rustc_index",
  "rustc_infer",
  "rustc_lint",
+ "rustc_lint_defs",
  "rustc_macros",
  "rustc_middle",
  "rustc_serialize",
diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs
index e9fa33f656f31..5875fae595d68 100644
--- a/compiler/rustc_borrowck/src/type_check/mod.rs
+++ b/compiler/rustc_borrowck/src/type_check/mod.rs
@@ -2011,7 +2011,10 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
                         }
                     }
 
-                    CastKind::Pointer(PointerCast::UnsafeFnPointer) => {
+                    CastKind::Pointer(
+                        ptr_cast @ (PointerCast::UnsafeFnPointer
+                        | PointerCast::DeprecatedSafeFnPointer),
+                    ) => {
                         let fn_sig = op.ty(body, tcx).fn_sig(tcx);
 
                         // The type that we see in the fcx is like
@@ -2021,7 +2024,13 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
                         // and hence may contain unnormalized results.
                         let fn_sig = self.normalize(fn_sig, location);
 
-                        let ty_fn_ptr_from = tcx.safe_to_unsafe_fn_ty(fn_sig);
+                        let ty_fn_ptr_from = match ptr_cast {
+                            PointerCast::UnsafeFnPointer => tcx.safe_to_unsafe_fn_ty(fn_sig),
+                            PointerCast::DeprecatedSafeFnPointer => {
+                                tcx.unsafe_to_safe_fn_ty(fn_sig)
+                            }
+                            _ => unreachable!(),
+                        };
 
                         if let Err(terr) = self.eq_types(
                             *ty,
diff --git a/compiler/rustc_codegen_cranelift/src/base.rs b/compiler/rustc_codegen_cranelift/src/base.rs
index a9ff710c91ed6..1d29873b8d847 100644
--- a/compiler/rustc_codegen_cranelift/src/base.rs
+++ b/compiler/rustc_codegen_cranelift/src/base.rs
@@ -585,6 +585,11 @@ fn codegen_stmt<'tcx>(
                     ref operand,
                     to_ty,
                 )
+                | Rvalue::Cast(
+                    CastKind::Pointer(PointerCast::DeprecatedSafeFnPointer),
+                    ref operand,
+                    to_ty,
+                )
                 | Rvalue::Cast(
                     CastKind::Pointer(PointerCast::MutToConstPointer),
                     ref operand,
diff --git a/compiler/rustc_codegen_cranelift/src/bin/cg_clif_build_sysroot.rs b/compiler/rustc_codegen_cranelift/src/bin/cg_clif_build_sysroot.rs
index bde4d71b9a33c..d27c7b9c74109 100644
--- a/compiler/rustc_codegen_cranelift/src/bin/cg_clif_build_sysroot.rs
+++ b/compiler/rustc_codegen_cranelift/src/bin/cg_clif_build_sysroot.rs
@@ -55,7 +55,11 @@ impl rustc_driver::Callbacks for CraneliftPassesCallbacks {
 
 fn main() {
     rustc_driver::init_rustc_env_logger();
-    rustc_driver::install_ice_hook();
+    // SAFETY: in main(), no other threads could be reading or writing the environment
+    // FIXME(skippy) are there definitely zero threads here? other functions have been called
+    unsafe {
+        rustc_driver::install_ice_hook();
+    }
     let exit_code = rustc_driver::catch_with_exit_code(|| {
         let mut use_clif = false;
 
diff --git a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs
index fd29c9e281b92..e928818b04e90 100644
--- a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs
@@ -216,6 +216,10 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
                         // This is a no-op at the LLVM level.
                         operand.val
                     }
+                    mir::CastKind::Pointer(PointerCast::DeprecatedSafeFnPointer) => {
+                        // This is a no-op at the LLVM level.
+                        operand.val
+                    }
                     mir::CastKind::Pointer(PointerCast::Unsize) => {
                         assert!(bx.cx().is_backend_scalar_pair(cast));
                         let (lldata, llextra) = match operand.val {
diff --git a/compiler/rustc_const_eval/src/interpret/cast.rs b/compiler/rustc_const_eval/src/interpret/cast.rs
index a244b79ed0754..b2892afe3da80 100644
--- a/compiler/rustc_const_eval/src/interpret/cast.rs
+++ b/compiler/rustc_const_eval/src/interpret/cast.rs
@@ -74,6 +74,17 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
                 }
             }
 
+            Pointer(PointerCast::DeprecatedSafeFnPointer) => {
+                let src = self.read_immediate(src)?;
+                match cast_ty.kind() {
+                    ty::FnPtr(_) => {
+                        // No change to value
+                        self.write_immediate(*src, dest)?;
+                    }
+                    _ => span_bug!(self.cur_span(), "unsafe fn to fn cast on {:?}", cast_ty),
+                }
+            }
+
             Pointer(PointerCast::ClosureFnPointer(_)) => {
                 // The src operand does not matter, just its type
                 match *src.layout.ty.kind() {
diff --git a/compiler/rustc_const_eval/src/transform/check_consts/check.rs b/compiler/rustc_const_eval/src/transform/check_consts/check.rs
index e203c79030d20..b5d689027d7c9 100644
--- a/compiler/rustc_const_eval/src/transform/check_consts/check.rs
+++ b/compiler/rustc_const_eval/src/transform/check_consts/check.rs
@@ -545,6 +545,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
             Rvalue::Cast(
                 CastKind::Pointer(
                     PointerCast::UnsafeFnPointer
+                    | PointerCast::DeprecatedSafeFnPointer
                     | PointerCast::ClosureFnPointer(_)
                     | PointerCast::ReifyFnPointer,
                 ),
diff --git a/compiler/rustc_driver/src/lib.rs b/compiler/rustc_driver/src/lib.rs
index febdd0ed74675..62dc1ec62d89b 100644
--- a/compiler/rustc_driver/src/lib.rs
+++ b/compiler/rustc_driver/src/lib.rs
@@ -1235,7 +1235,11 @@ pub fn report_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {
 /// Installs a panic hook that will print the ICE message on unexpected panics.
 ///
 /// A custom rustc driver can skip calling this to set up a custom ICE hook.
-pub fn install_ice_hook() {
+///
+/// # Safety
+///
+/// Must not be called when any other thread could be reading or writing the environment.
+pub unsafe fn install_ice_hook() {
     // If the user has not explicitly overridden "RUST_BACKTRACE", then produce
     // full backtraces. When a compiler ICE happens, we want to gather
     // as much information as possible to present in the issue opened
@@ -1320,7 +1324,11 @@ pub fn main() -> ! {
     init_rustc_env_logger();
     signal_handler::install();
     let mut callbacks = TimePassesCallbacks::default();
-    install_ice_hook();
+    // SAFETY: in main(), no other threads could be reading or writing the environment
+    // FIXME(skippy) are there definitely zero threads here? other functions have been called
+    unsafe {
+        install_ice_hook();
+    }
     let exit_code = catch_with_exit_code(|| {
         let args = env::args_os()
             .enumerate()
diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs
index 7c53f839a92e4..ee05695057146 100644
--- a/compiler/rustc_feature/src/builtin_attrs.rs
+++ b/compiler/rustc_feature/src/builtin_attrs.rs
@@ -454,7 +454,13 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
     ),
     // lang-team MCP 147
     gated!(
-        deprecated_safe, Normal, template!(List: r#"since = "version", note = "...""#), ErrorFollowing,
+        deprecated_safe, Normal,
+        template!(
+            Word,
+            List: r#"/*opt*/ since = "version", /*opt*/ note = "reason", /*opt*/ unsafe_edition = "edition""#,
+            NameValueStr: "reason"
+        ),
+        ErrorFollowing,
         experimental!(deprecated_safe),
     ),
 
diff --git a/compiler/rustc_feature/src/tests.rs b/compiler/rustc_feature/src/tests.rs
index 50433e44b1350..4ad9e29b4d992 100644
--- a/compiler/rustc_feature/src/tests.rs
+++ b/compiler/rustc_feature/src/tests.rs
@@ -3,6 +3,8 @@ use super::UnstableFeatures;
 #[test]
 fn rustc_bootstrap_parsing() {
     let is_bootstrap = |env, krate| {
+        // FIXME(skippy) there's no fix for deprecated_safe until tests can be run single threaded
+        #[cfg_attr(not(bootstrap), allow(deprecated_safe))]
         std::env::set_var("RUSTC_BOOTSTRAP", env);
         matches!(UnstableFeatures::from_environment(krate), UnstableFeatures::Cheat)
     };
diff --git a/compiler/rustc_infer/src/infer/at.rs b/compiler/rustc_infer/src/infer/at.rs
index 09b02ba74a8de..a51410d156ee1 100644
--- a/compiler/rustc_infer/src/infer/at.rs
+++ b/compiler/rustc_infer/src/infer/at.rs
@@ -77,6 +77,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
             err_count_on_creation: self.err_count_on_creation,
             in_snapshot: self.in_snapshot.clone(),
             universe: self.universe.clone(),
+            query_mode: self.query_mode.clone(),
         }
     }
 }
diff --git a/compiler/rustc_infer/src/infer/mod.rs b/compiler/rustc_infer/src/infer/mod.rs
index 2524bd78355a1..e09aa18596d06 100644
--- a/compiler/rustc_infer/src/infer/mod.rs
+++ b/compiler/rustc_infer/src/infer/mod.rs
@@ -354,6 +354,30 @@ pub struct InferCtxt<'a, 'tcx> {
     /// when we enter into a higher-ranked (`for<..>`) type or trait
     /// bound.
     universe: Cell<ty::UniverseIndex>,
+
+    // FIXME(skippy) specifically needs reviewer feedback
+    // FIXME(skippy) this is added so that i can detect when enter_with_canonical()
+    //               is used, as a way to know that obligations will be coming in
+    //               with bad cause spans that can't be used
+    // FIXME(skippy) what i really want (i think) is something like
+    //               if !during_borrowck && !during_codegen
+    /// The mode that trait queries run in, which informs our error handling
+    /// policy. In essence, canonicalized queries need their errors propagated
+    /// rather than immediately reported because we do not have accurate spans.
+    pub query_mode: TraitQueryMode,
+}
+
+/// The mode that trait queries run in.
+#[derive(Copy, Clone, PartialEq, Eq, Debug)]
+pub enum TraitQueryMode {
+    /// Standard/un-canonicalized queries get accurate
+    /// spans etc. passed in and hence can do reasonable
+    /// error reporting on their own.
+    Standard,
+    /// Canonicalized queries get dummy spans and hence
+    /// must generally propagate errors to
+    /// pre-canonicalization callsites.
+    Canonical,
 }
 
 /// See the `error_reporting` module for more details.
@@ -615,14 +639,26 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
     where
         T: TypeFoldable<'tcx>,
     {
-        self.enter(|infcx| {
-            let (value, subst) =
-                infcx.instantiate_canonical_with_fresh_inference_vars(span, canonical);
-            f(infcx, value, subst)
-        })
+        self.enter_with_query_mode(
+            |infcx| {
+                let (value, subst) =
+                    infcx.instantiate_canonical_with_fresh_inference_vars(span, canonical);
+                f(infcx, value, subst)
+            },
+            TraitQueryMode::Canonical,
+        )
     }
 
     pub fn enter<R>(&mut self, f: impl for<'a> FnOnce(InferCtxt<'a, 'tcx>) -> R) -> R {
+        self.enter_with_query_mode(f, TraitQueryMode::Standard)
+    }
+
+    // FIXME(skippy) specifically needs reviewer feedback (see query_mode field)
+    fn enter_with_query_mode<R>(
+        &mut self,
+        f: impl for<'a> FnOnce(InferCtxt<'a, 'tcx>) -> R,
+        query_mode: TraitQueryMode,
+    ) -> R {
         let InferCtxtBuilder { tcx, defining_use_anchor, ref fresh_typeck_results } = *self;
         let in_progress_typeck_results = fresh_typeck_results.as_ref();
         f(InferCtxt {
@@ -640,6 +676,7 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
             in_snapshot: Cell::new(false),
             skip_leak_check: Cell::new(false),
             universe: Cell::new(ty::UniverseIndex::ROOT),
+            query_mode,
         })
     }
 }
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs
index eac6a33cf2298..d3f49421fc7af 100644
--- a/compiler/rustc_interface/src/passes.rs
+++ b/compiler/rustc_interface/src/passes.rs
@@ -315,13 +315,17 @@ pub fn configure_and_expand(
                     new_path.push(path);
                 }
             }
-            env::set_var(
-                "PATH",
-                &env::join_paths(
-                    new_path.iter().filter(|p| env::join_paths(iter::once(p)).is_ok()),
-                )
-                .unwrap(),
-            );
+            // SAFETY: we're in a cfg!(windows) section, set_var is always sound
+            #[cfg_attr(bootstrap, allow(unused_unsafe))]
+            unsafe {
+                env::set_var(
+                    "PATH",
+                    &env::join_paths(
+                        new_path.iter().filter(|p| env::join_paths(iter::once(p)).is_ok()),
+                    )
+                    .unwrap(),
+                );
+            }
         }
 
         // Create the config for macro expansion
@@ -367,7 +371,11 @@ pub fn configure_and_expand(
             resolver.lint_buffer().buffer_lint(lint, node_id, span, msg);
         }
         if cfg!(windows) {
-            env::set_var("PATH", &old_path);
+            // SAFETY: we're in a cfg!(windows) section, set_var is always sound
+            #[cfg_attr(bootstrap, allow(unused_unsafe))]
+            unsafe {
+                env::set_var("PATH", &old_path);
+            }
         }
 
         if recursion_limit_hit {
diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs
index 5704c6ed3b25d..6a705b30bf655 100644
--- a/compiler/rustc_lint_defs/src/builtin.rs
+++ b/compiler/rustc_lint_defs/src/builtin.rs
@@ -3129,6 +3129,8 @@ declare_lint_pass! {
         UNEXPECTED_CFGS,
         DEPRECATED_WHERE_CLAUSE_LOCATION,
         TEST_UNSTABLE_LINT,
+        DEPRECATED_SAFE,
+        DEPRECATED_SAFE_IN_FUTURE,
     ]
 }
 
@@ -3794,3 +3796,62 @@ declare_lint! {
     "this unstable lint is only for testing",
     @feature_gate = sym::test_unstable_lint;
 }
+
+declare_lint! {
+    /// The `deprecated_safe` lint detects safe, unsound usage of items that are now marked ```[unsafe]```,
+    /// with safe usage being deprecated.
+    ///
+    /// ### Example
+    ///
+    /// ```rust
+    /// #![feature(deprecated_safe)]
+    ///
+    /// #[deprecated_safe(since = "1.61.0", note = "reason")]
+    /// unsafe fn previously_safe_function() {}
+    ///
+    /// fn main() {
+    ///     previously_safe_function();
+    /// }
+    /// ```
+    ///
+    /// {{produces}}
+    ///
+    /// ### Explanation
+    ///
+    /// FIXME(skippy) broken link: [`deprecated_safe` attribute]
+    /// Items may be marked "deprecated_safe" with the [`deprecated_safe` attribute] to
+    /// indicate that they should no longer be used. Usually the attribute
+    /// should include a note on what to use instead, or check the
+    /// documentation.
+    ///
+    /// [`deprecated_safe` attribute]: https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-deprecated_safe-attribute
+    /// [`unsafe fn`]: https://doc.rust-lang.org/reference/unsafe-functions.html
+    /// [`unsafe` trait]: https://doc.rust-lang.org/reference/items/traits.html#unsafe-traits
+    /// [`unsafe` block]: https://doc.rust-lang.org/reference/expressions/block-expr.html#unsafe-blocks
+    /// [unsafe]: https://doc.rust-lang.org/reference/unsafety.html
+    pub DEPRECATED_SAFE,
+    Warn,
+    "detects unsound use of items that are now marked unsafe, when safe use is deprecated",
+    report_in_external_macro
+    // FIXME(skippy) use future_incompatible?
+    /*
+    @future_incompatible = FutureIncompatibleInfo {
+        reference: "issue #94978 <https://github.com/rust-lang/rust/issues/94978>",
+    };
+    */
+}
+
+declare_lint! {
+    /// The `deprecated_safe_in_future` lint is internal to rustc and should not be
+    /// used by user code.
+    ///
+    /// This lint is only enabled in the standard library. It works with the
+    /// use of `#[deprecated_safe]` with a `since` field of a version in the
+    /// future. This allows something to be marked as deprecated_safe in a future
+    /// version, and then this lint will ensure that the item is no longer
+    /// used as safe in the standard library.
+    pub DEPRECATED_SAFE_IN_FUTURE,
+    Allow,
+    "detects use of items that will be deprecated_safe in a future version",
+    report_in_external_macro
+}
diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs
index ac758c15cca78..73066460fcd40 100644
--- a/compiler/rustc_llvm/build.rs
+++ b/compiler/rustc_llvm/build.rs
@@ -22,7 +22,8 @@ fn detect_llvm_link() -> (&'static str, &'static str) {
 // the one we want to use. As such, we restore the environment to what bootstrap saw. This isn't
 // perfect -- we might actually want to see something from Cargo's added library paths -- but
 // for now it works.
-fn restore_library_path() {
+// SAFETY: must not be called when any other thread could be reading or writing the environment
+unsafe fn restore_library_path() {
     let key = tracked_env_var_os("REAL_LIBRARY_PATH_VAR").expect("REAL_LIBRARY_PATH_VAR");
     if let Some(env) = tracked_env_var_os("REAL_LIBRARY_PATH") {
         env::set_var(&key, &env);
@@ -81,7 +82,10 @@ fn main() {
         return;
     }
 
-    restore_library_path();
+    // SAFETY: in main(), no other threads could be reading or writing the environment
+    unsafe {
+        restore_library_path();
+    }
 
     let target = env::var("TARGET").expect("TARGET was not set");
     let llvm_config =
diff --git a/compiler/rustc_middle/src/middle/stability.rs b/compiler/rustc_middle/src/middle/stability.rs
index fd6e241346db8..bf602919ebc1f 100644
--- a/compiler/rustc_middle/src/middle/stability.rs
+++ b/compiler/rustc_middle/src/middle/stability.rs
@@ -4,23 +4,27 @@
 pub use self::StabilityLevel::*;
 
 use crate::ty::{self, DefIdTree, TyCtxt};
-use rustc_ast::NodeId;
+use rustc_ast::{Attribute, MetaItem, MetaItemKind, NestedMetaItem, NodeId};
 use rustc_attr::{self as attr, ConstStability, Deprecation, Stability};
 use rustc_data_structures::fx::FxHashMap;
-use rustc_errors::{Applicability, Diagnostic};
+use rustc_errors::{struct_span_err, Applicability, Diagnostic};
 use rustc_feature::GateIssue;
 use rustc_hir as hir;
 use rustc_hir::def::DefKind;
 use rustc_hir::def_id::{DefId, LocalDefId, CRATE_DEF_INDEX};
 use rustc_hir::{self, HirId};
 use rustc_middle::ty::print::with_no_trimmed_paths;
-use rustc_session::lint::builtin::{DEPRECATED, DEPRECATED_IN_FUTURE, SOFT_UNSTABLE};
+use rustc_session::lint::builtin::{
+    DEPRECATED, DEPRECATED_IN_FUTURE, DEPRECATED_SAFE, DEPRECATED_SAFE_IN_FUTURE, SOFT_UNSTABLE,
+};
 use rustc_session::lint::{BuiltinLintDiagnostics, Level, Lint, LintBuffer};
 use rustc_session::parse::feature_err_issue;
 use rustc_session::Session;
+use rustc_span::edition::Edition;
 use rustc_span::symbol::{sym, Symbol};
 use rustc_span::Span;
 use std::num::NonZeroU32;
+use std::str::FromStr;
 
 #[derive(PartialEq, Clone, Copy, Debug)]
 pub enum StabilityLevel {
@@ -109,20 +113,20 @@ pub fn report_unstable(
 /// Checks whether an item marked with `deprecated(since="X")` is currently
 /// deprecated (i.e., whether X is not greater than the current rustc version).
 pub fn deprecation_in_effect(depr: &Deprecation) -> bool {
-    let is_since_rustc_version = depr.is_since_rustc_version;
-    let since = depr.since.as_ref().map(Symbol::as_str);
+    deprecation_since_in_effect(depr.is_since_rustc_version, depr.since)
+}
 
+fn deprecation_since_in_effect(is_since_rustc_version: bool, since: Option<Symbol>) -> bool {
     fn parse_version(ver: &str) -> Vec<u32> {
         // We ignore non-integer components of the version (e.g., "nightly").
         ver.split(|c| c == '.' || c == '-').flat_map(|s| s.parse()).collect()
     }
-
     if !is_since_rustc_version {
-        // The `since` field doesn't have semantic purpose in the stable `deprecated`
-        // attribute, only in `rustc_deprecated`.
+        // The `since` field only has semantic purpose in libstd usages of
+        // the `deprecated`/`deprecated_safe` attributes.
         return true;
     }
-
+    let since = since.as_ref().map(Symbol::as_str);
     if let Some(since) = since {
         if since == "TBD" {
             return false;
@@ -132,14 +136,13 @@ pub fn deprecation_in_effect(depr: &Deprecation) -> bool {
             let since: Vec<u32> = parse_version(&since);
             let rustc: Vec<u32> = parse_version(rustc);
             // We simply treat invalid `since` attributes as relating to a previous
-            // Rust version, thus always displaying the warning.
+            // Rust version, thus always being in effect.
             if since.len() != 3 {
                 return true;
             }
             return since <= rustc;
         }
     };
-
     // Assume deprecation is in effect if "since" field is missing
     // or if we can't determine the current Rust version.
     true
@@ -247,6 +250,362 @@ fn late_report_deprecation(
     });
 }
 
+// FIXME(skippy) specifically needs reviewer feedback
+// FIXME(skippy) is stability::* the right place for all this stuff?
+#[derive(Copy, Debug, Clone)]
+pub struct DeprecationAsSafe {
+    pub since: Option<Symbol>,
+    /// The note to issue a reason.
+    pub note: Option<Symbol>,
+
+    /// The edition where the item is treated as fully unsafe with
+    /// safe usage erroring instead of emitting a deprecated_safe lint
+    pub unsafe_edition: Option<Edition>,
+
+    /// Whether to treat the since attribute as being a Rust version identifier
+    /// (rather than an opaque string).
+    pub is_since_rustc_version: bool,
+}
+
+pub enum DeprecationAsSafeKind {
+    FnCall { unsafe_op_in_unsafe_fn_allowed: bool },
+    FnPointerCoercion,
+    FnTraitCoercion,
+    TraitImpl,
+    TraitFnImpl,
+}
+
+#[derive(Clone, Copy, PartialEq)]
+pub enum DeprecationAsSafeState {
+    None,
+    InEffect { in_future: bool },
+}
+
+impl DeprecationAsSafeState {
+    pub fn is_in_effect(&self) -> bool {
+        matches!(self, DeprecationAsSafeState::InEffect { .. })
+    }
+
+    pub fn is_in_effect_in_future(&self) -> bool {
+        matches!(self, DeprecationAsSafeState::InEffect { in_future: true, .. })
+    }
+}
+
+// check whether this item should be treated as an unsafe item marked with #[deprecated_safe]
+// - in stable usage the item will always be marked unsafe
+// - in unstable usage the item will not be marked unsafe, but it will behave as if it is
+//   within libstd
+pub fn check_deprecation_as_safe(
+    tcx: TyCtxt<'_>,
+    unsafety: hir::Unsafety,
+    def_id: DefId,
+    span: Span,
+) -> DeprecationAsSafeState {
+    // #[deprecated_safe] is unstable, ignore it completely on stable rust
+    if !tcx.sess.is_nightly_build() {
+        return DeprecationAsSafeState::None;
+    }
+    // if the item isn't unsafe yet and we're not within libstd then return early
+    // the attribute can't be in effect so no need to look it up
+    else if unsafety == hir::Unsafety::Normal && !tcx.features().staged_api {
+        return DeprecationAsSafeState::None;
+    }
+
+    // look up the atttribute
+    let Some(attr) = tcx.get_attrs(def_id).iter().find(|x| x.has_name(sym::deprecated_safe)) else {
+        return DeprecationAsSafeState::None;
+    };
+    let Some(depr_as_safe) = parse_deprecation_as_safe(tcx, def_id, attr) else {
+        bug!("invalid #[deprecated_safe] attribute during reporting");
+    };
+
+    let in_effect = deprecation_as_safe_in_effect(&depr_as_safe);
+    let in_future = tcx.features().staged_api && !in_effect;
+
+    // if the `unsafe_edition` has been reached, #[deprecated_safe] ceases to exist
+    // and the function/trait behaves fully unsafe with no escape hatch
+    // note: `unsafe_edition` is only checked once the ```since``` version is in effect
+    if in_effect && let Some(unsafe_edition) = depr_as_safe.unsafe_edition
+        && span.edition() >= unsafe_edition
+    {
+        return DeprecationAsSafeState::None;
+    }
+
+    // if #[deprecated_safe] isn't in effect yet, must treat the function/trait as if it is still safe
+    // but always consider #[deprecated_safe] in effect within libstd itself
+    if in_effect || in_future {
+        return DeprecationAsSafeState::InEffect { in_future };
+    }
+
+    DeprecationAsSafeState::None
+}
+
+pub fn parse_deprecation_as_safe(
+    tcx: TyCtxt<'_>,
+    def_id: DefId,
+    attr: &Attribute,
+) -> Option<DeprecationAsSafe> {
+    let Some(meta_kind) = attr.meta_kind() else {
+        return None;
+    };
+
+    let is_rustc = tcx.features().staged_api || tcx.lookup_stability(def_id).is_some();
+    let mut since = None;
+    let mut note = None;
+    let mut unsafe_edition = None;
+
+    match &meta_kind {
+        MetaItemKind::Word => {}
+        MetaItemKind::NameValue(..) => note = attr.value_str(),
+        MetaItemKind::List(list) => {
+            let get = |meta: &MetaItem, item: &mut Option<Symbol>| {
+                if item.is_some() {
+                    struct_span_err!(
+                        tcx.sess,
+                        attr.span,
+                        E0538,
+                        "multiple '{}' items",
+                        &meta.name_or_empty()
+                    )
+                    .emit();
+                    return false;
+                }
+                if let Some(v) = meta.value_str() {
+                    *item = Some(v);
+                    true
+                } else {
+                    if let Some(lit) = meta.name_value_literal() {
+                        struct_span_err!(
+                            tcx.sess,
+                            lit.span,
+                            E0565,
+                            "literal in `deprecated_safe` value must be a string",
+                        )
+                        .emit();
+                    } else {
+                        struct_span_err!(
+                            tcx.sess,
+                            meta.span,
+                            E0551,
+                            "incorrect meta item '{}'",
+                            meta.name_or_empty()
+                        )
+                        .emit();
+                    }
+
+                    false
+                }
+            };
+
+            for meta in list {
+                match meta {
+                    NestedMetaItem::MetaItem(mi) => match mi.name_or_empty() {
+                        sym::since => {
+                            if !get(mi, &mut since) {
+                                return None;
+                            }
+                        }
+                        sym::note => {
+                            if !get(mi, &mut note) {
+                                return None;
+                            }
+                        }
+                        sym::unsafe_edition => {
+                            if !get(mi, &mut unsafe_edition) {
+                                return None;
+                            }
+                        }
+                        _ => {
+                            struct_span_err!(
+                                tcx.sess,
+                                mi.span,
+                                E0541,
+                                "unknown meta item '{}'",
+                                mi.name_or_empty()
+                            )
+                            .emit();
+                            return None;
+                        }
+                    },
+                    NestedMetaItem::Literal(lit) => {
+                        struct_span_err!(
+                            tcx.sess,
+                            lit.span,
+                            E0565,
+                            "item in `deprecated_safe` must be a key/value pair",
+                        )
+                        .emit();
+                        return None;
+                    }
+                }
+            }
+        }
+    }
+
+    if is_rustc {
+        if since.is_none() {
+            struct_span_err!(
+                tcx.sess,
+                attr.span,
+                // FIXME(skippy) wrong error code, need to create a new one
+                E0542,
+                "missing 'since'"
+            )
+            .emit();
+            return None;
+        }
+
+        if note.is_none() {
+            struct_span_err!(
+                tcx.sess,
+                attr.span,
+                // FIXME(skippy) wrong error code, need to create a new one
+                E0543,
+                "missing 'note'"
+            )
+            .emit();
+            return None;
+        }
+    } else {
+        if unsafe_edition.is_some() {
+            struct_span_err!(
+                tcx.sess,
+                attr.span,
+                // FIXME(skippy) wrong error code, need to create a new one
+                E0543,
+                "'unsafe_edition' is invalid outside of rustc"
+            )
+            .emit();
+            return None;
+        }
+    }
+
+    let mut unsafe_edition_parsed = None;
+    if let Some(unsafe_edition) = unsafe_edition {
+        if let Ok(unsafe_edition) = Edition::from_str(unsafe_edition.as_str()) {
+            unsafe_edition_parsed = Some(unsafe_edition);
+        } else {
+            struct_span_err!(
+                tcx.sess,
+                attr.span,
+                // FIXME(skippy) wrong error code, need to create a new one
+                E0543,
+                "invalid 'unsafe_edition' specified"
+            )
+            .emit();
+            return None;
+        }
+    }
+
+    Some(DeprecationAsSafe {
+        since,
+        note,
+        unsafe_edition: unsafe_edition_parsed,
+        is_since_rustc_version: is_rustc,
+    })
+}
+
+/// Checks whether an item marked with `deprecated_safe(since="X")` is currently
+/// deprecated as safe (i.e., whether X is not greater than the current rustc version).
+pub fn deprecation_as_safe_in_effect(depr: &DeprecationAsSafe) -> bool {
+    deprecation_since_in_effect(depr.is_since_rustc_version, depr.since)
+}
+
+pub fn report_deprecation_as_safe<'tcx>(
+    tcx: TyCtxt<'tcx>,
+    kind: DeprecationAsSafeKind,
+    def_id: DefId,
+    lint_root: HirId,
+    span: Span,
+) {
+    let def_path = with_no_trimmed_paths!(tcx.def_path_str(def_id));
+    let def_kind = tcx.def_kind(def_id).descr(def_id);
+
+    // look up the atttribute
+    let Some(attr) = tcx.get_attrs(def_id).iter().find(|x| x.has_name(sym::deprecated_safe)) else {
+        bug!("missing #[deprecated_safe] attribute during reporting");
+    };
+    let Some(depr_as_safe) = parse_deprecation_as_safe(tcx, def_id, attr) else {
+        bug!("invalid #[deprecated_safe] attribute during reporting");
+    };
+
+    let depr_as_safe_in_effect = deprecation_as_safe_in_effect(&depr_as_safe);
+
+    let (message, span_label) = match kind {
+        DeprecationAsSafeKind::FnCall { unsafe_op_in_unsafe_fn_allowed } => {
+            let fn_sugg = if unsafe_op_in_unsafe_fn_allowed { " function or" } else { "" };
+            (
+                format!(
+                    "use of {} `{}` without an unsafe{} block has been deprecated as it is now an unsafe {}",
+                    def_kind, def_path, fn_sugg, def_kind
+                ),
+                Some("call to unsafe function"),
+            )
+        }
+        DeprecationAsSafeKind::FnPointerCoercion => (
+            format!(
+                "use of {} `{}` as a normal fn pointer has been deprecated as it is now an unsafe {}",
+                def_kind, def_path, def_kind
+            ),
+            Some("expected normal fn pointer, found unsafe fn pointer"),
+        ),
+        DeprecationAsSafeKind::FnTraitCoercion => (
+            format!(
+                "use of {} `{}` as a closure has been deprecated as it is now an unsafe {}",
+                def_kind, def_path, def_kind
+            ),
+            None,
+        ),
+        DeprecationAsSafeKind::TraitImpl => (
+            format!(
+                "use of {} `{}` without an `unsafe impl` declaration has been deprecated as it is now an unsafe {}",
+                def_kind, def_path, def_kind
+            ),
+            None,
+        ),
+        DeprecationAsSafeKind::TraitFnImpl => (
+            format!(
+                "use of {} `{}` without an `unsafe fn` declaration has been deprecated as it is now an unsafe {}",
+                def_kind, def_path, def_kind
+            ),
+            None,
+        ),
+    };
+
+    tcx.struct_span_lint_hir(
+        if depr_as_safe_in_effect { DEPRECATED_SAFE } else { DEPRECATED_SAFE_IN_FUTURE },
+        lint_root,
+        span,
+        |lint| {
+            let mut diag = lint.build(&message);
+            if let Some(span_label) = span_label {
+                diag.span_label(span, span_label);
+            }
+
+            let since_message = if let Some(since) = depr_as_safe.since {
+                format!(" since {}", since)
+            } else {
+                "".to_owned()
+            };
+            diag.note(&format!(
+                "this {} was previously not marked unsafe, but has been marked unsafe{}",
+                def_kind, since_message,
+            ));
+
+            diag.note(&format!(
+                "consult the {}'s documentation for information on how to avoid undefined behavior",
+                def_kind
+            ));
+
+            if let Some(note) = depr_as_safe.note {
+                diag.note(note.as_str());
+            }
+
+            diag.emit();
+        },
+    );
+}
+
 /// Result of `TyCtxt::eval_stability`.
 pub enum EvalResult {
     /// We can use the item because it is stable or we provided the
diff --git a/compiler/rustc_middle/src/mir/query.rs b/compiler/rustc_middle/src/mir/query.rs
index cee510a42413a..22496edd98cbc 100644
--- a/compiler/rustc_middle/src/mir/query.rs
+++ b/compiler/rustc_middle/src/mir/query.rs
@@ -25,6 +25,9 @@ pub enum UnsafetyViolationKind {
     /// Unsafe operation in an `unsafe fn` but outside an `unsafe` block.
     /// Has to be handled as a lint for backwards compatibility.
     UnsafeFn,
+    /// Unsafe operation that was previously marked safe but has been deprecated as such.
+    /// Has to be handled as a lint for backwards compatibility.
+    DeprecatedSafe { depr_as_safe: DefId },
 }
 
 #[derive(Copy, Clone, PartialEq, TyEncodable, TyDecodable, HashStable, Debug)]
diff --git a/compiler/rustc_middle/src/traits/select.rs b/compiler/rustc_middle/src/traits/select.rs
index ffa70cddbd59c..3eb33e7df2263 100644
--- a/compiler/rustc_middle/src/traits/select.rs
+++ b/compiler/rustc_middle/src/traits/select.rs
@@ -130,6 +130,10 @@ pub enum SelectionCandidate<'tcx> {
     /// types generated for a fn pointer type (e.g., `fn(int) -> int`)
     FnPointerCandidate {
         is_const: bool,
+        // if a #[deprecated_safe] fn() is being used as a closure, this points
+        // to the FnDef of that fn(). a deprecated_safe lint must be emitted
+        // if this candidate is used
+        depr_as_safe: Option<DefId>,
     },
 
     /// Builtin implementation of `DiscriminantKind`.
@@ -152,7 +156,12 @@ pub enum SelectionCandidate<'tcx> {
 
     BuiltinObjectCandidate,
 
-    BuiltinUnsizeCandidate,
+    BuiltinUnsizeCandidate {
+        // if a #[deprecated_safe] fn() is being used as a closure, this points
+        // to the FnDef of that fn(). a deprecated_safe lint must be emitted
+        // if this candidate is used
+        depr_as_safe: Option<DefId>,
+    },
 
     /// Implementation of `const Destruct`, optionally from a custom `impl const Drop`.
     ConstDestructCandidate(Option<DefId>),
diff --git a/compiler/rustc_middle/src/ty/adjustment.rs b/compiler/rustc_middle/src/ty/adjustment.rs
index 2676b7ab521d8..2476c07b9ec0e 100644
--- a/compiler/rustc_middle/src/ty/adjustment.rs
+++ b/compiler/rustc_middle/src/ty/adjustment.rs
@@ -14,6 +14,10 @@ pub enum PointerCast {
     /// Go from a safe fn pointer to an unsafe fn pointer.
     UnsafeFnPointer,
 
+    /// Go from an unsafe fn pointer to a safe fn pointer.
+    /// This is unsound, but used for backwards compatibility by `#[deprecated_safe]`.
+    DeprecatedSafeFnPointer,
+
     /// Go from a non-capturing closure to an fn pointer or an unsafe fn pointer.
     /// It cannot convert a closure that requires unsafe.
     ClosureFnPointer(hir::Unsafety),
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index 6ca8f8b1309fa..15b157637dc44 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
@@ -2186,13 +2186,21 @@ slice_interners!(
 
 impl<'tcx> TyCtxt<'tcx> {
     /// Given a `fn` type, returns an equivalent `unsafe fn` type;
-    /// that is, a `fn` type that is equivalent in every way for being
+    /// that is, a `fn` type that is equivalent in every way except for being
     /// unsafe.
     pub fn safe_to_unsafe_fn_ty(self, sig: PolyFnSig<'tcx>) -> Ty<'tcx> {
         assert_eq!(sig.unsafety(), hir::Unsafety::Normal);
         self.mk_fn_ptr(sig.map_bound(|sig| ty::FnSig { unsafety: hir::Unsafety::Unsafe, ..sig }))
     }
 
+    /// Given a `unsafe fn` type, returns an equivalent `fn` type;
+    /// that is, a `fn` type that is equivalent in every way except for being
+    /// safe. This is unsound, but used for backwards compatibility by `#[deprecated_safe]`.
+    pub fn unsafe_to_safe_fn_ty(self, sig: PolyFnSig<'tcx>) -> Ty<'tcx> {
+        assert_eq!(sig.unsafety(), hir::Unsafety::Unsafe);
+        self.mk_fn_ptr(sig.map_bound(|sig| ty::FnSig { unsafety: hir::Unsafety::Normal, ..sig }))
+    }
+
     /// Given the def_id of a Trait `trait_def_id` and the name of an associated item `assoc_name`
     /// returns true if the `trait_def_id` defines an associated item of name `assoc_name`.
     pub fn trait_may_define_assoc_type(self, trait_def_id: DefId, assoc_name: Ident) -> bool {
diff --git a/compiler/rustc_mir_build/src/check_unsafety.rs b/compiler/rustc_mir_build/src/check_unsafety.rs
index eadce3dc9c467..96ad94ddf6a01 100644
--- a/compiler/rustc_mir_build/src/check_unsafety.rs
+++ b/compiler/rustc_mir_build/src/check_unsafety.rs
@@ -1,4 +1,5 @@
 use crate::build::ExprCategory;
+use rustc_middle::middle::stability::{self, DeprecationAsSafeKind};
 use rustc_middle::thir::visit::{self, Visitor};
 
 use rustc_errors::struct_span_err;
@@ -72,16 +73,28 @@ impl<'tcx> UnsafetyVisitor<'_, 'tcx> {
     fn requires_unsafe(&mut self, span: Span, kind: UnsafeOpKind) {
         let (description, note) = kind.description_and_note();
         let unsafe_op_in_unsafe_fn_allowed = self.unsafe_op_in_unsafe_fn_allowed();
-        match self.safety_context {
-            SafetyContext::BuiltinUnsafeBlock => {}
-            SafetyContext::UnsafeBlock { ref mut used, .. } => {
+        match (&mut self.safety_context, kind) {
+            (SafetyContext::BuiltinUnsafeBlock, _) => {}
+            (SafetyContext::UnsafeBlock { ref mut used, .. }, _) => {
                 if !self.body_unsafety.is_unsafe() || !unsafe_op_in_unsafe_fn_allowed {
                     // Mark this block as useful
                     *used = true;
                 }
             }
-            SafetyContext::UnsafeFn if unsafe_op_in_unsafe_fn_allowed => {}
-            SafetyContext::UnsafeFn => {
+            (SafetyContext::UnsafeFn, _) if unsafe_op_in_unsafe_fn_allowed => {}
+            // check if this is a call to a #[deprecated_safe] fn() and lint if so
+            // instead of erroring
+            (
+                SafetyContext::UnsafeFn | SafetyContext::Safe,
+                CallToDeprecatedSafeFunction { depr_as_safe },
+            ) => stability::report_deprecation_as_safe(
+                self.tcx,
+                DeprecationAsSafeKind::FnCall { unsafe_op_in_unsafe_fn_allowed },
+                depr_as_safe,
+                self.hir_context,
+                span,
+            ),
+            (SafetyContext::UnsafeFn, _) => {
                 // unsafe_op_in_unsafe_fn is disallowed
                 self.tcx.struct_span_lint_hir(
                     UNSAFE_OP_IN_UNSAFE_FN,
@@ -98,7 +111,7 @@ impl<'tcx> UnsafetyVisitor<'_, 'tcx> {
                     },
                 )
             }
-            SafetyContext::Safe => {
+            (SafetyContext::Safe, _) => {
                 let fn_sugg = if unsafe_op_in_unsafe_fn_allowed { " function or" } else { "" };
                 struct_span_err!(
                     self.tcx.sess,
@@ -349,9 +362,22 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> {
                 return; // don't visit the whole expression
             }
             ExprKind::Call { fun, ty: _, args: _, from_hir_call: _, fn_span: _ } => {
-                if self.thir[fun].ty.fn_sig(self.tcx).unsafety() == hir::Unsafety::Unsafe {
+                let fun_ty = self.thir[fun].ty;
+                let fun_sig = fun_ty.fn_sig(self.tcx);
+                // check if this is a call to a #[deprecated_safe] fn() and lint if so
+                // instead of erroring
+                if let ty::FnDef(func_id, _) = fun_ty.kind()
+                    && stability::check_deprecation_as_safe(self.tcx, fun_sig.unsafety(), *func_id, expr.span).is_in_effect()
+                {
+                    self.requires_unsafe(
+                        expr.span,
+                        CallToDeprecatedSafeFunction { depr_as_safe: *func_id },
+                    );
+                } else if fun_sig.unsafety() == hir::Unsafety::Unsafe {
                     self.requires_unsafe(expr.span, CallToUnsafeFunction);
-                } else if let &ty::FnDef(func_did, _) = self.thir[fun].ty.kind() {
+                }
+
+                if let &ty::FnDef(func_did, _) = fun_ty.kind() {
                     // If the called function has target features the calling function hasn't,
                     // the call requires `unsafe`. Don't check this on wasm
                     // targets, though. For more information on wasm see the
@@ -524,6 +550,7 @@ impl BodyUnsafety {
 #[derive(Clone, Copy, PartialEq)]
 enum UnsafeOpKind {
     CallToUnsafeFunction,
+    CallToDeprecatedSafeFunction { depr_as_safe: DefId },
     UseOfInlineAssembly,
     InitializingTypeWith,
     UseOfMutableStatic,
@@ -546,6 +573,8 @@ impl UnsafeOpKind {
                 "consult the function's documentation for information on how to avoid undefined \
                  behavior",
             ),
+            // unused, report_deprecation_as_safe is used instead
+            CallToDeprecatedSafeFunction { .. } => ("", ""),
             UseOfInlineAssembly => (
                 "use of inline assembly",
                 "inline assembly is entirely unchecked and can cause undefined behavior",
diff --git a/compiler/rustc_mir_transform/src/check_unsafety.rs b/compiler/rustc_mir_transform/src/check_unsafety.rs
index f5d82315c4e38..0570bc5c036cd 100644
--- a/compiler/rustc_mir_transform/src/check_unsafety.rs
+++ b/compiler/rustc_mir_transform/src/check_unsafety.rs
@@ -4,6 +4,7 @@ use rustc_hir as hir;
 use rustc_hir::def_id::{DefId, LocalDefId};
 use rustc_hir::hir_id::HirId;
 use rustc_hir::intravisit;
+use rustc_middle::middle::stability::{self, DeprecationAsSafeKind};
 use rustc_middle::mir::visit::{MutatingUseContext, PlaceContext, Visitor};
 use rustc_middle::ty::query::Providers;
 use rustc_middle::ty::{self, TyCtxt};
@@ -71,7 +72,23 @@ impl<'tcx> Visitor<'tcx> for UnsafetyChecker<'_, 'tcx> {
             TerminatorKind::Call { ref func, .. } => {
                 let func_ty = func.ty(self.body, self.tcx);
                 let sig = func_ty.fn_sig(self.tcx);
-                if let hir::Unsafety::Unsafe = sig.unsafety() {
+                // check if this is a call to a #[deprecated_safe] fn() and lint if so
+                // instead of erroring
+                if let ty::FnDef(func_id, _) = func_ty.kind()
+                    && stability::check_deprecation_as_safe(
+                        self.tcx,
+                        sig.unsafety(),
+                        *func_id,
+                        self.source_info.span,
+                    ).is_in_effect()
+                {
+                    self.require_unsafe(
+                        UnsafetyViolationKind::DeprecatedSafe {
+                            depr_as_safe: *func_id,
+                        },
+                        UnsafetyViolationDetails::CallToUnsafeFunction,
+                    )
+                } else if let hir::Unsafety::Unsafe = sig.unsafety() {
                     self.require_unsafe(
                         UnsafetyViolationKind::General,
                         UnsafetyViolationDetails::CallToUnsafeFunction,
@@ -289,7 +306,8 @@ impl<'tcx> UnsafetyChecker<'_, 'tcx> {
             // `unsafe` blocks are required in safe code
             Safety::Safe => violations.into_iter().for_each(|&violation| {
                 match violation.kind {
-                    UnsafetyViolationKind::General => {}
+                    UnsafetyViolationKind::General
+                    | UnsafetyViolationKind::DeprecatedSafe { .. } => {}
                     UnsafetyViolationKind::UnsafeFn => {
                         bug!("`UnsafetyViolationKind::UnsafeFn` in an `Safe` context")
                     }
@@ -300,7 +318,15 @@ impl<'tcx> UnsafetyChecker<'_, 'tcx> {
             }),
             // With the RFC 2585, no longer allow `unsafe` operations in `unsafe fn`s
             Safety::FnUnsafe => violations.into_iter().for_each(|&(mut violation)| {
-                violation.kind = UnsafetyViolationKind::UnsafeFn;
+                if unsafe_op_in_unsafe_fn_allowed(self.tcx, violation.lint_root) {
+                    return;
+                }
+
+                // switch violation kind so that the unsafe_op_in_unsafe_fn lint is emitted instead,
+                // but preserve any deprecated_safe lint
+                if !matches!(violation.kind, UnsafetyViolationKind::DeprecatedSafe { .. }) {
+                    violation.kind = UnsafetyViolationKind::UnsafeFn;
+                }
                 if !self.violations.contains(&violation) {
                     self.violations.push(violation)
                 }
@@ -310,10 +336,10 @@ impl<'tcx> UnsafetyChecker<'_, 'tcx> {
                 update_entry(
                     self,
                     hir_id,
-                    match self.tcx.lint_level_at_node(UNSAFE_OP_IN_UNSAFE_FN, violation.lint_root).0
-                    {
-                        Level::Allow => AllAllowedInUnsafeFn(violation.lint_root),
-                        _ => SomeDisallowedInUnsafeFn,
+                    if unsafe_op_in_unsafe_fn_allowed(self.tcx, violation.lint_root) {
+                        AllAllowedInUnsafeFn(violation.lint_root)
+                    } else {
+                        SomeDisallowedInUnsafeFn
                     },
                 )
             }),
@@ -580,8 +606,8 @@ pub fn check_unsafety(tcx: TyCtxt<'_>, def_id: LocalDefId) {
         let (description, note) = details.description_and_note();
 
         // Report an error.
-        let unsafe_fn_msg =
-            if unsafe_op_in_unsafe_fn_allowed(tcx, lint_root) { " function or" } else { "" };
+        let unsafe_op_in_unsafe_fn_allowed = unsafe_op_in_unsafe_fn_allowed(tcx, lint_root);
+        let unsafe_fn_msg = if unsafe_op_in_unsafe_fn_allowed { " function or" } else { "" };
 
         match kind {
             UnsafetyViolationKind::General => {
@@ -612,6 +638,15 @@ pub fn check_unsafety(tcx: TyCtxt<'_>, def_id: LocalDefId) {
                     .emit();
                 },
             ),
+            UnsafetyViolationKind::DeprecatedSafe { depr_as_safe } => {
+                stability::report_deprecation_as_safe(
+                    tcx,
+                    DeprecationAsSafeKind::FnCall { unsafe_op_in_unsafe_fn_allowed },
+                    depr_as_safe,
+                    lint_root,
+                    source_info.span,
+                )
+            }
         }
     }
 
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs
index 1f12f99efb3d5..98cfe72aa72e0 100644
--- a/compiler/rustc_passes/src/check_attr.rs
+++ b/compiler/rustc_passes/src/check_attr.rs
@@ -14,6 +14,7 @@ use rustc_hir::intravisit::{self, Visitor};
 use rustc_hir::{self, FnSig, ForeignItem, HirId, Item, ItemKind, TraitItem, CRATE_HIR_ID};
 use rustc_hir::{MethodKind, Target};
 use rustc_middle::hir::nested_filter;
+use rustc_middle::middle::stability;
 use rustc_middle::ty::query::Providers;
 use rustc_middle::ty::TyCtxt;
 use rustc_session::lint::builtin::{
@@ -128,6 +129,7 @@ impl CheckAttrVisitor<'_> {
                 | sym::unstable
                 | sym::stable
                 | sym::rustc_promotable => self.check_stability_promotable(&attr, span, target),
+                sym::deprecated_safe => self.check_deprecated_safe(hir_id, &attr, span, target),
                 _ => true,
             };
             is_valid &= attr_is_valid;
@@ -2008,6 +2010,74 @@ impl CheckAttrVisitor<'_> {
                 .emit();
         });
     }
+
+    fn check_deprecated_safe(
+        &self,
+        hir_id: HirId,
+        attr: &Attribute,
+        span: Span,
+        _target: Target,
+    ) -> bool {
+        let mut unsafety = None;
+
+        let node = self.tcx.hir().get(hir_id);
+        if let hir::Node::Item(item) = node {
+            if let Some(fn_sig) = node.fn_sig() {
+                unsafety = Some(fn_sig.header.unsafety);
+            } else if let hir::ItemKind::Trait(_, trait_unsafety, ..) = item.kind {
+                unsafety = Some(trait_unsafety);
+            }
+        } else if let hir::Node::TraitItem(_) = node {
+            if let Some(fn_sig) = node.fn_sig() {
+                unsafety = Some(fn_sig.header.unsafety);
+            }
+        }
+
+        let Some(unsafety) = unsafety else {
+            struct_span_err!(
+                self.tcx.sess,
+                attr.span,
+                // FIXME(skippy) wrong error code, need to create a new one
+                E0543,
+                "this `#[deprecated_safe]` annotation has no effect"
+            )
+            .emit();
+            return false;
+        };
+
+        if let Some(depr_as_safe) = stability::parse_deprecation_as_safe(
+            self.tcx,
+            self.tcx.hir().local_def_id(hir_id).to_def_id(),
+            attr,
+        ) {
+            let in_effect = stability::deprecation_as_safe_in_effect(&depr_as_safe);
+            if in_effect && unsafety == hir::Unsafety::Normal {
+                struct_span_err!(
+                    self.tcx.sess,
+                    span,
+                    // FIXME(skippy) wrong error code, need to create a new one
+                    E0543,
+                    "item must be marked unsafe"
+                )
+                .emit();
+                return false;
+            } else if !in_effect && unsafety == hir::Unsafety::Unsafe {
+                struct_span_err!(
+                    self.tcx.sess,
+                    span,
+                    // FIXME(skippy) wrong error code, need to create a new one
+                    E0543,
+                    "item must not be marked unsafe"
+                )
+                .emit();
+                return false;
+            }
+
+            true
+        } else {
+            false
+        }
+    }
 }
 
 impl<'tcx> Visitor<'tcx> for CheckAttrVisitor<'tcx> {
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs
index f5803aaa0786e..7a9bed688f275 100644
--- a/compiler/rustc_span/src/symbol.rs
+++ b/compiler/rustc_span/src/symbol.rs
@@ -1466,6 +1466,7 @@ symbols! {
         unrestricted_attribute_tokens,
         unsafe_block_in_unsafe_fn,
         unsafe_cell,
+        unsafe_edition,
         unsafe_no_drop_flag,
         unsafe_pin_internals,
         unsize,
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
index 9998c5bb087e1..d2a31e29a6acf 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
@@ -2051,7 +2051,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
                 );
                 let mut selcx = SelectionContext::with_query_mode(
                     &self,
-                    crate::traits::TraitQueryMode::Standard,
+                    crate::infer::TraitQueryMode::Standard,
                 );
                 match selcx.select_from_obligation(&obligation) {
                     Err(SelectionError::Ambiguous(impls)) if impls.len() > 1 => {
diff --git a/compiler/rustc_trait_selection/src/traits/fulfill.rs b/compiler/rustc_trait_selection/src/traits/fulfill.rs
index 053e871c14f6e..55d655eefcb48 100644
--- a/compiler/rustc_trait_selection/src/traits/fulfill.rs
+++ b/compiler/rustc_trait_selection/src/traits/fulfill.rs
@@ -5,6 +5,7 @@ use rustc_data_structures::obligation_forest::{Error, ForestObligation, Outcome}
 use rustc_data_structures::obligation_forest::{ObligationForest, ObligationProcessor};
 use rustc_infer::traits::ProjectionCacheKey;
 use rustc_infer::traits::{SelectionError, TraitEngine, TraitEngineExt as _, TraitObligation};
+use rustc_middle::middle::stability;
 use rustc_middle::mir::interpret::ErrorHandled;
 use rustc_middle::thir::abstract_const::NotConstEvaluatable;
 use rustc_middle::ty::error::{ExpectedFound, TypeError};
@@ -674,8 +675,31 @@ impl<'a, 'b, 'tcx> FulfillProcessor<'a, 'b, 'tcx> {
         stalled_on: &mut Vec<TyOrConstInferVar<'tcx>>,
     ) -> ProcessResult<PendingPredicateObligation<'tcx>, FulfillmentErrorCode<'tcx>> {
         let infcx = self.selcx.infcx();
-        if obligation.predicate.is_global() {
-            // no type variables present, can use evaluation for better caching.
+        let is_global = obligation.predicate.is_global();
+
+        // FIXME(skippy) specifically needs reviewer feedback
+        // check if this predicate can't be treated as global due to this being a
+        // #[deprecated_safe] fn() to closure coercion, if evaluation is used there
+        // won't be a proper cause span to lint against
+        let mut is_depr_safe_fn_closure = false;
+        if is_global && let trait_ty = trait_obligation.self_ty().skip_binder()
+            && let ty::FnDef(func_id, _) = trait_ty.kind()
+            && self.selcx.tcx().fn_trait_kind_from_lang_item(
+                trait_obligation.predicate.skip_binder().trait_ref.def_id
+            ).is_some()
+            && stability::check_deprecation_as_safe(
+                self.selcx.tcx(),
+                trait_ty.fn_sig(self.selcx.tcx()).unsafety(),
+                *func_id,
+                obligation.cause.span,
+            ).is_in_effect()
+        {
+            is_depr_safe_fn_closure = true;
+        }
+
+        if is_global && !is_depr_safe_fn_closure {
+            // no type variables present and not a #[deprecated_safe] fn() to closure coercion,
+            // can use evaluation for better caching.
             // FIXME: consider caching errors too.
             if infcx.predicate_must_hold_considering_regions(obligation) {
                 debug!(
@@ -728,8 +752,32 @@ impl<'a, 'b, 'tcx> FulfillProcessor<'a, 'b, 'tcx> {
     ) -> ProcessResult<PendingPredicateObligation<'tcx>, FulfillmentErrorCode<'tcx>> {
         let tcx = self.selcx.tcx();
 
-        if obligation.predicate.is_global() {
-            // no type variables present, can use evaluation for better caching.
+        let is_global = obligation.predicate.is_global();
+
+        // FIXME(skippy) specifically needs reviewer feedback
+        // check if this predicate can't be treated as global due to this being a
+        // #[deprecated_safe] fn() to closure coercion, if evaluation is used there
+        // won't be a proper cause span to lint against
+        let mut is_depr_safe_fn_closure = false;
+
+        if is_global && let trait_ty = project_obligation.predicate.skip_binder().projection_ty.self_ty()
+            && let ty::FnDef(func_id, _) = trait_ty.kind()
+            && self.selcx.tcx().fn_trait_kind_from_lang_item(
+                project_obligation.predicate.trait_def_id(self.selcx.tcx())
+            ).is_some()
+            && stability::check_deprecation_as_safe(
+                self.selcx.tcx(),
+                trait_ty.fn_sig(self.selcx.tcx()).unsafety(),
+                *func_id,
+                obligation.cause.span,
+            ).is_in_effect()
+        {
+            is_depr_safe_fn_closure = true;
+        }
+
+        if is_global && !is_depr_safe_fn_closure {
+            // no type variables present and not a #[deprecated_safe] fn() to closure coercion,
+            // can use evaluation for better caching.
             // FIXME: consider caching errors too.
             if self.selcx.infcx().predicate_must_hold_considering_regions(obligation) {
                 if let Some(key) = ProjectionCacheKey::from_poly_projection_predicate(
diff --git a/compiler/rustc_trait_selection/src/traits/mod.rs b/compiler/rustc_trait_selection/src/traits/mod.rs
index 8240f5c542a61..4491bf75e21db 100644
--- a/compiler/rustc_trait_selection/src/traits/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/mod.rs
@@ -98,19 +98,6 @@ impl SkipLeakCheck {
     }
 }
 
-/// The mode that trait queries run in.
-#[derive(Copy, Clone, PartialEq, Eq, Debug)]
-pub enum TraitQueryMode {
-    /// Standard/un-canonicalized queries get accurate
-    /// spans etc. passed in and hence can do reasonable
-    /// error reporting on their own.
-    Standard,
-    /// Canonicalized queries get dummy spans and hence
-    /// must generally propagate errors to
-    /// pre-canonicalization callsites.
-    Canonical,
-}
-
 /// Creates predicate obligations from the generic bounds.
 pub fn predicates_for_generics<'tcx>(
     cause: ObligationCause<'tcx>,
diff --git a/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs b/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs
index db45ee3fed7db..c341d63d4e1b3 100644
--- a/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs
+++ b/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs
@@ -1,10 +1,8 @@
 use rustc_middle::ty;
 
 use crate::infer::canonical::OriginalQueryValues;
-use crate::infer::InferCtxt;
-use crate::traits::{
-    EvaluationResult, OverflowError, PredicateObligation, SelectionContext, TraitQueryMode,
-};
+use crate::infer::{InferCtxt, TraitQueryMode};
+use crate::traits::{EvaluationResult, OverflowError, PredicateObligation, SelectionContext};
 
 pub trait InferCtxtExt<'tcx> {
     fn predicate_may_hold(&self, obligation: &PredicateObligation<'tcx>) -> bool;
diff --git a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs
index 06f5824099237..4e5b2944a1530 100644
--- a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs
@@ -11,6 +11,7 @@ use rustc_hir::def_id::DefId;
 use rustc_infer::traits::TraitEngine;
 use rustc_infer::traits::{Obligation, SelectionError, TraitObligation};
 use rustc_lint_defs::builtin::DEREF_INTO_DYN_SUPERTRAIT;
+use rustc_middle::middle::stability;
 use rustc_middle::ty::print::with_no_trimmed_paths;
 use rustc_middle::ty::{self, ToPredicate, Ty, TypeFoldable};
 use rustc_target::spec::abi::Abi;
@@ -495,22 +496,35 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
                     ..
                 } = self_ty.fn_sig(self.tcx()).skip_binder()
                 {
-                    candidates.vec.push(FnPointerCandidate { is_const: false });
+                    candidates.vec.push(FnPointerCandidate { is_const: false, depr_as_safe: None });
                 }
             }
             // Provide an impl for suitable functions, rejecting `#[target_feature]` functions (RFC 2396).
             ty::FnDef(def_id, _) => {
-                if let ty::FnSig {
-                    unsafety: hir::Unsafety::Normal,
-                    abi: Abi::Rust,
-                    c_variadic: false,
-                    ..
-                } = self_ty.fn_sig(self.tcx()).skip_binder()
+                if let ty::FnSig { unsafety, abi: Abi::Rust, c_variadic: false, .. } =
+                    self_ty.fn_sig(self.tcx()).skip_binder()
                 {
                     if self.tcx().codegen_fn_attrs(def_id).target_features.is_empty() {
-                        candidates
-                            .vec
-                            .push(FnPointerCandidate { is_const: self.tcx().is_const_fn(def_id) });
+                        // check if a #[deprecated_safe] fn() is being used as a closure, a
+                        // deprecated_safe lint must be emitted if this candidate is used
+                        if stability::check_deprecation_as_safe(
+                            self.tcx(),
+                            unsafety,
+                            def_id,
+                            obligation.cause.span,
+                        )
+                        .is_in_effect()
+                        {
+                            candidates.vec.push(FnPointerCandidate {
+                                is_const: self.tcx().is_const_fn(def_id),
+                                depr_as_safe: Some(def_id),
+                            });
+                        } else if unsafety == hir::Unsafety::Normal {
+                            candidates.vec.push(FnPointerCandidate {
+                                is_const: self.tcx().is_const_fn(def_id),
+                                depr_as_safe: None,
+                            });
+                        }
                     }
                 }
             }
@@ -792,7 +806,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
                     let principal_def_id_b = data_b.principal_def_id();
                     if principal_def_id_a == principal_def_id_b {
                         // no cyclic
-                        candidates.vec.push(BuiltinUnsizeCandidate);
+                        candidates.vec.push(BuiltinUnsizeCandidate { depr_as_safe: None });
                     } else if principal_def_id_a.is_some() && principal_def_id_b.is_some() {
                         // not casual unsizing, now check whether this is trait upcasting coercion.
                         let principal_a = data_a.principal().unwrap();
@@ -834,8 +848,23 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
             }
 
             // `T` -> `Trait`
-            (_, &ty::Dynamic(..)) => {
-                candidates.vec.push(BuiltinUnsizeCandidate);
+            (from, &ty::Dynamic(to_preds, ..)) => {
+                // check if a #[deprecated_safe] fn() is being used as a closure, a
+                // deprecated_safe lint must be emitted if this candidate is used
+                if let ty::FnDef(def_id, _) = *from
+                    && let Some(trait_def_id) = to_preds.principal_def_id()
+                    && self.tcx().fn_trait_kind_from_lang_item(trait_def_id).is_some()
+                    && stability::check_deprecation_as_safe(
+                        self.tcx(),
+                        source.fn_sig(self.tcx()).unsafety(),
+                        def_id,
+                        obligation.cause.span,
+                    ).is_in_effect()
+                {
+                    candidates.vec.push(BuiltinUnsizeCandidate { depr_as_safe: Some(def_id) });
+                } else {
+                    candidates.vec.push(BuiltinUnsizeCandidate { depr_as_safe: None });
+                }
             }
 
             // Ambiguous handling is below `T` -> `Trait`, because inference
@@ -848,20 +877,20 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
 
             // `[T; n]` -> `[T]`
             (&ty::Array(..), &ty::Slice(_)) => {
-                candidates.vec.push(BuiltinUnsizeCandidate);
+                candidates.vec.push(BuiltinUnsizeCandidate { depr_as_safe: None });
             }
 
             // `Struct<T>` -> `Struct<U>`
             (&ty::Adt(def_id_a, _), &ty::Adt(def_id_b, _)) if def_id_a.is_struct() => {
                 if def_id_a == def_id_b {
-                    candidates.vec.push(BuiltinUnsizeCandidate);
+                    candidates.vec.push(BuiltinUnsizeCandidate { depr_as_safe: None });
                 }
             }
 
             // `(.., T)` -> `(.., U)`
             (&ty::Tuple(tys_a), &ty::Tuple(tys_b)) => {
                 if tys_a.len() == tys_b.len() {
-                    candidates.vec.push(BuiltinUnsizeCandidate);
+                    candidates.vec.push(BuiltinUnsizeCandidate { depr_as_safe: None });
                 }
             }
 
diff --git a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs
index b97ab39d991fe..938463b6377f1 100644
--- a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs
@@ -9,8 +9,10 @@
 use rustc_data_structures::stack::ensure_sufficient_stack;
 use rustc_hir::lang_items::LangItem;
 use rustc_index::bit_set::GrowableBitSet;
-use rustc_infer::infer::InferOk;
 use rustc_infer::infer::LateBoundRegionConversionTime::HigherRankedType;
+use rustc_infer::infer::{InferOk, TraitQueryMode};
+use rustc_middle::middle::stability::{self, DeprecationAsSafeKind};
+use rustc_middle::traits;
 use rustc_middle::ty::subst::{GenericArg, GenericArgKind, InternalSubsts, Subst, SubstsRef};
 use rustc_middle::ty::{self, GenericParamDefKind, Ty};
 use rustc_middle::ty::{ToPolyTraitRef, ToPredicate};
@@ -115,8 +117,29 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
                 Ok(ImplSource::Generator(vtable_generator))
             }
 
-            FnPointerCandidate { .. } => {
+            FnPointerCandidate { depr_as_safe, .. } => {
                 let data = self.confirm_fn_pointer_candidate(obligation)?;
+                // FIXME(skippy) specifically needs reviewer feedback
+                // FIXME(skippy) the self.infcx.query_mode == TraitQueryMode::Standard is to
+                //               prevent lints during mir_borrowck, when there will be
+                //               DUMMY_SP cause spans
+                // FIXME(skippy) the param_env.reveal() == traits::Reveal::UserFacing is to prevent
+                //               lints during codegen, when there will be DUMMY_SP cause spans
+                // FIXME(skippy) this is all very ad-hoc
+                // emit deprecated_safe lint if this candidate is from a #[deprecated_safe] fn()
+                // to closure coercion
+                if let Some(depr_as_safe) = depr_as_safe
+                    && self.infcx.query_mode == TraitQueryMode::Standard
+                    && obligation.param_env.reveal() == traits::Reveal::UserFacing
+                {
+                    stability::report_deprecation_as_safe(
+                        self.tcx(),
+                        DeprecationAsSafeKind::FnTraitCoercion,
+                        depr_as_safe,
+                        obligation.cause.body_id,
+                        obligation.cause.span,
+                    );
+                }
                 Ok(ImplSource::FnPointer(data))
             }
 
@@ -138,8 +161,29 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
                 Ok(ImplSource::Param(Vec::new(), ty::BoundConstness::NotConst))
             }
 
-            BuiltinUnsizeCandidate => {
+            BuiltinUnsizeCandidate { depr_as_safe } => {
                 let data = self.confirm_builtin_unsize_candidate(obligation)?;
+                // FIXME(skippy) specifically needs reviewer feedback
+                // FIXME(skippy) the self.infcx.query_mode == TraitQueryMode::Standard is to
+                //               prevent lints during mir_borrowck, when there will be
+                //               DUMMY_SP cause spans
+                // FIXME(skippy) the param_env.reveal() == traits::Reveal::UserFacing is to prevent
+                //               lints during codegen, when there will be DUMMY_SP cause spans
+                // FIXME(skippy) this is all very ad-hoc
+                // emit deprecated_safe lint if this candidate is from a #[deprecated_safe] fn()
+                // to closure coercion
+                if let Some(depr_as_safe) = depr_as_safe
+                    && self.infcx.query_mode == TraitQueryMode::Standard
+                    && obligation.param_env.reveal() == traits::Reveal::UserFacing
+                {
+                    stability::report_deprecation_as_safe(
+                        self.tcx(),
+                        DeprecationAsSafeKind::FnTraitCoercion,
+                        depr_as_safe,
+                        obligation.cause.body_id,
+                        obligation.cause.span,
+                    );
+                }
                 Ok(ImplSource::Builtin(data))
             }
 
diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs
index e69bf6eca90ef..e44859fd1c633 100644
--- a/compiler/rustc_trait_selection/src/traits/select/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs
@@ -16,7 +16,7 @@ use super::wf;
 use super::{
     DerivedObligationCause, ErrorReporting, ImplDerivedObligation, ImplDerivedObligationCause,
     Normalized, Obligation, ObligationCause, ObligationCauseCode, Overflow, PredicateObligation,
-    Selection, SelectionError, SelectionResult, TraitObligation, TraitQueryMode,
+    Selection, SelectionError, SelectionResult, TraitObligation,
 };
 
 use crate::infer::{InferCtxt, InferOk, TypeFreshener};
@@ -29,7 +29,7 @@ use rustc_data_structures::stack::ensure_sufficient_stack;
 use rustc_errors::{Diagnostic, ErrorGuaranteed};
 use rustc_hir as hir;
 use rustc_hir::def_id::DefId;
-use rustc_infer::infer::LateBoundRegionConversionTime;
+use rustc_infer::infer::{LateBoundRegionConversionTime, TraitQueryMode};
 use rustc_middle::dep_graph::{DepKind, DepNodeIndex};
 use rustc_middle::mir::interpret::ErrorHandled;
 use rustc_middle::thir::abstract_const::NotConstEvaluatable;
@@ -1159,7 +1159,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
                     // or ignore error with const_async_blocks feature
                     GeneratorCandidate => {}
                     // FnDef where the function is const
-                    FnPointerCandidate { is_const: true } => {}
+                    FnPointerCandidate { is_const: true, .. } => {}
                     ConstDestructCandidate(_) => {}
                     _ => {
                         // reject all other types of candidates
@@ -1623,7 +1623,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
             }
 
             // Drop otherwise equivalent non-const fn pointer candidates
-            (FnPointerCandidate { .. }, FnPointerCandidate { is_const: false }) => true,
+            (FnPointerCandidate { .. }, FnPointerCandidate { is_const: false, .. }) => true,
 
             // If obligation is a sized predicate or the where-clause bound is
             // global, prefer the projection or object candidate. See issue
@@ -1647,7 +1647,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
                 | GeneratorCandidate
                 | FnPointerCandidate { .. }
                 | BuiltinObjectCandidate
-                | BuiltinUnsizeCandidate
+                | BuiltinUnsizeCandidate { .. }
                 | TraitUpcastingUnsizeCandidate(_)
                 | BuiltinCandidate { .. }
                 | TraitAliasCandidate(..),
@@ -1658,7 +1658,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
                 | GeneratorCandidate
                 | FnPointerCandidate { .. }
                 | BuiltinObjectCandidate
-                | BuiltinUnsizeCandidate
+                | BuiltinUnsizeCandidate { .. }
                 | TraitUpcastingUnsizeCandidate(_)
                 | BuiltinCandidate { has_nested: true }
                 | TraitAliasCandidate(..),
@@ -1688,7 +1688,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
                 | GeneratorCandidate
                 | FnPointerCandidate { .. }
                 | BuiltinObjectCandidate
-                | BuiltinUnsizeCandidate
+                | BuiltinUnsizeCandidate { .. }
                 | TraitUpcastingUnsizeCandidate(_)
                 | BuiltinCandidate { .. }
                 | TraitAliasCandidate(..),
@@ -1700,7 +1700,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
                 | GeneratorCandidate
                 | FnPointerCandidate { .. }
                 | BuiltinObjectCandidate
-                | BuiltinUnsizeCandidate
+                | BuiltinUnsizeCandidate { .. }
                 | TraitUpcastingUnsizeCandidate(_)
                 | BuiltinCandidate { .. }
                 | TraitAliasCandidate(..),
@@ -1781,7 +1781,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
                 | GeneratorCandidate
                 | FnPointerCandidate { .. }
                 | BuiltinObjectCandidate
-                | BuiltinUnsizeCandidate
+                | BuiltinUnsizeCandidate { .. }
                 | TraitUpcastingUnsizeCandidate(_)
                 | BuiltinCandidate { has_nested: true }
                 | TraitAliasCandidate(..),
@@ -1790,7 +1790,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
                 | GeneratorCandidate
                 | FnPointerCandidate { .. }
                 | BuiltinObjectCandidate
-                | BuiltinUnsizeCandidate
+                | BuiltinUnsizeCandidate { .. }
                 | TraitUpcastingUnsizeCandidate(_)
                 | BuiltinCandidate { has_nested: true }
                 | TraitAliasCandidate(..),
diff --git a/compiler/rustc_traits/src/evaluate_obligation.rs b/compiler/rustc_traits/src/evaluate_obligation.rs
index 2404b7ff4b54a..b617df71ba107 100644
--- a/compiler/rustc_traits/src/evaluate_obligation.rs
+++ b/compiler/rustc_traits/src/evaluate_obligation.rs
@@ -1,12 +1,11 @@
-use rustc_infer::infer::TyCtxtInferExt;
+use rustc_infer::infer::{TraitQueryMode, TyCtxtInferExt};
 use rustc_middle::ty::query::Providers;
 use rustc_middle::ty::{ParamEnvAnd, TyCtxt};
 use rustc_span::source_map::DUMMY_SP;
 use rustc_trait_selection::traits::query::CanonicalPredicateGoal;
 use rustc_trait_selection::traits::{
-    EvaluationResult, Obligation, ObligationCause, OverflowError, SelectionContext, TraitQueryMode,
+    EvaluationResult, Obligation, ObligationCause, OverflowError, SelectionContext,
 };
-
 crate fn provide(p: &mut Providers) {
     *p = Providers { evaluate_obligation, ..*p };
 }
diff --git a/compiler/rustc_typeck/Cargo.toml b/compiler/rustc_typeck/Cargo.toml
index 57930a28a35a1..723a9a23c5a3a 100644
--- a/compiler/rustc_typeck/Cargo.toml
+++ b/compiler/rustc_typeck/Cargo.toml
@@ -18,6 +18,7 @@ rustc_errors = { path = "../rustc_errors" }
 rustc_graphviz = { path = "../rustc_graphviz" }
 rustc_hir = { path = "../rustc_hir" }
 rustc_hir_pretty = { path = "../rustc_hir_pretty" }
+rustc_lint_defs = { path = "../rustc_lint_defs" }
 rustc_target = { path = "../rustc_target" }
 rustc_session = { path = "../rustc_session" }
 smallvec = { version = "1.6.1", features = ["union", "may_dangle"] }
diff --git a/compiler/rustc_typeck/src/check/coercion.rs b/compiler/rustc_typeck/src/check/coercion.rs
index 34fc177de6de0..d103cf87508bc 100644
--- a/compiler/rustc_typeck/src/check/coercion.rs
+++ b/compiler/rustc_typeck/src/check/coercion.rs
@@ -46,6 +46,7 @@ use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKi
 use rustc_infer::infer::{Coercion, InferOk, InferResult};
 use rustc_infer::traits::{Obligation, TraitEngine, TraitEngineExt};
 use rustc_middle::lint::in_external_macro;
+use rustc_middle::middle::stability::{self, DeprecationAsSafeKind};
 use rustc_middle::ty::adjustment::{
     Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability, PointerCast,
 };
@@ -720,17 +721,20 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
         Ok(coercion)
     }
 
-    fn coerce_from_safe_fn<F, G>(
+    fn coerce_from_safe_fn<F, G, H>(
         &self,
         a: Ty<'tcx>,
         fn_ty_a: ty::PolyFnSig<'tcx>,
         b: Ty<'tcx>,
         to_unsafe: F,
         normal: G,
+        fn_def_id_a: Option<DefId>,
+        to_safe: H,
     ) -> CoerceResult<'tcx>
     where
         F: FnOnce(Ty<'tcx>) -> Vec<Adjustment<'tcx>>,
         G: FnOnce(Ty<'tcx>) -> Vec<Adjustment<'tcx>>,
+        H: FnOnce(Ty<'tcx>) -> Vec<Adjustment<'tcx>>,
     {
         if let ty::FnPtr(fn_ty_b) = b.kind() {
             if let (hir::Unsafety::Normal, hir::Unsafety::Unsafe) =
@@ -739,6 +743,26 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
                 let unsafe_a = self.tcx.safe_to_unsafe_fn_ty(fn_ty_a);
                 return self.unify_and(unsafe_a, b, to_unsafe);
             }
+            // check if this is a coercion from a #[deprecated_safe] fn() pointer
+            // to a safe fn() pointer and lint if so
+            else if fn_ty_b.unsafety() == hir::Unsafety::Normal
+                && let Some(fn_def_id_a) = fn_def_id_a
+                && stability::check_deprecation_as_safe(self.tcx(), fn_ty_a.unsafety(), fn_def_id_a, self.cause.span).is_in_effect()
+            {
+                stability::report_deprecation_as_safe(
+                    self.tcx(),
+                    DeprecationAsSafeKind::FnPointerCoercion,
+                    fn_def_id_a,
+                    self.cause.body_id,
+                    self.cause.span,
+                );
+
+                // only apply the unsafe coercion if the function truly is ```unsafe``` in source
+                if fn_ty_a.unsafety() == hir::Unsafety::Unsafe {
+                    let safe_a = self.tcx.unsafe_to_safe_fn_ty(fn_ty_a);
+                    return self.unify_and(safe_a, b, to_safe);
+                }
+            }
         }
         self.unify_and(a, b, normal)
     }
@@ -762,6 +786,8 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
             b,
             simple(Adjust::Pointer(PointerCast::UnsafeFnPointer)),
             identity,
+            None,
+            |_| unreachable!(),
         )
     }
 
@@ -796,6 +822,8 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
                 obligations.extend(o1);
 
                 let a_fn_pointer = self.tcx.mk_fn_ptr(a_sig);
+                let a_fn_def_id =
+                    if let ty::FnDef(def_id, _) = *a.kind() { Some(def_id) } else { None };
                 let InferOk { value, obligations: o2 } = self.coerce_from_safe_fn(
                     a_fn_pointer,
                     a_sig,
@@ -813,6 +841,19 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
                         ]
                     },
                     simple(Adjust::Pointer(PointerCast::ReifyFnPointer)),
+                    a_fn_def_id,
+                    |safe_ty| {
+                        vec![
+                            Adjustment {
+                                kind: Adjust::Pointer(PointerCast::ReifyFnPointer),
+                                target: a_fn_pointer,
+                            },
+                            Adjustment {
+                                kind: Adjust::Pointer(PointerCast::DeprecatedSafeFnPointer),
+                                target: safe_ty,
+                            },
+                        ]
+                    },
                 )?;
 
                 obligations.extend(o2);
diff --git a/compiler/rustc_typeck/src/check/compare_method.rs b/compiler/rustc_typeck/src/check/compare_method.rs
index 0bd5e018f4a38..0566f8ff0a690 100644
--- a/compiler/rustc_typeck/src/check/compare_method.rs
+++ b/compiler/rustc_typeck/src/check/compare_method.rs
@@ -7,6 +7,7 @@ use rustc_hir::intravisit;
 use rustc_hir::{GenericParamKind, ImplItemKind, TraitItemKind};
 use rustc_infer::infer::{self, InferOk, TyCtxtInferExt};
 use rustc_infer::traits::util;
+use rustc_middle::middle::stability::{self, DeprecationAsSafeKind};
 use rustc_middle::ty;
 use rustc_middle::ty::error::{ExpectedFound, TypeError};
 use rustc_middle::ty::subst::{InternalSubsts, Subst};
@@ -262,8 +263,6 @@ fn compare_predicate_entailment<'tcx>(
         );
         let impl_sig =
             inh.normalize_associated_types_in(impl_m_span, impl_m_hir_id, param_env, impl_sig);
-        let impl_fty = tcx.mk_fn_ptr(ty::Binder::dummy(impl_sig));
-        debug!("compare_impl_method: impl_fty={:?}", impl_fty);
 
         // First liberate late bound regions and subst placeholders
         let trait_sig = tcx.liberate_late_bound_regions(impl_m.def_id, tcx.fn_sig(trait_m.def_id));
@@ -272,8 +271,37 @@ fn compare_predicate_entailment<'tcx>(
             inh.normalize_associated_types_in(impl_m_span, impl_m_hir_id, param_env, trait_sig);
         // Add the resulting inputs and output as well-formed.
         wf_tys.extend(trait_sig.inputs_and_output.iter());
-        let trait_fty = tcx.mk_fn_ptr(ty::Binder::dummy(trait_sig));
 
+        // check if this is an impl of a #[deprecated_safe] trait function
+        // lint if the impl isn't unsafe and match up the FnSig's unsafety
+        // so there won't be an error
+        let impl_sig = if stability::check_deprecation_as_safe(
+            tcx,
+            trait_sig.unsafety,
+            trait_m.def_id,
+            impl_m_span,
+        )
+        .is_in_effect()
+        {
+            if impl_sig.unsafety == hir::Unsafety::Normal {
+                stability::report_deprecation_as_safe(
+                    tcx,
+                    DeprecationAsSafeKind::TraitFnImpl,
+                    trait_m.def_id,
+                    impl_m_hir_id,
+                    impl_m_span,
+                );
+            }
+
+            ty::FnSig { unsafety: trait_sig.unsafety, ..impl_sig }
+        } else {
+            impl_sig
+        };
+
+        let impl_fty = tcx.mk_fn_ptr(ty::Binder::dummy(impl_sig));
+        debug!("compare_impl_method: impl_fty={:?}", impl_fty);
+
+        let trait_fty = tcx.mk_fn_ptr(ty::Binder::dummy(trait_sig));
         debug!("compare_impl_method: trait_fty={:?}", trait_fty);
 
         let sub_result = infcx.at(&cause, param_env).sup(trait_fty, impl_fty).map(
diff --git a/compiler/rustc_typeck/src/coherence/unsafety.rs b/compiler/rustc_typeck/src/coherence/unsafety.rs
index f7aabf2406f37..691bf4fa4c16d 100644
--- a/compiler/rustc_typeck/src/coherence/unsafety.rs
+++ b/compiler/rustc_typeck/src/coherence/unsafety.rs
@@ -5,6 +5,7 @@ use rustc_errors::struct_span_err;
 use rustc_hir as hir;
 use rustc_hir::itemlikevisit::ItemLikeVisitor;
 use rustc_hir::Unsafety;
+use rustc_middle::middle::stability::{self, DeprecationAsSafeKind};
 use rustc_middle::ty::TyCtxt;
 
 pub fn check(tcx: TyCtxt<'_>) {
@@ -31,14 +32,45 @@ impl<'tcx> UnsafetyChecker<'tcx> {
             });
             match (trait_def.unsafety, unsafe_attr, unsafety, polarity) {
                 (Unsafety::Normal, None, Unsafety::Unsafe, hir::ImplPolarity::Positive) => {
-                    struct_span_err!(
-                        self.tcx.sess,
+                    // an unsafe impl of a safe trait is not allowed, except within libstd
+                    // when that trait is #[deprecated_safe] with a future version
+                    if !stability::check_deprecation_as_safe(
+                        self.tcx,
+                        trait_def.unsafety,
+                        trait_ref.def_id,
+                        item.span,
+                    )
+                    .is_in_effect_in_future()
+                    {
+                        struct_span_err!(
+                            self.tcx.sess,
+                            item.span,
+                            E0199,
+                            "implementing the trait `{}` is not unsafe",
+                            trait_ref.print_only_trait_path()
+                        )
+                        .emit();
+                    }
+                }
+
+                // check if this is a safe impl of a #[deprecated_safe] trait and lint if so
+                // instead of erroring
+                (_, _, Unsafety::Normal, hir::ImplPolarity::Positive)
+                    if stability::check_deprecation_as_safe(
+                        self.tcx,
+                        trait_def.unsafety,
+                        trait_ref.def_id,
+                        item.span,
+                    )
+                    .is_in_effect() =>
+                {
+                    stability::report_deprecation_as_safe(
+                        self.tcx,
+                        DeprecationAsSafeKind::TraitImpl,
+                        trait_ref.def_id,
+                        item.hir_id(),
                         item.span,
-                        E0199,
-                        "implementing the trait `{}` is not unsafe",
-                        trait_ref.print_only_trait_path()
                     )
-                    .emit();
                 }
 
                 (Unsafety::Unsafe, _, Unsafety::Normal, hir::ImplPolarity::Positive) => {
diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs
index 72d6c267290e1..a998182bcf5ae 100644
--- a/library/alloc/src/lib.rs
+++ b/library/alloc/src/lib.rs
@@ -81,6 +81,7 @@
 // Lints:
 #![deny(unsafe_op_in_unsafe_fn)]
 #![warn(deprecated_in_future)]
+#![cfg_attr(not(bootstrap), warn(deprecated_safe_in_future))]
 #![warn(missing_debug_implementations)]
 #![warn(missing_docs)]
 #![allow(explicit_outlives_requirements)]
diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs
index 660f6d92fe184..e3ee357967a0f 100644
--- a/library/core/src/lib.rs
+++ b/library/core/src/lib.rs
@@ -90,6 +90,7 @@
 #![deny(rust_2021_incompatible_or_patterns)]
 #![deny(unsafe_op_in_unsafe_fn)]
 #![warn(deprecated_in_future)]
+#![cfg_attr(not(bootstrap), warn(deprecated_safe_in_future))]
 #![warn(missing_debug_implementations)]
 #![warn(missing_docs)]
 #![allow(explicit_outlives_requirements)]
diff --git a/library/std/src/env.rs b/library/std/src/env.rs
index f03d298d8699d..176ab8469e1f9 100644
--- a/library/std/src/env.rs
+++ b/library/std/src/env.rs
@@ -315,37 +315,51 @@ impl Error for VarError {
 /// Sets the environment variable `key` to the value `value` for the currently running
 /// process.
 ///
-/// Note that while concurrent access to environment variables is safe in Rust,
-/// some platforms only expose inherently unsafe non-threadsafe APIs for
-/// inspecting the environment. As a result, extra care needs to be taken when
-/// auditing calls to unsafe external FFI functions to ensure that any external
-/// environment accesses are properly synchronized with accesses in Rust.
-///
-/// Discussion of this unsafety on Unix may be found in:
-///
-///  - [Austin Group Bugzilla](https://austingroupbugs.net/view.php?id=188)
-///  - [GNU C library Bugzilla](https://sourceware.org/bugzilla/show_bug.cgi?id=15607#c2)
-///
 /// # Panics
 ///
 /// This function may panic if `key` is empty, contains an ASCII equals sign `'='`
 /// or the NUL character `'\0'`, or when `value` contains the NUL character.
 ///
+/// # Safety
+///
+/// Some platforms only expose non-threadsafe APIs for altering the environment.
+/// On these platforms, you must ensure this method is not called when the
+/// program is multithreaded and any other thread could be reading or writing
+/// the environment.
+///
 /// # Examples
 ///
-/// ```
+/// ```no_run
 /// use std::env;
 ///
 /// let key = "KEY";
-/// env::set_var(key, "VALUE");
+/// unsafe { env::set_var(key, "VALUE"); } // Make sure you're single-threaded!
 /// assert_eq!(env::var(key), Ok("VALUE".to_string()));
 /// ```
+#[cfg(not(bootstrap))]
 #[stable(feature = "env", since = "1.0.0")]
-pub fn set_var<K: AsRef<OsStr>, V: AsRef<OsStr>>(key: K, value: V) {
+#[deprecated_safe(
+    since = "1.61.0",
+    note = "you must ensure this method is not called when the program \
+            is multithreaded and any other thread could be reading or \
+            writing the environment"
+    // FIXME(skippy) once edition is added
+    // unsafe_edition = "2024"
+)]
+pub unsafe fn set_var<K: AsRef<OsStr>, V: AsRef<OsStr>>(key: K, value: V) {
     _set_var(key.as_ref(), value.as_ref())
 }
 
-fn _set_var(key: &OsStr, value: &OsStr) {
+/// FIXME(skippy) bootstrapping
+#[cfg(bootstrap)]
+#[stable(feature = "env", since = "1.0.0")]
+pub fn set_var<K: AsRef<OsStr>, V: AsRef<OsStr>>(key: K, value: V) {
+    unsafe { _set_var(key.as_ref(), value.as_ref()) }
+}
+
+// Safety: This can only be called when the program is single-threaded or when
+// no other thread touches the environment.
+unsafe fn _set_var(key: &OsStr, value: &OsStr) {
     os_imp::setenv(key, value).unwrap_or_else(|e| {
         panic!("failed to set environment variable `{key:?}` to `{value:?}`: {e}")
     })
@@ -353,41 +367,55 @@ fn _set_var(key: &OsStr, value: &OsStr) {
 
 /// Removes an environment variable from the environment of the currently running process.
 ///
-/// Note that while concurrent access to environment variables is safe in Rust,
-/// some platforms only expose inherently unsafe non-threadsafe APIs for
-/// inspecting the environment. As a result extra care needs to be taken when
-/// auditing calls to unsafe external FFI functions to ensure that any external
-/// environment accesses are properly synchronized with accesses in Rust.
-///
-/// Discussion of this unsafety on Unix may be found in:
-///
-///  - [Austin Group Bugzilla](https://austingroupbugs.net/view.php?id=188)
-///  - [GNU C library Bugzilla](https://sourceware.org/bugzilla/show_bug.cgi?id=15607#c2)
-///
 /// # Panics
 ///
 /// This function may panic if `key` is empty, contains an ASCII equals sign
 /// `'='` or the NUL character `'\0'`, or when the value contains the NUL
 /// character.
 ///
+/// # Safety
+///
+/// Some platforms only expose non-threadsafe APIs for altering the environment.
+/// On these platforms, you must ensure this method is not called when the
+/// program is multithreaded and any other thread could be reading or writing
+/// the environment.
+///
 /// # Examples
 ///
-/// ```
+/// ```no_run
 /// use std::env;
 ///
 /// let key = "KEY";
-/// env::set_var(key, "VALUE");
+/// unsafe { env::set_var(key, "VALUE"); } // Make sure you're single-threaded!
 /// assert_eq!(env::var(key), Ok("VALUE".to_string()));
 ///
-/// env::remove_var(key);
+/// unsafe { env::remove_var(key); } // Make sure you're single-threaded!
 /// assert!(env::var(key).is_err());
 /// ```
+#[cfg(not(bootstrap))]
 #[stable(feature = "env", since = "1.0.0")]
-pub fn remove_var<K: AsRef<OsStr>>(key: K) {
+#[deprecated_safe(
+    since = "1.61.0",
+    note = "you must ensure this method is not called when the program \
+            is multithreaded and any other thread could be reading or \
+            writing the environment"
+    // FIXME(skippy) once edition is added
+    // unsafe_edition = "2024"
+)]
+pub unsafe fn remove_var<K: AsRef<OsStr>>(key: K) {
     _remove_var(key.as_ref())
 }
 
-fn _remove_var(key: &OsStr) {
+/// FIXME(skippy) bootstrapping
+#[cfg(bootstrap)]
+#[stable(feature = "env", since = "1.0.0")]
+pub fn remove_var<K: AsRef<OsStr>>(key: K) {
+    unsafe { _remove_var(key.as_ref()) }
+}
+
+// Safety: This can only be called when the program is single-threaded or when
+// no other thread touches the environment.
+unsafe fn _remove_var(key: &OsStr) {
     os_imp::unsetenv(key)
         .unwrap_or_else(|e| panic!("failed to remove environment variable `{key:?}`: {e}"))
 }
@@ -514,7 +542,10 @@ pub struct JoinPathsError {
 ///         let mut paths = env::split_paths(&path).collect::<Vec<_>>();
 ///         paths.push(PathBuf::from("/home/xyz/bin"));
 ///         let new_path = env::join_paths(paths)?;
-///         env::set_var("PATH", &new_path);
+///         // SAFETY: in main(), no other threads could be reading or writing the environment
+///         unsafe {
+///             env::set_var("PATH", &new_path);
+///         }
 ///     }
 ///
 ///     Ok(())
diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs
index 5ade65ad9c629..76acac1e9d7f7 100644
--- a/library/std/src/lib.rs
+++ b/library/std/src/lib.rs
@@ -204,6 +204,7 @@
 // Don't link to std. We are std.
 #![no_std]
 #![warn(deprecated_in_future)]
+#![cfg_attr(not(bootstrap), warn(deprecated_safe_in_future))]
 #![warn(missing_docs)]
 #![warn(missing_debug_implementations)]
 #![allow(explicit_outlives_requirements)]
@@ -231,6 +232,7 @@
 #![feature(const_mut_refs)]
 #![feature(const_trait_impl)]
 #![feature(decl_macro)]
+#![cfg_attr(not(bootstrap), feature(deprecated_safe))]
 #![feature(deprecated_suggestion)]
 #![feature(doc_cfg)]
 #![feature(doc_cfg_hide)]
diff --git a/library/std/src/os/unix/process.rs b/library/std/src/os/unix/process.rs
index d95bc9b15c9c4..9d8609795dea0 100644
--- a/library/std/src/os/unix/process.rs
+++ b/library/std/src/os/unix/process.rs
@@ -102,6 +102,27 @@ pub trait CommandExt: Sealed {
     /// that, it got deprecated in favor of the unsafe [`pre_exec`].
     ///
     /// [`pre_exec`]: CommandExt::pre_exec
+    #[cfg(not(bootstrap))]
+    #[stable(feature = "process_exec", since = "1.15.0")]
+    #[rustc_deprecated(
+        since = "1.37.0",
+        reason = "FIXME(skippy) should be unsafe, use `pre_exec` instead"
+    )]
+    #[deprecated_safe(
+        since = "1.61.0",
+        note = "FIXME(skippy)"
+        // FIXME(skippy) once edition is added
+        // unsafe_edition = "2024"
+    )]
+    unsafe fn before_exec<F>(&mut self, f: F) -> &mut process::Command
+    where
+        F: FnMut() -> io::Result<()> + Send + Sync + 'static,
+    {
+        self.pre_exec(f)
+    }
+
+    /// FIXME(skippy) bootstrapping
+    #[cfg(bootstrap)]
     #[stable(feature = "process_exec", since = "1.15.0")]
     #[rustc_deprecated(since = "1.37.0", reason = "should be unsafe, use `pre_exec` instead")]
     fn before_exec<F>(&mut self, f: F) -> &mut process::Command
diff --git a/library/std/src/process/tests.rs b/library/std/src/process/tests.rs
index 4f779ab4e786c..1c4ac64b67d95 100644
--- a/library/std/src/process/tests.rs
+++ b/library/std/src/process/tests.rs
@@ -278,8 +278,12 @@ fn test_capture_env_at_spawn() {
 
     // This variable will not be present if the environment has already
     // been captured above.
+    // FIXME(skippy) there's no fix for deprecated_safe until tests can be run single threaded
+    #[cfg_attr(not(bootstrap), allow(deprecated_safe))]
     env::set_var("RUN_TEST_NEW_ENV2", "456");
     let result = cmd.output().unwrap();
+    // FIXME(skippy) there's no fix for deprecated_safe until tests can be run single threaded
+    #[cfg_attr(not(bootstrap), allow(deprecated_safe))]
     env::remove_var("RUN_TEST_NEW_ENV2");
 
     let output = String::from_utf8_lossy(&result.stdout).to_string();
diff --git a/library/std/src/sys/hermit/os.rs b/library/std/src/sys/hermit/os.rs
index 8f927df85be5d..b8114f8456129 100644
--- a/library/std/src/sys/hermit/os.rs
+++ b/library/std/src/sys/hermit/os.rs
@@ -144,18 +144,14 @@ pub fn getenv(k: &OsStr) -> Option<OsString> {
     unsafe { ENV.as_ref().unwrap().lock().unwrap().get_mut(k).cloned() }
 }
 
-pub fn setenv(k: &OsStr, v: &OsStr) -> io::Result<()> {
-    unsafe {
-        let (k, v) = (k.to_owned(), v.to_owned());
-        ENV.as_ref().unwrap().lock().unwrap().insert(k, v);
-    }
+pub unsafe fn setenv(k: &OsStr, v: &OsStr) -> io::Result<()> {
+    let (k, v) = (k.to_owned(), v.to_owned());
+    ENV.as_ref().unwrap().lock().unwrap().insert(k, v);
     Ok(())
 }
 
-pub fn unsetenv(k: &OsStr) -> io::Result<()> {
-    unsafe {
-        ENV.as_ref().unwrap().lock().unwrap().remove(k);
-    }
+pub unsafe fn unsetenv(k: &OsStr) -> io::Result<()> {
+    ENV.as_ref().unwrap().lock().unwrap().remove(k);
     Ok(())
 }
 
diff --git a/library/std/src/sys/sgx/os.rs b/library/std/src/sys/sgx/os.rs
index 5da0257f35de5..348085cfc1d7f 100644
--- a/library/std/src/sys/sgx/os.rs
+++ b/library/std/src/sys/sgx/os.rs
@@ -110,13 +110,13 @@ pub fn getenv(k: &OsStr) -> Option<OsString> {
     get_env_store().and_then(|s| s.lock().unwrap().get(k).cloned())
 }
 
-pub fn setenv(k: &OsStr, v: &OsStr) -> io::Result<()> {
+pub unsafe fn setenv(k: &OsStr, v: &OsStr) -> io::Result<()> {
     let (k, v) = (k.to_owned(), v.to_owned());
     create_env_store().lock().unwrap().insert(k, v);
     Ok(())
 }
 
-pub fn unsetenv(k: &OsStr) -> io::Result<()> {
+pub unsafe fn unsetenv(k: &OsStr) -> io::Result<()> {
     if let Some(env) = get_env_store() {
         env.lock().unwrap().remove(k);
     }
diff --git a/library/std/src/sys/solid/os.rs b/library/std/src/sys/solid/os.rs
index 719d95bbe50a8..7012205113053 100644
--- a/library/std/src/sys/solid/os.rs
+++ b/library/std/src/sys/solid/os.rs
@@ -151,23 +151,19 @@ pub fn getenv(k: &OsStr) -> Option<OsString> {
     }
 }
 
-pub fn setenv(k: &OsStr, v: &OsStr) -> io::Result<()> {
+pub unsafe fn setenv(k: &OsStr, v: &OsStr) -> io::Result<()> {
     let k = CString::new(k.as_bytes())?;
     let v = CString::new(v.as_bytes())?;
 
-    unsafe {
-        let _guard = ENV_LOCK.write();
-        cvt_env(libc::setenv(k.as_ptr(), v.as_ptr(), 1)).map(drop)
-    }
+    let _guard = ENV_LOCK.write();
+    cvt_env(libc::setenv(k.as_ptr(), v.as_ptr(), 1)).map(drop)
 }
 
-pub fn unsetenv(n: &OsStr) -> io::Result<()> {
+pub unsafe fn unsetenv(n: &OsStr) -> io::Result<()> {
     let nbuf = CString::new(n.as_bytes())?;
 
-    unsafe {
-        let _guard = ENV_LOCK.write();
-        cvt_env(libc::unsetenv(nbuf.as_ptr())).map(drop)
-    }
+    let _guard = ENV_LOCK.write();
+    cvt_env(libc::unsetenv(nbuf.as_ptr())).map(drop)
 }
 
 /// In kmclib, `setenv` and `unsetenv` don't always set `errno`, so this
diff --git a/library/std/src/sys/unix/os.rs b/library/std/src/sys/unix/os.rs
index 1be733ba106e8..3d17e33b2ee44 100644
--- a/library/std/src/sys/unix/os.rs
+++ b/library/std/src/sys/unix/os.rs
@@ -538,23 +538,21 @@ pub fn getenv(k: &OsStr) -> Option<OsString> {
     }
 }
 
-pub fn setenv(k: &OsStr, v: &OsStr) -> io::Result<()> {
+// Safety: This can only be called when the program is single-threaded.
+pub unsafe fn setenv(k: &OsStr, v: &OsStr) -> io::Result<()> {
     let k = CString::new(k.as_bytes())?;
     let v = CString::new(v.as_bytes())?;
 
-    unsafe {
-        let _guard = ENV_LOCK.write();
-        cvt(libc::setenv(k.as_ptr(), v.as_ptr(), 1)).map(drop)
-    }
+    let _guard = ENV_LOCK.write();
+    cvt(libc::setenv(k.as_ptr(), v.as_ptr(), 1)).map(drop)
 }
 
-pub fn unsetenv(n: &OsStr) -> io::Result<()> {
+// Safety: This can only be called when the program is single-threaded.
+pub unsafe fn unsetenv(n: &OsStr) -> io::Result<()> {
     let nbuf = CString::new(n.as_bytes())?;
 
-    unsafe {
-        let _guard = ENV_LOCK.write();
-        cvt(libc::unsetenv(nbuf.as_ptr())).map(drop)
-    }
+    let _guard = ENV_LOCK.write();
+    cvt(libc::unsetenv(nbuf.as_ptr())).map(drop)
 }
 
 #[cfg(not(target_os = "espidf"))]
diff --git a/library/std/src/sys/unsupported/os.rs b/library/std/src/sys/unsupported/os.rs
index e150ae143ad99..b80179a22afe2 100644
--- a/library/std/src/sys/unsupported/os.rs
+++ b/library/std/src/sys/unsupported/os.rs
@@ -80,11 +80,11 @@ pub fn getenv(_: &OsStr) -> Option<OsString> {
     None
 }
 
-pub fn setenv(_: &OsStr, _: &OsStr) -> io::Result<()> {
+pub unsafe fn setenv(_: &OsStr, _: &OsStr) -> io::Result<()> {
     Err(io::const_io_error!(io::ErrorKind::Unsupported, "cannot set env vars on this platform"))
 }
 
-pub fn unsetenv(_: &OsStr) -> io::Result<()> {
+pub unsafe fn unsetenv(_: &OsStr) -> io::Result<()> {
     Err(io::const_io_error!(io::ErrorKind::Unsupported, "cannot unset env vars on this platform"))
 }
 
diff --git a/library/std/src/sys/wasi/os.rs b/library/std/src/sys/wasi/os.rs
index c5229a188342a..563dffa309430 100644
--- a/library/std/src/sys/wasi/os.rs
+++ b/library/std/src/sys/wasi/os.rs
@@ -188,23 +188,19 @@ pub fn getenv(k: &OsStr) -> Option<OsString> {
     }
 }
 
-pub fn setenv(k: &OsStr, v: &OsStr) -> io::Result<()> {
+pub unsafe fn setenv(k: &OsStr, v: &OsStr) -> io::Result<()> {
     let k = CString::new(k.as_bytes())?;
     let v = CString::new(v.as_bytes())?;
 
-    unsafe {
-        let _guard = env_lock();
-        cvt(libc::setenv(k.as_ptr(), v.as_ptr(), 1)).map(drop)
-    }
+    let _guard = env_lock();
+    cvt(libc::setenv(k.as_ptr(), v.as_ptr(), 1)).map(drop)
 }
 
-pub fn unsetenv(n: &OsStr) -> io::Result<()> {
+pub unsafe fn unsetenv(n: &OsStr) -> io::Result<()> {
     let nbuf = CString::new(n.as_bytes())?;
 
-    unsafe {
-        let _guard = env_lock();
-        cvt(libc::unsetenv(nbuf.as_ptr())).map(drop)
-    }
+    let _guard = env_lock();
+    cvt(libc::unsetenv(nbuf.as_ptr())).map(drop)
 }
 
 pub fn temp_dir() -> PathBuf {
diff --git a/library/std/src/sys/windows/os.rs b/library/std/src/sys/windows/os.rs
index bcac996c024ec..49f9b76ba95ef 100644
--- a/library/std/src/sys/windows/os.rs
+++ b/library/std/src/sys/windows/os.rs
@@ -262,16 +262,16 @@ pub fn getenv(k: &OsStr) -> Option<OsString> {
     .ok()
 }
 
-pub fn setenv(k: &OsStr, v: &OsStr) -> io::Result<()> {
+pub unsafe fn setenv(k: &OsStr, v: &OsStr) -> io::Result<()> {
     let k = to_u16s(k)?;
     let v = to_u16s(v)?;
 
-    cvt(unsafe { c::SetEnvironmentVariableW(k.as_ptr(), v.as_ptr()) }).map(drop)
+    cvt(c::SetEnvironmentVariableW(k.as_ptr(), v.as_ptr())).map(drop)
 }
 
-pub fn unsetenv(n: &OsStr) -> io::Result<()> {
+pub unsafe fn unsetenv(n: &OsStr) -> io::Result<()> {
     let v = to_u16s(n)?;
-    cvt(unsafe { c::SetEnvironmentVariableW(v.as_ptr(), ptr::null()) }).map(drop)
+    cvt(c::SetEnvironmentVariableW(v.as_ptr(), ptr::null())).map(drop)
 }
 
 pub fn temp_dir() -> PathBuf {
diff --git a/library/std/tests/env.rs b/library/std/tests/env.rs
index b095c2dde6285..5a8a9877f91b0 100644
--- a/library/std/tests/env.rs
+++ b/library/std/tests/env.rs
@@ -19,6 +19,8 @@ fn eq(a: Option<OsString>, b: Option<&str>) {
 #[test]
 fn test_set_var() {
     let n = make_rand_name();
+    // FIXME(skippy) there's no fix for deprecated_safe until tests can be run single threaded
+    #[cfg_attr(not(bootstrap), allow(deprecated_safe))]
     set_var(&n, "VALUE");
     eq(var_os(&n), Some("VALUE"));
 }
@@ -26,7 +28,11 @@ fn test_set_var() {
 #[test]
 fn test_remove_var() {
     let n = make_rand_name();
+    // FIXME(skippy) there's no fix for deprecated_safe until tests can be run single threaded
+    #[cfg_attr(not(bootstrap), allow(deprecated_safe))]
     set_var(&n, "VALUE");
+    // FIXME(skippy) there's no fix for deprecated_safe until tests can be run single threaded
+    #[cfg_attr(not(bootstrap), allow(deprecated_safe))]
     remove_var(&n);
     eq(var_os(&n), None);
 }
@@ -34,9 +40,15 @@ fn test_remove_var() {
 #[test]
 fn test_set_var_overwrite() {
     let n = make_rand_name();
+    // FIXME(skippy) there's no fix for deprecated_safe until tests can be run single threaded
+    #[cfg_attr(not(bootstrap), allow(deprecated_safe))]
     set_var(&n, "1");
+    // FIXME(skippy) there's no fix for deprecated_safe until tests can be run single threaded
+    #[cfg_attr(not(bootstrap), allow(deprecated_safe))]
     set_var(&n, "2");
     eq(var_os(&n), Some("2"));
+    // FIXME(skippy) there's no fix for deprecated_safe until tests can be run single threaded
+    #[cfg_attr(not(bootstrap), allow(deprecated_safe))]
     set_var(&n, "");
     eq(var_os(&n), Some(""));
 }
@@ -51,6 +63,8 @@ fn test_var_big() {
         i += 1;
     }
     let n = make_rand_name();
+    // FIXME(skippy) there's no fix for deprecated_safe until tests can be run single threaded
+    #[cfg_attr(not(bootstrap), allow(deprecated_safe))]
     set_var(&n, &s);
     eq(var_os(&n), Some(&s));
 }
@@ -60,8 +74,12 @@ fn test_var_big() {
 fn test_env_set_get_huge() {
     let n = make_rand_name();
     let s = "x".repeat(10000);
+    // FIXME(skippy) there's no fix for deprecated_safe until tests can be run single threaded
+    #[cfg_attr(not(bootstrap), allow(deprecated_safe))]
     set_var(&n, &s);
     eq(var_os(&n), Some(&s));
+    // FIXME(skippy) there's no fix for deprecated_safe until tests can be run single threaded
+    #[cfg_attr(not(bootstrap), allow(deprecated_safe))]
     remove_var(&n);
     eq(var_os(&n), None);
 }
@@ -71,6 +89,8 @@ fn test_env_set_var() {
     let n = make_rand_name();
 
     let mut e = vars_os();
+    // FIXME(skippy) there's no fix for deprecated_safe until tests can be run single threaded
+    #[cfg_attr(not(bootstrap), allow(deprecated_safe))]
     set_var(&n, "VALUE");
     assert!(!e.any(|(k, v)| { &*k == &*n && &*v == "VALUE" }));
 
@@ -95,9 +115,13 @@ fn env_home_dir() {
         if #[cfg(unix)] {
             let oldhome = var_to_os_string(var("HOME"));
 
+            // FIXME(skippy) there's no fix for deprecated_safe until tests can be run single threaded
+            #[cfg_attr(not(bootstrap), allow(deprecated_safe))]
             set_var("HOME", "/home/MountainView");
             assert_eq!(home_dir(), Some(PathBuf::from("/home/MountainView")));
 
+            // FIXME(skippy) there's no fix for deprecated_safe until tests can be run single threaded
+            #[cfg_attr(not(bootstrap), allow(deprecated_safe))]
             remove_var("HOME");
             if cfg!(target_os = "android") {
                 assert!(home_dir().is_none());
@@ -108,33 +132,59 @@ fn env_home_dir() {
                 assert_ne!(home_dir(), Some(PathBuf::from("/home/MountainView")));
             }
 
+            // FIXME(skippy) there's no fix for deprecated_safe until tests can be run single threaded
+            #[cfg_attr(not(bootstrap), allow(deprecated_safe))]
             if let Some(oldhome) = oldhome { set_var("HOME", oldhome); }
         } else if #[cfg(windows)] {
             let oldhome = var_to_os_string(var("HOME"));
             let olduserprofile = var_to_os_string(var("USERPROFILE"));
 
-            remove_var("HOME");
-            remove_var("USERPROFILE");
+            // SAFETY: inside a cfg!(windows) section, remove_var is always sound
+            #[cfg_attr(bootstrap, allow(unused_unsafe))]
+            unsafe {
+                remove_var("HOME");
+                remove_var("USERPROFILE");
+            }
 
             assert!(home_dir().is_some());
 
             set_var("HOME", "/home/MountainView");
             assert_eq!(home_dir(), Some(PathBuf::from("/home/MountainView")));
 
-            remove_var("HOME");
+            // SAFETY: inside a cfg!(windows) section, remove_var is always sound
+            #[cfg_attr(bootstrap, allow(unused_unsafe))]
+            unsafe {
+                remove_var("HOME");
+            }
 
-            set_var("USERPROFILE", "/home/MountainView");
+            // SAFETY: inside a cfg!(windows) section, set_var is always sound
+            #[cfg_attr(bootstrap, allow(unused_unsafe))]
+            unsafe {
+                set_var("USERPROFILE", "/home/MountainView");
+            }
             assert_eq!(home_dir(), Some(PathBuf::from("/home/MountainView")));
 
-            set_var("HOME", "/home/MountainView");
-            set_var("USERPROFILE", "/home/PaloAlto");
+            // SAFETY: inside a cfg!(windows) section, set_var is always sound
+            #[cfg_attr(bootstrap, allow(unused_unsafe))]
+            unsafe {
+                set_var("HOME", "/home/MountainView");
+                set_var("USERPROFILE", "/home/PaloAlto");
+            }
             assert_eq!(home_dir(), Some(PathBuf::from("/home/MountainView")));
 
-            remove_var("HOME");
-            remove_var("USERPROFILE");
+            // SAFETY: inside a cfg!(windows) section, remove_var is always sound
+            #[cfg_attr(bootstrap, allow(unused_unsafe))]
+            unsafe {
+                remove_var("HOME");
+                remove_var("USERPROFILE");
+            }
 
-            if let Some(oldhome) = oldhome { set_var("HOME", oldhome); }
-            if let Some(olduserprofile) = olduserprofile { set_var("USERPROFILE", olduserprofile); }
+            // SAFETY: inside a cfg!(windows) section, set_var is always sound
+            #[cfg_attr(bootstrap, allow(unused_unsafe))]
+            unsafe {
+                if let Some(oldhome) = oldhome { set_var("HOME", oldhome); }
+                if let Some(olduserprofile) = olduserprofile { set_var("USERPROFILE", olduserprofile); }
+            }
         }
     }
 }
diff --git a/library/test/src/lib.rs b/library/test/src/lib.rs
index 0c748da1a59cc..955306f08043d 100644
--- a/library/test/src/lib.rs
+++ b/library/test/src/lib.rs
@@ -145,6 +145,8 @@ pub fn test_main_static_abort(tests: &[&TestDescAndFn]) {
     // If we're being run in SpawnedSecondary mode, run the test here. run_test
     // will then exit the process.
     if let Ok(name) = env::var(SECONDARY_TEST_INVOKER_VAR) {
+        // FIXME(skippy) deprecate_safe: should be a single thread here, assert that somehow?
+        #[cfg_attr(not(bootstrap), allow(deprecated_safe))]
         env::remove_var(SECONDARY_TEST_INVOKER_VAR);
         let test = tests
             .iter()
diff --git a/library/test/src/term/terminfo/searcher/tests.rs b/library/test/src/term/terminfo/searcher/tests.rs
index 4227a585e2f59..3a4f396e81069 100644
--- a/library/test/src/term/terminfo/searcher/tests.rs
+++ b/library/test/src/term/terminfo/searcher/tests.rs
@@ -13,7 +13,11 @@ fn test_get_dbpath_for_term() {
     }
     assert!(x("screen") == "/usr/share/terminfo/s/screen");
     assert!(get_dbpath_for_term("") == None);
+    // FIXME(skippy) there's no fix for deprecated_safe until tests can be run single threaded
+    #[cfg_attr(not(bootstrap), allow(deprecated_safe))]
     env::set_var("TERMINFO_DIRS", ":");
     assert!(x("screen") == "/usr/share/terminfo/s/screen");
+    // FIXME(skippy) there's no fix for deprecated_safe until tests can be run single threaded
+    #[cfg_attr(not(bootstrap), allow(deprecated_safe))]
     env::remove_var("TERMINFO_DIRS");
 }
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index 1d7a790bdb786..d9889d80eca8d 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -163,7 +163,11 @@ pub fn main() {
     }
 
     rustc_driver::set_sigpipe_handler();
-    rustc_driver::install_ice_hook();
+    // SAFETY: in main(), no other threads could be reading or writing the environment
+    // FIXME(skippy) are there definitely zero threads here? other functions have been called
+    unsafe {
+        rustc_driver::install_ice_hook();
+    }
 
     // When using CI artifacts (with `download_stage1 = true`), tracing is unconditionally built
     // with `--features=static_max_level_info`, which disables almost all rustdoc logging. To avoid
diff --git a/src/test/ui/command/command-exec.rs b/src/test/ui/command/command-exec.rs
index 0af87214f9523..7eb587c26fea3 100644
--- a/src/test/ui/command/command-exec.rs
+++ b/src/test/ui/command/command-exec.rs
@@ -41,7 +41,11 @@ fn main() {
             }
 
             "exec-test5" => {
-                env::set_var("VARIABLE", "ABC");
+                // SAFETY: in main(), no other threads could be reading or writing the environment
+                #[cfg_attr(bootstrap, allow(unused_unsafe))]
+                unsafe {
+                    env::set_var("VARIABLE", "ABC");
+                }
                 Command::new("definitely-not-a-real-binary").env("VARIABLE", "XYZ").exec();
                 assert_eq!(env::var("VARIABLE").unwrap(), "ABC");
                 println!("passed");
diff --git a/src/test/ui/deprecated-safe/auxiliary/deprecated-safe.rs b/src/test/ui/deprecated-safe/auxiliary/deprecated-safe.rs
new file mode 100644
index 0000000000000..c00158f6ca3d0
--- /dev/null
+++ b/src/test/ui/deprecated-safe/auxiliary/deprecated-safe.rs
@@ -0,0 +1,85 @@
+#![feature(deprecated_safe)]
+#![feature(staged_api)]
+#![stable(feature = "deprecated-safe-test", since = "1.61.0")]
+#![warn(deprecated_safe_in_future, unused_unsafe)]
+
+use std::ffi::OsStr;
+
+#[stable(feature = "deprecated-safe-test", since = "1.61.0")]
+#[deprecated_safe(since = "1.61.0", note = "reason")]
+pub unsafe fn depr_safe() {}
+
+#[stable(feature = "deprecated-safe-test", since = "1.61.0")]
+#[deprecated_safe(since = "1.61.0", note = "reason")]
+pub unsafe fn depr_safe_params(_: u32, _: u64) {}
+
+#[stable(feature = "deprecated-safe-test", since = "1.61.0")]
+#[deprecated_safe(since = "1.61.0", note = "reason")]
+pub unsafe fn depr_safe_generic<K: AsRef<OsStr>, V: AsRef<OsStr>>(key: K, value: V) {}
+
+#[stable(feature = "deprecated-safe-test", since = "1.61.0")]
+#[deprecated_safe(since = "99.99.99", note = "reason")]
+pub fn depr_safe_future() {}
+
+#[stable(feature = "deprecated-safe-test", since = "1.61.0")]
+#[deprecated_safe(since = "1.61.0", note = "reason", unsafe_edition = "2015")]
+pub unsafe fn depr_safe_2015() {}
+
+#[stable(feature = "deprecated-safe-test", since = "1.61.0")]
+#[deprecated_safe(since = "99.99.99", note = "reason", unsafe_edition = "2015")]
+pub fn depr_safe_2015_future() {}
+
+#[stable(feature = "deprecated-safe-test", since = "1.61.0")]
+#[deprecated_safe(since = "1.61.0", note = "reason", unsafe_edition = "2018")]
+pub unsafe fn depr_safe_2018() {}
+
+#[stable(feature = "deprecated-safe-test", since = "1.61.0")]
+#[deprecated_safe(since = "1.61.0", note = "reason")]
+pub unsafe trait DeprSafe {}
+
+#[stable(feature = "deprecated-safe-test", since = "1.61.0")]
+#[deprecated_safe(since = "TBD", note = "reason")]
+pub trait DeprSafeFuture {}
+
+#[stable(feature = "deprecated-safe-test", since = "1.61.0")]
+#[deprecated_safe(since = "1.61.0", note = "reason", unsafe_edition = "2015")]
+pub unsafe trait DeprSafe2015 {}
+
+#[stable(feature = "deprecated-safe-test", since = "1.61.0")]
+#[deprecated_safe(since = "99.99.99", note = "reason", unsafe_edition = "2015")]
+pub trait DeprSafe2015Future {}
+
+#[stable(feature = "deprecated-safe-test", since = "1.61.0")]
+#[deprecated_safe(since = "1.61.0", note = "reason", unsafe_edition = "2018")]
+pub unsafe trait DeprSafe2018 {}
+
+#[stable(feature = "deprecated-safe-test", since = "1.61.0")]
+pub trait DeprSafeFns {
+    #[stable(feature = "deprecated-safe-test", since = "1.61.0")]
+    #[deprecated_safe(since = "1.61.0", note = "reason")]
+    unsafe fn depr_safe_fn(&self) {}
+
+    #[stable(feature = "deprecated-safe-test", since = "1.61.0")]
+    #[deprecated_safe(since = "1.61.0", note = "reason")]
+    unsafe fn depr_safe_params(&self, _: u32, _: u64) {}
+
+    #[stable(feature = "deprecated-safe-test", since = "1.61.0")]
+    #[deprecated_safe(since = "1.61.0", note = "reason")]
+    unsafe fn depr_safe_fn_generic<K: AsRef<OsStr>, V: AsRef<OsStr>>(&self, key: K, value: V) {}
+
+    #[stable(feature = "deprecated-safe-test", since = "1.61.0")]
+    #[deprecated_safe(since = "TBD", note = "reason")]
+    fn depr_safe_fn_future(&self) {}
+
+    #[stable(feature = "deprecated-safe-test", since = "1.61.0")]
+    #[deprecated_safe(since = "1.61.0", note = "reason", unsafe_edition = "2015")]
+    unsafe fn depr_safe_fn_2015(&self) {}
+
+    #[stable(feature = "deprecated-safe-test", since = "1.61.0")]
+    #[deprecated_safe(since = "99.99.99", note = "reason", unsafe_edition = "2015")]
+    fn depr_safe_fn_2015_future(&self) {}
+
+    #[stable(feature = "deprecated-safe-test", since = "1.61.0")]
+    #[deprecated_safe(since = "1.61.0", note = "reason", unsafe_edition = "2018")]
+    unsafe fn depr_safe_fn_2018(&self) {}
+}
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-attr-staged.mir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-attr-staged.mir.stderr
new file mode 100644
index 0000000000000..f1483b41e7f98
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-attr-staged.mir.stderr
@@ -0,0 +1,46 @@
+error[E0543]: invalid 'unsafe_edition' specified
+  --> $DIR/deprecated-safe-attr-staged.rs:17:1
+   |
+LL | #[deprecated_safe(since = "1.61.0", unsafe_edition = "BAD", note = "reason")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0543]: invalid 'unsafe_edition' specified
+  --> $DIR/deprecated-safe-attr-staged.rs:20:1
+   |
+LL | #[deprecated_safe(since = "TBD", unsafe_edition = "BAD", note = "reason")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0542]: missing 'since'
+  --> $DIR/deprecated-safe-attr-staged.rs:23:1
+   |
+LL | #[deprecated_safe]
+   | ^^^^^^^^^^^^^^^^^^
+
+error[E0542]: missing 'since'
+  --> $DIR/deprecated-safe-attr-staged.rs:26:1
+   |
+LL | #[deprecated_safe = "hi"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0543]: missing 'note'
+  --> $DIR/deprecated-safe-attr-staged.rs:29:1
+   |
+LL | #[deprecated_safe(since = "1.61.0")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0542]: missing 'since'
+  --> $DIR/deprecated-safe-attr-staged.rs:32:1
+   |
+LL | #[deprecated_safe(note = "reason")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0543]: this `#[deprecated_safe]` annotation has no effect
+  --> $DIR/deprecated-safe-attr-staged.rs:37:5
+   |
+LL |     #[deprecated_safe(since = "1.61.0", note = "reason")]
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 7 previous errors
+
+Some errors have detailed explanations: E0542, E0543.
+For more information about an error, try `rustc --explain E0542`.
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-attr-staged.rs b/src/test/ui/deprecated-safe/deprecated-safe-attr-staged.rs
new file mode 100644
index 0000000000000..8d578b8393327
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-attr-staged.rs
@@ -0,0 +1,41 @@
+// aux-build:deprecated-safe.rs
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
+#![feature(deprecated_safe)]
+#![feature(staged_api)]
+#![stable(feature = "deprecated-safe-test", since = "1.61.0")]
+#![warn(deprecated_safe_in_future, unused_unsafe)]
+
+extern crate deprecated_safe;
+
+use deprecated_safe::DeprSafeFns;
+
+#[deprecated_safe(since = "1.61.0", unsafe_edition = "2015", note = "reason")]
+unsafe fn foo0() {}
+
+#[deprecated_safe(since = "1.61.0", unsafe_edition = "BAD", note = "reason")] //~ ERROR invalid 'unsafe_edition' specified
+unsafe fn foo1() {}
+
+#[deprecated_safe(since = "TBD", unsafe_edition = "BAD", note = "reason")] //~ ERROR invalid 'unsafe_edition' specified
+unsafe fn foo2() {}
+
+#[deprecated_safe] //~ ERROR missing 'since'
+unsafe fn foo3() {}
+
+#[deprecated_safe = "hi"] //~ ERROR missing 'since'
+unsafe fn foo4() {}
+
+#[deprecated_safe(since = "1.61.0")] //~ ERROR missing 'note'
+unsafe fn foo5() {}
+
+#[deprecated_safe(note = "reason")] //~ ERROR missing 'since'
+unsafe fn foo6() {}
+
+struct BadAnnotation;
+impl DeprSafeFns for BadAnnotation {
+    #[deprecated_safe(since = "1.61.0", note = "reason")] //~ ERROR this `#[deprecated_safe]` annotation has no effect
+    unsafe fn depr_safe_fn(&self) {}
+}
+
+fn main() {}
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-attr-staged.thir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-attr-staged.thir.stderr
new file mode 100644
index 0000000000000..f1483b41e7f98
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-attr-staged.thir.stderr
@@ -0,0 +1,46 @@
+error[E0543]: invalid 'unsafe_edition' specified
+  --> $DIR/deprecated-safe-attr-staged.rs:17:1
+   |
+LL | #[deprecated_safe(since = "1.61.0", unsafe_edition = "BAD", note = "reason")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0543]: invalid 'unsafe_edition' specified
+  --> $DIR/deprecated-safe-attr-staged.rs:20:1
+   |
+LL | #[deprecated_safe(since = "TBD", unsafe_edition = "BAD", note = "reason")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0542]: missing 'since'
+  --> $DIR/deprecated-safe-attr-staged.rs:23:1
+   |
+LL | #[deprecated_safe]
+   | ^^^^^^^^^^^^^^^^^^
+
+error[E0542]: missing 'since'
+  --> $DIR/deprecated-safe-attr-staged.rs:26:1
+   |
+LL | #[deprecated_safe = "hi"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0543]: missing 'note'
+  --> $DIR/deprecated-safe-attr-staged.rs:29:1
+   |
+LL | #[deprecated_safe(since = "1.61.0")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0542]: missing 'since'
+  --> $DIR/deprecated-safe-attr-staged.rs:32:1
+   |
+LL | #[deprecated_safe(note = "reason")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0543]: this `#[deprecated_safe]` annotation has no effect
+  --> $DIR/deprecated-safe-attr-staged.rs:37:5
+   |
+LL |     #[deprecated_safe(since = "1.61.0", note = "reason")]
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 7 previous errors
+
+Some errors have detailed explanations: E0542, E0543.
+For more information about an error, try `rustc --explain E0542`.
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-attr.mir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-attr.mir.stderr
new file mode 100644
index 0000000000000..00eb960ba6727
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-attr.mir.stderr
@@ -0,0 +1,76 @@
+error[E0543]: 'unsafe_edition' is invalid outside of rustc
+  --> $DIR/deprecated-safe-attr.rs:13:1
+   |
+LL | #[deprecated_safe(since = "1.61.0", unsafe_edition = "2015", note = "reason")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0543]: 'unsafe_edition' is invalid outside of rustc
+  --> $DIR/deprecated-safe-attr.rs:16:1
+   |
+LL | #[deprecated_safe(since = "1.61.0", unsafe_edition = "BAD", note = "reason")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0543]: 'unsafe_edition' is invalid outside of rustc
+  --> $DIR/deprecated-safe-attr.rs:19:1
+   |
+LL | #[deprecated_safe(since = "TBD", unsafe_edition = "BAD", note = "reason")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: multiple `deprecated_safe` attributes
+  --> $DIR/deprecated-safe-attr.rs:35:1
+   |
+LL | #[deprecated_safe(note = "reason")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
+  --> $DIR/deprecated-safe-attr.rs:34:1
+   |
+LL | #[deprecated_safe(since = "1.61.0")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0541]: unknown meta item 'extra'
+  --> $DIR/deprecated-safe-attr.rs:38:37
+   |
+LL | #[deprecated_safe(since = "1.61.0", extra = "")]
+   |                                     ^^^^^^^^^^
+
+error[E0538]: multiple 'since' items
+  --> $DIR/deprecated-safe-attr.rs:41:1
+   |
+LL | #[deprecated_safe(since = "1.61.0", since = "1.61.0")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0551]: incorrect meta item 'since'
+  --> $DIR/deprecated-safe-attr.rs:44:19
+   |
+LL | #[deprecated_safe(since)]
+   |                   ^^^^^
+
+error[E0565]: literal in `deprecated_safe` value must be a string
+  --> $DIR/deprecated-safe-attr.rs:47:27
+   |
+LL | #[deprecated_safe(since = 1_61_0)]
+   |                           ^^^^^^
+
+error[E0565]: item in `deprecated_safe` must be a key/value pair
+  --> $DIR/deprecated-safe-attr.rs:50:19
+   |
+LL | #[deprecated_safe(1_61_0)]
+   |                   ^^^^^^
+
+error[E0543]: this `#[deprecated_safe]` annotation has no effect
+  --> $DIR/deprecated-safe-attr.rs:53:1
+   |
+LL | #[deprecated_safe(since = "1.61.0")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0543]: this `#[deprecated_safe]` annotation has no effect
+  --> $DIR/deprecated-safe-attr.rs:58:5
+   |
+LL |     #[deprecated_safe(since = "1.61.0", note = "reason")]
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 11 previous errors
+
+Some errors have detailed explanations: E0538, E0541, E0543, E0551, E0565.
+For more information about an error, try `rustc --explain E0538`.
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-attr.rs b/src/test/ui/deprecated-safe/deprecated-safe-attr.rs
new file mode 100644
index 0000000000000..dd42366485f81
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-attr.rs
@@ -0,0 +1,62 @@
+// aux-build:deprecated-safe.rs
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
+#![feature(deprecated_safe)]
+#![feature(type_alias_impl_trait)]
+#![warn(unused_unsafe)]
+
+extern crate deprecated_safe;
+
+use deprecated_safe::DeprSafeFns;
+
+#[deprecated_safe(since = "1.61.0", unsafe_edition = "2015", note = "reason")] //~ ERROR 'unsafe_edition' is invalid outside of rustc
+unsafe fn foo0() {}
+
+#[deprecated_safe(since = "1.61.0", unsafe_edition = "BAD", note = "reason")] //~ ERROR 'unsafe_edition' is invalid outside of rustc
+unsafe fn foo1() {}
+
+#[deprecated_safe(since = "TBD", unsafe_edition = "BAD", note = "reason")] //~ ERROR 'unsafe_edition' is invalid outside of rustc
+unsafe fn foo2() {}
+
+#[deprecated_safe]
+unsafe fn foo3() {}
+
+#[deprecated_safe = "hi"]
+unsafe fn foo4() {}
+
+#[deprecated_safe(since = "1.61.0")]
+unsafe fn foo5() {}
+
+#[deprecated_safe(note = "reason")]
+unsafe fn foo6() {}
+
+#[deprecated_safe(since = "1.61.0")]
+#[deprecated_safe(note = "reason")] //~ ERROR multiple `deprecated_safe` attributes
+unsafe fn foo7() {}
+
+#[deprecated_safe(since = "1.61.0", extra = "")] //~ ERROR unknown meta item 'extra'
+unsafe fn foo8() {}
+
+#[deprecated_safe(since = "1.61.0", since = "1.61.0")] //~ ERROR multiple 'since' items
+unsafe fn foo9() {}
+
+#[deprecated_safe(since)] //~ ERROR incorrect meta item
+unsafe fn foo10() {}
+
+#[deprecated_safe(since = 1_61_0)] //~ ERROR literal in `deprecated_safe` value must be a string
+unsafe fn foo11() {}
+
+#[deprecated_safe(1_61_0)] //~ ERROR item in `deprecated_safe` must be a key/value pair
+unsafe fn foo12() {}
+
+#[deprecated_safe(since = "1.61.0")] //~ ERROR this `#[deprecated_safe]` annotation has no effect
+static FOO0: u32 = 0;
+
+struct BadAnnotation;
+impl DeprSafeFns for BadAnnotation {
+    #[deprecated_safe(since = "1.61.0", note = "reason")] //~ ERROR this `#[deprecated_safe]` annotation has no effect
+    unsafe fn depr_safe_fn(&self) {}
+}
+
+fn main() {}
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-attr.thir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-attr.thir.stderr
new file mode 100644
index 0000000000000..00eb960ba6727
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-attr.thir.stderr
@@ -0,0 +1,76 @@
+error[E0543]: 'unsafe_edition' is invalid outside of rustc
+  --> $DIR/deprecated-safe-attr.rs:13:1
+   |
+LL | #[deprecated_safe(since = "1.61.0", unsafe_edition = "2015", note = "reason")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0543]: 'unsafe_edition' is invalid outside of rustc
+  --> $DIR/deprecated-safe-attr.rs:16:1
+   |
+LL | #[deprecated_safe(since = "1.61.0", unsafe_edition = "BAD", note = "reason")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0543]: 'unsafe_edition' is invalid outside of rustc
+  --> $DIR/deprecated-safe-attr.rs:19:1
+   |
+LL | #[deprecated_safe(since = "TBD", unsafe_edition = "BAD", note = "reason")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: multiple `deprecated_safe` attributes
+  --> $DIR/deprecated-safe-attr.rs:35:1
+   |
+LL | #[deprecated_safe(note = "reason")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
+  --> $DIR/deprecated-safe-attr.rs:34:1
+   |
+LL | #[deprecated_safe(since = "1.61.0")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0541]: unknown meta item 'extra'
+  --> $DIR/deprecated-safe-attr.rs:38:37
+   |
+LL | #[deprecated_safe(since = "1.61.0", extra = "")]
+   |                                     ^^^^^^^^^^
+
+error[E0538]: multiple 'since' items
+  --> $DIR/deprecated-safe-attr.rs:41:1
+   |
+LL | #[deprecated_safe(since = "1.61.0", since = "1.61.0")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0551]: incorrect meta item 'since'
+  --> $DIR/deprecated-safe-attr.rs:44:19
+   |
+LL | #[deprecated_safe(since)]
+   |                   ^^^^^
+
+error[E0565]: literal in `deprecated_safe` value must be a string
+  --> $DIR/deprecated-safe-attr.rs:47:27
+   |
+LL | #[deprecated_safe(since = 1_61_0)]
+   |                           ^^^^^^
+
+error[E0565]: item in `deprecated_safe` must be a key/value pair
+  --> $DIR/deprecated-safe-attr.rs:50:19
+   |
+LL | #[deprecated_safe(1_61_0)]
+   |                   ^^^^^^
+
+error[E0543]: this `#[deprecated_safe]` annotation has no effect
+  --> $DIR/deprecated-safe-attr.rs:53:1
+   |
+LL | #[deprecated_safe(since = "1.61.0")]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0543]: this `#[deprecated_safe]` annotation has no effect
+  --> $DIR/deprecated-safe-attr.rs:58:5
+   |
+LL |     #[deprecated_safe(since = "1.61.0", note = "reason")]
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 11 previous errors
+
+Some errors have detailed explanations: E0538, E0541, E0543, E0551, E0565.
+For more information about an error, try `rustc --explain E0538`.
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-future-staged.mir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-future-staged.mir.stderr
new file mode 100644
index 0000000000000..4f82d44357863
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-future-staged.mir.stderr
@@ -0,0 +1,444 @@
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:27:5
+   |
+LL |     depr_safe_future
+   |     ^^^^^^^^^^^^^^^^
+   |
+note: the lint level is defined here
+  --> $DIR/deprecated-safe-future-staged.rs:9:9
+   |
+LL | #![warn(deprecated_safe_in_future, unused_unsafe)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:27:5
+   |
+LL |     depr_safe_future
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:27:5
+   |
+LL |     depr_safe_future
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:27:5
+   |
+LL |     depr_safe_future
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:33:14
+   |
+LL | fn foo4() -> impl FnOnce() {
+   |              ^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:33:14
+   |
+LL | fn foo4() -> impl FnOnce() {
+   |              ^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:33:28
+   |
+LL |   fn foo4() -> impl FnOnce() {
+   |  ____________________________^
+LL | |
+LL | |
+LL | |
+...  |
+LL | |
+LL | | }
+   | |_^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:49:34
+   |
+LL |     let fn_impl: Box<dyn Fn()> = Box::new(depr_safe_future);
+   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:49:34
+   |
+LL |     let fn_impl: Box<dyn Fn()> = Box::new(depr_safe_future);
+   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:49:34
+   |
+LL |     let fn_impl: Box<dyn Fn()> = Box::new(depr_safe_future);
+   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:52:37
+   |
+LL |     let fn_impl: Box<dyn FnMut()> = Box::new(depr_safe_future);
+   |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:52:37
+   |
+LL |     let fn_impl: Box<dyn FnMut()> = Box::new(depr_safe_future);
+   |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:54:38
+   |
+LL |     let fn_impl: Box<dyn FnOnce()> = Box::new(depr_safe_future);
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:54:38
+   |
+LL |     let fn_impl: Box<dyn FnOnce()> = Box::new(depr_safe_future);
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:59:34
+   |
+LL |     let fn_impl: Box<dyn Fn()> = Box::new(depr_safe_future);
+   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:60:37
+   |
+LL |     let fn_impl: Box<dyn FnMut()> = Box::new(depr_safe_future);
+   |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:61:38
+   |
+LL |     let fn_impl: Box<dyn FnOnce()> = Box::new(depr_safe_future);
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:64:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(depr_safe_future));
+   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:65:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(depr_safe_future));
+   |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:66:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(depr_safe_future));
+   |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:69:5
+   |
+LL |     fn_taking_fn_impl(depr_safe_future);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:70:5
+   |
+LL |     fn_taking_fnmut_impl(depr_safe_future);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:71:5
+   |
+LL |     fn_taking_fnonce_impl(depr_safe_future);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:78:42
+   |
+LL |     let depr_safe_generic_fn_ptr: fn() = depr_safe_future;
+   |                                          ^^^^^^^^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:82:42
+   |
+LL |     let depr_safe_generic_fn_ptr: fn() = depr_safe_future;
+   |                                          ^^^^^^^^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:83:52
+   |
+LL |     let depr_safe_generic_fn_impl: Box<dyn Fn()> = Box::new(depr_safe_future);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:84:62
+   |
+LL |     let mut depr_safe_generic_fnmut_impl: Box<dyn FnMut()> = Box::new(depr_safe_future);
+   |                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:85:60
+   |
+LL |     let depr_safe_generic_fnonce_impl: Box<dyn FnOnce()> = Box::new(depr_safe_future);
+   |                                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:95:22
+   |
+LL |     fn_taking_fn_ptr(depr_safe_future);
+   |                      ^^^^^^^^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:96:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(depr_safe_future));
+   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:97:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(depr_safe_future));
+   |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:98:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(depr_safe_future));
+   |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:99:5
+   |
+LL |     fn_taking_fn_impl(depr_safe_future);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:100:5
+   |
+LL |     fn_taking_fnmut_impl(depr_safe_future);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:101:5
+   |
+LL |     fn_taking_fnonce_impl(depr_safe_future);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:39:5
+   |
+LL |     depr_safe_future
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:39:5
+   |
+LL |     depr_safe_future
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:19:13
+   |
+LL | type Tait = impl FnOnce();
+   |             ^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:19:13
+   |
+LL | type Tait = impl FnOnce();
+   |             ^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:33:14
+   |
+LL | fn foo4() -> impl FnOnce() {
+   |              ^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:33:14
+   |
+LL | fn foo4() -> impl FnOnce() {
+   |              ^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` without an unsafe function or block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:74:5
+   |
+LL |     depr_safe_future();
+   |     ^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` without an unsafe function or block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:75:5
+   |
+LL |     depr_safe_future();
+   |     ^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: 43 warnings emitted
+
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-future-staged.rs b/src/test/ui/deprecated-safe/deprecated-safe-future-staged.rs
new file mode 100644
index 0000000000000..10f0b1ba7979b
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-future-staged.rs
@@ -0,0 +1,113 @@
+// aux-build:deprecated-safe.rs
+// check-pass
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
+#![feature(type_alias_impl_trait)]
+#![feature(staged_api)]
+#![stable(feature = "deprecated-safe-test", since = "1.61.0")]
+#![warn(deprecated_safe_in_future, unused_unsafe)]
+
+extern crate deprecated_safe;
+
+use deprecated_safe::{depr_safe_future};
+
+trait Bla {
+    type T;
+}
+
+type Tait = impl FnOnce(); //~ WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+//~| WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+
+impl Bla for u32 {
+    type T = Tait;
+}
+
+fn foo3() -> Tait {
+    depr_safe_future //~ WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+}
+
+fn foo4() -> impl FnOnce() {
+    //~^ WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+    depr_safe_future //~ WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+}
+
+unsafe fn unsafe_fn() {
+    depr_safe_future();
+}
+
+fn main() {
+    // test for dyn Fn() coercion where arguments match (no args)
+    let fn_impl: Box<dyn Fn()> = Box::new(depr_safe_future); //~ WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+                                                             //~| WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+                                                             //~| WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+    let fn_impl: Box<dyn FnMut()> = Box::new(depr_safe_future); //~ WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+                                                                //~| WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+    let fn_impl: Box<dyn FnOnce()> = Box::new(depr_safe_future); //~ WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+                                                                 //~| WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+
+    // test for dyn Fn() coercion where arguments don't match, where an
+    // intermediate fn() will be used
+    let fn_impl: Box<dyn Fn()> = Box::new(depr_safe_future); //~ WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+    let fn_impl: Box<dyn FnMut()> = Box::new(depr_safe_future); //~ WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+    let fn_impl: Box<dyn FnOnce()> = Box::new(depr_safe_future); //~ WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+
+    // test variant where coercion occurs on a function argument instead of a variable
+    fn_taking_dyn_fn_impl(Box::new(depr_safe_future)); //~ WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnmut_impl(Box::new(depr_safe_future)); //~ WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnonce_impl(Box::new(depr_safe_future)); //~ WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+
+    // test for non-dyn Fn() coercion (no unsizing)
+    fn_taking_fn_impl(depr_safe_future); //~ WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnmut_impl(depr_safe_future); //~ WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnonce_impl(depr_safe_future); //~ WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+
+    // usage without unsafe should lint
+    depr_safe_future(); //~ WARN use of function `deprecated_safe::depr_safe_future` without an unsafe function or block has been deprecated as it is now an unsafe function
+    depr_safe_future(); //~ WARN use of function `deprecated_safe::depr_safe_future` without an unsafe function or block has been deprecated as it is now an unsafe function
+
+    // test for fn() coercion where arguments match (no args)
+    let depr_safe_generic_fn_ptr: fn() = depr_safe_future; //~ WARN use of function `deprecated_safe::depr_safe_future` as a normal fn pointer has been deprecated as it is now an unsafe function
+
+    // test for fn() coercion where arguments don't match, where an
+    // intermediate fn() will be used
+    let depr_safe_generic_fn_ptr: fn() = depr_safe_future; //~ WARN use of function `deprecated_safe::depr_safe_future` as a normal fn pointer has been deprecated as it is now an unsafe function
+    let depr_safe_generic_fn_impl: Box<dyn Fn()> = Box::new(depr_safe_future); //~ WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+    let mut depr_safe_generic_fnmut_impl: Box<dyn FnMut()> = Box::new(depr_safe_future); //~ WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+    let depr_safe_generic_fnonce_impl: Box<dyn FnOnce()> = Box::new(depr_safe_future); //~ WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+
+    // these shouldn't lint, appropriate unsafe usage
+    let unsafe_depr_safe_generic_fn_ptr: unsafe fn() = depr_safe_future;
+    fn_taking_unsafe_fn_ptr(depr_safe_future);
+    unsafe {
+        depr_safe_future();
+    }
+
+    // all of these coercions should lint
+    fn_taking_fn_ptr(depr_safe_future); //~ WARN use of function `deprecated_safe::depr_safe_future` as a normal fn pointer has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fn_impl(Box::new(depr_safe_future)); //~ WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnmut_impl(Box::new(depr_safe_future)); //~ WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnonce_impl(Box::new(depr_safe_future)); //~ WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fn_impl(depr_safe_future); //~ WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnmut_impl(depr_safe_future); //~ WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnonce_impl(depr_safe_future); //~ WARN use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+}
+
+fn fn_taking_fn_ptr(_: fn()) {}
+fn fn_taking_unsafe_fn_ptr(_: unsafe fn()) {}
+
+fn fn_taking_dyn_fn_impl(_: Box<dyn Fn()>) {}
+fn fn_taking_dyn_fnmut_impl(_: Box<dyn FnMut()>) {}
+fn fn_taking_dyn_fnonce_impl(_: Box<dyn FnOnce()>) {}
+
+fn fn_taking_fn_impl(_: impl Fn()) {}
+fn fn_taking_fnmut_impl(_: impl FnMut()) {}
+fn fn_taking_fnonce_impl(_: impl FnOnce()) {}
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-future-staged.thir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-future-staged.thir.stderr
new file mode 100644
index 0000000000000..4f82d44357863
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-future-staged.thir.stderr
@@ -0,0 +1,444 @@
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:27:5
+   |
+LL |     depr_safe_future
+   |     ^^^^^^^^^^^^^^^^
+   |
+note: the lint level is defined here
+  --> $DIR/deprecated-safe-future-staged.rs:9:9
+   |
+LL | #![warn(deprecated_safe_in_future, unused_unsafe)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:27:5
+   |
+LL |     depr_safe_future
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:27:5
+   |
+LL |     depr_safe_future
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:27:5
+   |
+LL |     depr_safe_future
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:33:14
+   |
+LL | fn foo4() -> impl FnOnce() {
+   |              ^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:33:14
+   |
+LL | fn foo4() -> impl FnOnce() {
+   |              ^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:33:28
+   |
+LL |   fn foo4() -> impl FnOnce() {
+   |  ____________________________^
+LL | |
+LL | |
+LL | |
+...  |
+LL | |
+LL | | }
+   | |_^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:49:34
+   |
+LL |     let fn_impl: Box<dyn Fn()> = Box::new(depr_safe_future);
+   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:49:34
+   |
+LL |     let fn_impl: Box<dyn Fn()> = Box::new(depr_safe_future);
+   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:49:34
+   |
+LL |     let fn_impl: Box<dyn Fn()> = Box::new(depr_safe_future);
+   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:52:37
+   |
+LL |     let fn_impl: Box<dyn FnMut()> = Box::new(depr_safe_future);
+   |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:52:37
+   |
+LL |     let fn_impl: Box<dyn FnMut()> = Box::new(depr_safe_future);
+   |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:54:38
+   |
+LL |     let fn_impl: Box<dyn FnOnce()> = Box::new(depr_safe_future);
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:54:38
+   |
+LL |     let fn_impl: Box<dyn FnOnce()> = Box::new(depr_safe_future);
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:59:34
+   |
+LL |     let fn_impl: Box<dyn Fn()> = Box::new(depr_safe_future);
+   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:60:37
+   |
+LL |     let fn_impl: Box<dyn FnMut()> = Box::new(depr_safe_future);
+   |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:61:38
+   |
+LL |     let fn_impl: Box<dyn FnOnce()> = Box::new(depr_safe_future);
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:64:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(depr_safe_future));
+   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:65:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(depr_safe_future));
+   |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:66:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(depr_safe_future));
+   |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:69:5
+   |
+LL |     fn_taking_fn_impl(depr_safe_future);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:70:5
+   |
+LL |     fn_taking_fnmut_impl(depr_safe_future);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:71:5
+   |
+LL |     fn_taking_fnonce_impl(depr_safe_future);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:78:42
+   |
+LL |     let depr_safe_generic_fn_ptr: fn() = depr_safe_future;
+   |                                          ^^^^^^^^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:82:42
+   |
+LL |     let depr_safe_generic_fn_ptr: fn() = depr_safe_future;
+   |                                          ^^^^^^^^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:83:52
+   |
+LL |     let depr_safe_generic_fn_impl: Box<dyn Fn()> = Box::new(depr_safe_future);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:84:62
+   |
+LL |     let mut depr_safe_generic_fnmut_impl: Box<dyn FnMut()> = Box::new(depr_safe_future);
+   |                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:85:60
+   |
+LL |     let depr_safe_generic_fnonce_impl: Box<dyn FnOnce()> = Box::new(depr_safe_future);
+   |                                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:95:22
+   |
+LL |     fn_taking_fn_ptr(depr_safe_future);
+   |                      ^^^^^^^^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:96:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(depr_safe_future));
+   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:97:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(depr_safe_future));
+   |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:98:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(depr_safe_future));
+   |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:99:5
+   |
+LL |     fn_taking_fn_impl(depr_safe_future);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:100:5
+   |
+LL |     fn_taking_fnmut_impl(depr_safe_future);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:101:5
+   |
+LL |     fn_taking_fnonce_impl(depr_safe_future);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:39:5
+   |
+LL |     depr_safe_future
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:39:5
+   |
+LL |     depr_safe_future
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:19:13
+   |
+LL | type Tait = impl FnOnce();
+   |             ^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:19:13
+   |
+LL | type Tait = impl FnOnce();
+   |             ^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:33:14
+   |
+LL | fn foo4() -> impl FnOnce() {
+   |              ^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:33:14
+   |
+LL | fn foo4() -> impl FnOnce() {
+   |              ^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` without an unsafe function or block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:74:5
+   |
+LL |     depr_safe_future();
+   |     ^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` without an unsafe function or block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-future-staged.rs:75:5
+   |
+LL |     depr_safe_future();
+   |     ^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: 43 warnings emitted
+
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-future.mir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-future.mir.stderr
new file mode 100644
index 0000000000000..2f35f791d31e5
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-future.mir.stderr
@@ -0,0 +1,14 @@
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-future.rs:74:5
+   |
+LL |     unsafe {
+   |     ^^^^^^ unnecessary `unsafe` block
+   |
+note: the lint level is defined here
+  --> $DIR/deprecated-safe-future.rs:7:9
+   |
+LL | #![warn(unused_unsafe)]
+   |         ^^^^^^^^^^^^^
+
+warning: 1 warning emitted
+
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-future.rs b/src/test/ui/deprecated-safe/deprecated-safe-future.rs
new file mode 100644
index 0000000000000..65e56f6ca62ae
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-future.rs
@@ -0,0 +1,98 @@
+// aux-build:deprecated-safe.rs
+// check-pass
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
+#![feature(type_alias_impl_trait)]
+#![warn(unused_unsafe)]
+
+extern crate deprecated_safe;
+
+use deprecated_safe::depr_safe_future;
+
+trait Bla {
+    type T;
+}
+
+type Tait = impl FnOnce();
+
+impl Bla for u32 {
+    type T = Tait;
+}
+
+fn foo3() -> Tait {
+    depr_safe_future
+}
+
+fn foo4() -> impl FnOnce() {
+    depr_safe_future
+}
+
+unsafe fn unsafe_fn() {
+    depr_safe_future();
+}
+
+fn main() {
+    // test for dyn Fn() coercion where arguments match (no args)
+    let fn_impl: Box<dyn Fn()> = Box::new(depr_safe_future);
+    let fn_impl: Box<dyn FnMut()> = Box::new(depr_safe_future);
+    let fn_impl: Box<dyn FnOnce()> = Box::new(depr_safe_future);
+
+    // test for dyn Fn() coercion where arguments don't match, where an
+    // intermediate fn() will be used
+    let fn_impl: Box<dyn Fn()> = Box::new(depr_safe_future);
+    let fn_impl: Box<dyn FnMut()> = Box::new(depr_safe_future);
+    let fn_impl: Box<dyn FnOnce()> = Box::new(depr_safe_future);
+
+    // test variant where coercion occurs on a function argument instead of a variable
+    fn_taking_dyn_fn_impl(Box::new(depr_safe_future));
+    fn_taking_dyn_fnmut_impl(Box::new(depr_safe_future));
+    fn_taking_dyn_fnonce_impl(Box::new(depr_safe_future));
+
+    // test for non-dyn Fn() coercion (no unsizing)
+    fn_taking_fn_impl(depr_safe_future);
+    fn_taking_fnmut_impl(depr_safe_future);
+    fn_taking_fnonce_impl(depr_safe_future);
+
+    // usage without unsafe should lint
+    depr_safe_future();
+    depr_safe_future();
+
+    // test for fn() coercion where arguments match (no args)
+    let depr_safe_generic_fn_ptr: fn() = depr_safe_future;
+
+    // test for fn() coercion where arguments don't match, where an
+    // intermediate fn() will be used
+    let depr_safe_generic_fn_ptr: fn() = depr_safe_future;
+    let depr_safe_generic_fn_impl: Box<dyn Fn()> = Box::new(depr_safe_future);
+    let mut depr_safe_generic_fnmut_impl: Box<dyn FnMut()> = Box::new(depr_safe_future);
+    let depr_safe_generic_fnonce_impl: Box<dyn FnOnce()> = Box::new(depr_safe_future);
+
+    // these shouldn't lint, appropriate unsafe usage
+    let unsafe_depr_safe_generic_fn_ptr: unsafe fn() = depr_safe_future;
+    fn_taking_unsafe_fn_ptr(depr_safe_future);
+    unsafe {
+        //~^ WARN unnecessary `unsafe` block
+        depr_safe_future();
+    }
+
+    // all of these coercions should lint
+    fn_taking_fn_ptr(depr_safe_future);
+    fn_taking_dyn_fn_impl(Box::new(depr_safe_future));
+    fn_taking_dyn_fnmut_impl(Box::new(depr_safe_future));
+    fn_taking_dyn_fnonce_impl(Box::new(depr_safe_future));
+    fn_taking_fn_impl(depr_safe_future);
+    fn_taking_fnmut_impl(depr_safe_future);
+    fn_taking_fnonce_impl(depr_safe_future);
+}
+
+fn fn_taking_fn_ptr(_: fn()) {}
+fn fn_taking_unsafe_fn_ptr(_: unsafe fn()) {}
+
+fn fn_taking_dyn_fn_impl(_: Box<dyn Fn()>) {}
+fn fn_taking_dyn_fnmut_impl(_: Box<dyn FnMut()>) {}
+fn fn_taking_dyn_fnonce_impl(_: Box<dyn FnOnce()>) {}
+
+fn fn_taking_fn_impl(_: impl Fn()) {}
+fn fn_taking_fnmut_impl(_: impl FnMut()) {}
+fn fn_taking_fnonce_impl(_: impl FnOnce()) {}
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-future.thir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-future.thir.stderr
new file mode 100644
index 0000000000000..2f35f791d31e5
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-future.thir.stderr
@@ -0,0 +1,14 @@
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-future.rs:74:5
+   |
+LL |     unsafe {
+   |     ^^^^^^ unnecessary `unsafe` block
+   |
+note: the lint level is defined here
+  --> $DIR/deprecated-safe-future.rs:7:9
+   |
+LL | #![warn(unused_unsafe)]
+   |         ^^^^^^^^^^^^^
+
+warning: 1 warning emitted
+
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-mismatch-staged.mir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-mismatch-staged.mir.stderr
new file mode 100644
index 0000000000000..a87b39430bdec
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-mismatch-staged.mir.stderr
@@ -0,0 +1,33 @@
+error[E0543]: item must be marked unsafe
+  --> $DIR/deprecated-safe-mismatch-staged.rs:12:1
+   |
+LL | fn foo0() {}
+   | ^^^^^^^^^^^^
+
+error[E0543]: item must be marked unsafe
+  --> $DIR/deprecated-safe-mismatch-staged.rs:15:1
+   |
+LL | trait PreviouslySafeTrait {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0543]: item must be marked unsafe
+  --> $DIR/deprecated-safe-mismatch-staged.rs:31:5
+   |
+LL |     fn foo0();
+   |     ^^^^^^^^^^
+
+error[E0543]: item must not be marked unsafe
+  --> $DIR/deprecated-safe-mismatch-staged.rs:34:5
+   |
+LL |     unsafe fn foo1();
+   |     ^^^^^^^^^^^^^^^^^
+
+error[E0543]: item must not be marked unsafe
+  --> $DIR/deprecated-safe-mismatch-staged.rs:37:5
+   |
+LL |     unsafe fn foo2();
+   |     ^^^^^^^^^^^^^^^^^
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0543`.
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-mismatch-staged.rs b/src/test/ui/deprecated-safe/deprecated-safe-mismatch-staged.rs
new file mode 100644
index 0000000000000..f369e2dfaf62c
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-mismatch-staged.rs
@@ -0,0 +1,40 @@
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
+#![feature(deprecated_safe)]
+#![feature(staged_api)]
+#![stable(feature = "deprecated-safe-test", since = "1.61.0")]
+#![warn(deprecated_safe_in_future, unused_unsafe)]
+
+use std::ffi::{OsStr, OsString};
+
+#[deprecated_safe(since = "1.61.0", note = "reason")]
+fn foo0() {} //~ ERROR item must be marked unsafe
+
+#[deprecated_safe(since = "1.61.0", note = "reason")]
+trait PreviouslySafeTrait {} //~ ERROR item must be marked unsafe
+
+#[deprecated_safe(since = "99.99.99", note = "reason")]
+fn foo0_future() {}
+
+#[deprecated_safe(since = "99.99.99", note = "reason")]
+trait PreviouslySafeTraitFuture {}
+
+#[deprecated_safe(since = "TBD", note = "reason")]
+fn foo0_tbd() {}
+
+#[deprecated_safe(since = "TBD", note = "reason")]
+trait PreviouslySafeTraitTbd {}
+
+trait PreviouslySafeFunctions {
+    #[deprecated_safe(since = "1.61.0", note = "reason")]
+    fn foo0(); //~ ERROR item must be marked unsafe
+
+    #[deprecated_safe(since = "99.99.99", note = "reason")]
+    unsafe fn foo1(); //~ ERROR item must not be marked unsafe
+
+    #[deprecated_safe(since = "TBD", note = "reason")]
+    unsafe fn foo2(); //~ ERROR item must not be marked unsafe
+}
+
+fn main() {}
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-mismatch-staged.thir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-mismatch-staged.thir.stderr
new file mode 100644
index 0000000000000..a87b39430bdec
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-mismatch-staged.thir.stderr
@@ -0,0 +1,33 @@
+error[E0543]: item must be marked unsafe
+  --> $DIR/deprecated-safe-mismatch-staged.rs:12:1
+   |
+LL | fn foo0() {}
+   | ^^^^^^^^^^^^
+
+error[E0543]: item must be marked unsafe
+  --> $DIR/deprecated-safe-mismatch-staged.rs:15:1
+   |
+LL | trait PreviouslySafeTrait {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0543]: item must be marked unsafe
+  --> $DIR/deprecated-safe-mismatch-staged.rs:31:5
+   |
+LL |     fn foo0();
+   |     ^^^^^^^^^^
+
+error[E0543]: item must not be marked unsafe
+  --> $DIR/deprecated-safe-mismatch-staged.rs:34:5
+   |
+LL |     unsafe fn foo1();
+   |     ^^^^^^^^^^^^^^^^^
+
+error[E0543]: item must not be marked unsafe
+  --> $DIR/deprecated-safe-mismatch-staged.rs:37:5
+   |
+LL |     unsafe fn foo2();
+   |     ^^^^^^^^^^^^^^^^^
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0543`.
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-mismatch.mir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-mismatch.mir.stderr
new file mode 100644
index 0000000000000..cbaa44220f6c3
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-mismatch.mir.stderr
@@ -0,0 +1,57 @@
+error[E0543]: item must be marked unsafe
+  --> $DIR/deprecated-safe-mismatch.rs:10:1
+   |
+LL | fn foo0() {}
+   | ^^^^^^^^^^^^
+
+error[E0543]: item must be marked unsafe
+  --> $DIR/deprecated-safe-mismatch.rs:13:1
+   |
+LL | trait PreviouslySafeTrait {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0543]: item must be marked unsafe
+  --> $DIR/deprecated-safe-mismatch.rs:16:1
+   |
+LL | fn foo0_future() {}
+   | ^^^^^^^^^^^^^^^^^^^
+
+error[E0543]: item must be marked unsafe
+  --> $DIR/deprecated-safe-mismatch.rs:19:1
+   |
+LL | trait PreviouslySafeTraitFuture {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0543]: item must be marked unsafe
+  --> $DIR/deprecated-safe-mismatch.rs:22:1
+   |
+LL | fn foo0_tbd() {}
+   | ^^^^^^^^^^^^^^^^
+
+error[E0543]: item must be marked unsafe
+  --> $DIR/deprecated-safe-mismatch.rs:25:1
+   |
+LL | trait PreviouslySafeTraitTbd {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0543]: item must be marked unsafe
+  --> $DIR/deprecated-safe-mismatch.rs:29:5
+   |
+LL |     fn foo0();
+   |     ^^^^^^^^^^
+
+error[E0543]: item must be marked unsafe
+  --> $DIR/deprecated-safe-mismatch.rs:32:5
+   |
+LL |     fn foo1();
+   |     ^^^^^^^^^^
+
+error[E0543]: item must be marked unsafe
+  --> $DIR/deprecated-safe-mismatch.rs:35:5
+   |
+LL |     fn foo2();
+   |     ^^^^^^^^^^
+
+error: aborting due to 9 previous errors
+
+For more information about this error, try `rustc --explain E0543`.
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-mismatch.rs b/src/test/ui/deprecated-safe/deprecated-safe-mismatch.rs
new file mode 100644
index 0000000000000..67fdc671c5b7a
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-mismatch.rs
@@ -0,0 +1,38 @@
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
+#![feature(deprecated_safe)]
+#![warn(unused_unsafe)]
+
+use std::ffi::{OsStr, OsString};
+
+#[deprecated_safe(since = "1.61.0", note = "reason")]
+fn foo0() {} //~ ERROR item must be marked unsafe
+
+#[deprecated_safe(since = "1.61.0", note = "reason")]
+trait PreviouslySafeTrait {} //~ ERROR item must be marked unsafe
+
+#[deprecated_safe(since = "99.99.99", note = "reason")]
+fn foo0_future() {} //~ ERROR item must be marked unsafe
+
+#[deprecated_safe(since = "99.99.99", note = "reason")]
+trait PreviouslySafeTraitFuture {} //~ ERROR item must be marked unsafe
+
+#[deprecated_safe(since = "TBD", note = "reason")]
+fn foo0_tbd() {} //~ ERROR item must be marked unsafe
+
+#[deprecated_safe(since = "TBD", note = "reason")]
+trait PreviouslySafeTraitTbd {} //~ ERROR item must be marked unsafe
+
+trait PreviouslySafeFunctions {
+    #[deprecated_safe(since = "1.61.0", note = "reason")]
+    fn foo0(); //~ ERROR item must be marked unsafe
+
+    #[deprecated_safe(since = "99.99.99", note = "reason")]
+    fn foo1(); //~ ERROR item must be marked unsafe
+
+    #[deprecated_safe(since = "TBD", note = "reason")]
+    fn foo2(); //~ ERROR item must be marked unsafe
+}
+
+fn main() {}
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-mismatch.thir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-mismatch.thir.stderr
new file mode 100644
index 0000000000000..cbaa44220f6c3
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-mismatch.thir.stderr
@@ -0,0 +1,57 @@
+error[E0543]: item must be marked unsafe
+  --> $DIR/deprecated-safe-mismatch.rs:10:1
+   |
+LL | fn foo0() {}
+   | ^^^^^^^^^^^^
+
+error[E0543]: item must be marked unsafe
+  --> $DIR/deprecated-safe-mismatch.rs:13:1
+   |
+LL | trait PreviouslySafeTrait {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0543]: item must be marked unsafe
+  --> $DIR/deprecated-safe-mismatch.rs:16:1
+   |
+LL | fn foo0_future() {}
+   | ^^^^^^^^^^^^^^^^^^^
+
+error[E0543]: item must be marked unsafe
+  --> $DIR/deprecated-safe-mismatch.rs:19:1
+   |
+LL | trait PreviouslySafeTraitFuture {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0543]: item must be marked unsafe
+  --> $DIR/deprecated-safe-mismatch.rs:22:1
+   |
+LL | fn foo0_tbd() {}
+   | ^^^^^^^^^^^^^^^^
+
+error[E0543]: item must be marked unsafe
+  --> $DIR/deprecated-safe-mismatch.rs:25:1
+   |
+LL | trait PreviouslySafeTraitTbd {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0543]: item must be marked unsafe
+  --> $DIR/deprecated-safe-mismatch.rs:29:5
+   |
+LL |     fn foo0();
+   |     ^^^^^^^^^^
+
+error[E0543]: item must be marked unsafe
+  --> $DIR/deprecated-safe-mismatch.rs:32:5
+   |
+LL |     fn foo1();
+   |     ^^^^^^^^^^
+
+error[E0543]: item must be marked unsafe
+  --> $DIR/deprecated-safe-mismatch.rs:35:5
+   |
+LL |     fn foo2();
+   |     ^^^^^^^^^^
+
+error: aborting due to 9 previous errors
+
+For more information about this error, try `rustc --explain E0543`.
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-third-party.mir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-third-party.mir.stderr
new file mode 100644
index 0000000000000..249cd46784e6a
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-third-party.mir.stderr
@@ -0,0 +1,1134 @@
+warning: use of trait `PreviouslySafeTrait` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+  --> $DIR/deprecated-safe-third-party.rs:99:1
+   |
+LL | impl PreviouslySafeTrait for PreviouslySafeTraitImpl {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(deprecated_safe)]` on by default
+   = note: this trait was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the trait's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of trait `PreviouslySafeTraitFuture` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+  --> $DIR/deprecated-safe-third-party.rs:100:1
+   |
+LL | impl PreviouslySafeTraitFuture for PreviouslySafeTraitImpl {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this trait was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the trait's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of trait `PreviouslySafeTraitTbd` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+  --> $DIR/deprecated-safe-third-party.rs:101:1
+   |
+LL | impl PreviouslySafeTraitTbd for PreviouslySafeTraitImpl {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this trait was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the trait's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:51:5
+   |
+LL |     set_var
+   |     ^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:51:5
+   |
+LL |     set_var
+   |     ^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:51:5
+   |
+LL |     set_var
+   |     ^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:51:5
+   |
+LL |     set_var
+   |     ^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:57:14
+   |
+LL | fn foo4() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:57:14
+   |
+LL | fn foo4() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:57:46
+   |
+LL |   fn foo4() -> impl FnOnce(OsString, OsString) {
+   |  ______________________________________________^
+LL | |
+LL | |
+LL | |
+...  |
+LL | |
+LL | | }
+   | |_^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:67:5
+   |
+LL |     set_var_future
+   |     ^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:67:5
+   |
+LL |     set_var_future
+   |     ^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:73:14
+   |
+LL | fn foo6() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:73:14
+   |
+LL | fn foo6() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:73:46
+   |
+LL |   fn foo6() -> impl FnOnce(OsString, OsString) {
+   |  ______________________________________________^
+LL | |
+LL | |
+LL | |
+...  |
+LL | |
+LL | | }
+   | |_^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:83:5
+   |
+LL |     set_var_tbd
+   |     ^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:83:5
+   |
+LL |     set_var_tbd
+   |     ^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:89:14
+   |
+LL | fn foo8() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:89:14
+   |
+LL | fn foo8() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:89:46
+   |
+LL |   fn foo8() -> impl FnOnce(OsString, OsString) {
+   |  ______________________________________________^
+LL | |
+LL | |
+LL | |
+...  |
+LL | |
+LL | | }
+   | |_^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:104:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(set_var);
+   |                                                    ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:104:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(set_var);
+   |                                                    ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:104:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(set_var);
+   |                                                    ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:107:55
+   |
+LL |     let fn_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(set_var);
+   |                                                       ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:107:55
+   |
+LL |     let fn_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(set_var);
+   |                                                       ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:109:56
+   |
+LL |     let fn_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(set_var);
+   |                                                        ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:109:56
+   |
+LL |     let fn_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(set_var);
+   |                                                        ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:112:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(set_var_future);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:112:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(set_var_future);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:112:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(set_var_future);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:115:55
+   |
+LL |     let fn_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(set_var_future);
+   |                                                       ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:115:55
+   |
+LL |     let fn_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(set_var_future);
+   |                                                       ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:117:56
+   |
+LL |     let fn_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(set_var_future);
+   |                                                        ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:117:56
+   |
+LL |     let fn_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(set_var_future);
+   |                                                        ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:120:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(set_var_tbd);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:120:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(set_var_tbd);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:120:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(set_var_tbd);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:123:55
+   |
+LL |     let fn_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(set_var_tbd);
+   |                                                       ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:123:55
+   |
+LL |     let fn_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(set_var_tbd);
+   |                                                       ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:125:56
+   |
+LL |     let fn_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(set_var_tbd);
+   |                                                        ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:125:56
+   |
+LL |     let fn_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(set_var_tbd);
+   |                                                        ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:128:5
+   |
+LL |     fn_taking_fn_impl(set_var);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:129:5
+   |
+LL |     fn_taking_fnmut_impl(set_var);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:130:5
+   |
+LL |     fn_taking_fnonce_impl(set_var);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:132:5
+   |
+LL |     fn_taking_fn_impl(set_var_future);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:133:5
+   |
+LL |     fn_taking_fnmut_impl(set_var_future);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:134:5
+   |
+LL |     fn_taking_fnonce_impl(set_var_future);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:136:5
+   |
+LL |     fn_taking_fn_impl(set_var_tbd);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:137:5
+   |
+LL |     fn_taking_fnmut_impl(set_var_tbd);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:138:5
+   |
+LL |     fn_taking_fnonce_impl(set_var_tbd);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:150:50
+   |
+LL |     let set_var_fn_ptr: fn(OsString, OsString) = set_var;
+   |                                                  ^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:151:50
+   |
+LL |     let set_var_fn_ptr: fn(OsString, OsString) = set_var_future;
+   |                                                  ^^^^^^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:152:50
+   |
+LL |     let set_var_fn_ptr: fn(OsString, OsString) = set_var_tbd;
+   |                                                  ^^^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:168:22
+   |
+LL |     fn_taking_fn_ptr(set_var);
+   |                      ^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:169:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(set_var));
+   |                           ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:169:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(set_var));
+   |                           ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:171:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(set_var));
+   |                              ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:171:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(set_var));
+   |                              ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:173:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(set_var));
+   |                               ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:173:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(set_var));
+   |                               ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:175:5
+   |
+LL |     fn_taking_fn_impl(set_var);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:176:5
+   |
+LL |     fn_taking_fnmut_impl(set_var);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:177:5
+   |
+LL |     fn_taking_fnonce_impl(set_var);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:180:22
+   |
+LL |     fn_taking_fn_ptr(set_var_future);
+   |                      ^^^^^^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:181:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(set_var_future));
+   |                           ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:181:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(set_var_future));
+   |                           ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:183:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(set_var_future));
+   |                              ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:183:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(set_var_future));
+   |                              ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:185:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(set_var_future));
+   |                               ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:185:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(set_var_future));
+   |                               ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:187:5
+   |
+LL |     fn_taking_fn_impl(set_var_future);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:188:5
+   |
+LL |     fn_taking_fnmut_impl(set_var_future);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:189:5
+   |
+LL |     fn_taking_fnonce_impl(set_var_future);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:191:22
+   |
+LL |     fn_taking_fn_ptr(set_var_tbd);
+   |                      ^^^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:192:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(set_var_tbd));
+   |                           ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:192:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(set_var_tbd));
+   |                           ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:194:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(set_var_tbd));
+   |                              ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:194:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(set_var_tbd));
+   |                              ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:196:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(set_var_tbd));
+   |                               ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:196:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(set_var_tbd));
+   |                               ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:198:5
+   |
+LL |     fn_taking_fn_impl(set_var_tbd);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:199:5
+   |
+LL |     fn_taking_fnmut_impl(set_var_tbd);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:200:5
+   |
+LL |     fn_taking_fnonce_impl(set_var_tbd);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:39:13
+   |
+LL | type Tait = impl FnOnce(OsString, OsString);
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:39:13
+   |
+LL | type Tait = impl FnOnce(OsString, OsString);
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:83:5
+   |
+LL |     set_var_tbd
+   |     ^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:83:5
+   |
+LL |     set_var_tbd
+   |     ^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:41:16
+   |
+LL | type TaitTbd = impl FnOnce(OsString, OsString);
+   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:41:16
+   |
+LL | type TaitTbd = impl FnOnce(OsString, OsString);
+   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:67:5
+   |
+LL |     set_var_future
+   |     ^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:67:5
+   |
+LL |     set_var_future
+   |     ^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:43:19
+   |
+LL | type TaitFuture = impl FnOnce(OsString, OsString);
+   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:43:19
+   |
+LL | type TaitFuture = impl FnOnce(OsString, OsString);
+   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:62:5
+   |
+LL |     set_var
+   |     ^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:62:5
+   |
+LL |     set_var
+   |     ^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:57:14
+   |
+LL | fn foo4() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:57:14
+   |
+LL | fn foo4() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:78:5
+   |
+LL |     set_var_future
+   |     ^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:78:5
+   |
+LL |     set_var_future
+   |     ^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:73:14
+   |
+LL | fn foo6() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:73:14
+   |
+LL | fn foo6() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:94:5
+   |
+LL |     set_var_tbd
+   |     ^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:94:5
+   |
+LL |     set_var_tbd
+   |     ^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:89:14
+   |
+LL | fn foo8() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:89:14
+   |
+LL | fn foo8() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` without an unsafe function or block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:141:5
+   |
+LL |     set_var("TEST_DEPRECATED_SAFE", "set_var_safe");
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` without an unsafe function or block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:142:5
+   |
+LL |     set_var("TEST_DEPRECATED_SAFE", "set_var_safe");
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` without an unsafe function or block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:144:5
+   |
+LL |     set_var_future("TEST_DEPRECATED_SAFE", "set_var_safe");
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` without an unsafe function or block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:145:5
+   |
+LL |     set_var_future("TEST_DEPRECATED_SAFE", "set_var_safe");
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` without an unsafe function or block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:147:5
+   |
+LL |     set_var_tbd("TEST_DEPRECATED_SAFE", "set_var_safe");
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` without an unsafe function or block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:148:5
+   |
+LL |     set_var_tbd("TEST_DEPRECATED_SAFE", "set_var_safe");
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: 111 warnings emitted
+
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-third-party.rs b/src/test/ui/deprecated-safe/deprecated-safe-third-party.rs
new file mode 100644
index 0000000000000..0032e682c5150
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-third-party.rs
@@ -0,0 +1,212 @@
+// check-pass
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
+#![feature(deprecated_safe)]
+#![feature(type_alias_impl_trait)]
+#![warn(unused_unsafe)]
+
+use std::ffi::{OsStr, OsString};
+
+#[deprecated_safe(since = "1.61.0", note = "reason")]
+unsafe fn set_var<K: AsRef<OsStr>, V: AsRef<OsStr>>(key: K, value: V) {
+    std::env::set_var(key, value)
+}
+
+#[deprecated_safe(since = "1.61.0", note = "reason")]
+unsafe trait PreviouslySafeTrait {}
+
+#[deprecated_safe(since = "99.99.99", note = "reason")]
+unsafe fn set_var_future<K: AsRef<OsStr>, V: AsRef<OsStr>>(key: K, value: V) {
+    std::env::set_var(key, value)
+}
+
+#[deprecated_safe(since = "99.99.99", note = "reason")]
+unsafe trait PreviouslySafeTraitFuture {}
+
+#[deprecated_safe(since = "TBD", note = "reason")]
+unsafe fn set_var_tbd<K: AsRef<OsStr>, V: AsRef<OsStr>>(key: K, value: V) {
+    std::env::set_var(key, value)
+}
+
+#[deprecated_safe(since = "TBD", note = "reason")]
+unsafe trait PreviouslySafeTraitTbd {}
+
+trait Bla {
+    type T;
+}
+
+type Tait = impl FnOnce(OsString, OsString); //~ WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+//~| WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+type TaitTbd = impl FnOnce(OsString, OsString); //~ WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+//~| WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+type TaitFuture = impl FnOnce(OsString, OsString); //~ WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+//~| WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+
+impl Bla for u32 {
+    type T = Tait;
+}
+
+fn foo3() -> Tait {
+    set_var //~ WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+}
+
+fn foo4() -> impl FnOnce(OsString, OsString) { //~ WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+    set_var //~ WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+}
+
+fn foo5() -> TaitFuture {
+    set_var_future //~ WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+}
+
+fn foo6() -> impl FnOnce(OsString, OsString) { //~ WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+    set_var_future //~ WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+}
+
+fn foo7() -> TaitTbd {
+    set_var_tbd //~ WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+}
+
+fn foo8() -> impl FnOnce(OsString, OsString) { //~ WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+    set_var_tbd //~ WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+}
+
+struct PreviouslySafeTraitImpl;
+impl PreviouslySafeTrait for PreviouslySafeTraitImpl {} //~ WARN use of trait `PreviouslySafeTrait` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+impl PreviouslySafeTraitFuture for PreviouslySafeTraitImpl {} //~ WARN use of trait `PreviouslySafeTraitFuture` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+impl PreviouslySafeTraitTbd for PreviouslySafeTraitImpl {} //~ WARN use of trait `PreviouslySafeTraitTbd` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+
+fn main() {
+    let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(set_var); //~ WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+                                                                      //~| WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+                                                                      //~| WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+    let fn_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(set_var); //~ WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+                                                                         //~| WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+    let fn_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(set_var); //~ WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+                                                                          //~| WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+
+    let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(set_var_future); //~ WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+                                                                                 //~| WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+                                                                                 //~| WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+    let fn_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(set_var_future); //~ WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+                                                                                //~| WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+    let fn_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(set_var_future); //~ WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+                                                                                 //~| WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+
+    let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(set_var_tbd); //~ WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+                                                                          //~| WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+                                                                          //~| WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+    let fn_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(set_var_tbd); //~ WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+                                                                             //~| WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+    let fn_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(set_var_tbd); //~ WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+                                                                              //~| WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+    // test for non-dyn Fn() coercion (no unsizing)
+    fn_taking_fn_impl(set_var); //~ WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnmut_impl(set_var); //~ WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnonce_impl(set_var); //~ WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+
+    fn_taking_fn_impl(set_var_future); //~ WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnmut_impl(set_var_future); //~ WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnonce_impl(set_var_future); //~ WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+
+    fn_taking_fn_impl(set_var_tbd); //~ WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnmut_impl(set_var_tbd); //~ WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnonce_impl(set_var_tbd); //~ WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+
+    // usage without unsafe should lint
+    set_var("TEST_DEPRECATED_SAFE", "set_var_safe"); //~ WARN use of function `set_var` without an unsafe function or block has been deprecated as it is now an unsafe function
+    set_var("TEST_DEPRECATED_SAFE", "set_var_safe"); //~ WARN use of function `set_var` without an unsafe function or block has been deprecated as it is now an unsafe function
+
+    set_var_future("TEST_DEPRECATED_SAFE", "set_var_safe"); //~ WARN use of function `set_var_future` without an unsafe function or block has been deprecated as it is now an unsafe function
+    set_var_future("TEST_DEPRECATED_SAFE", "set_var_safe"); //~ WARN use of function `set_var_future` without an unsafe function or block has been deprecated as it is now an unsafe function
+
+    set_var_tbd("TEST_DEPRECATED_SAFE", "set_var_safe"); //~ WARN use of function `set_var_tbd` without an unsafe function or block has been deprecated as it is now an unsafe function
+    set_var_tbd("TEST_DEPRECATED_SAFE", "set_var_safe"); //~ WARN use of function `set_var_tbd` without an unsafe function or block has been deprecated as it is now an unsafe function
+
+    let set_var_fn_ptr: fn(OsString, OsString) = set_var; //~ WARN use of function `set_var` as a normal fn pointer has been deprecated as it is now an unsafe function
+    let set_var_fn_ptr: fn(OsString, OsString) = set_var_future; //~ WARN use of function `set_var_future` as a normal fn pointer has been deprecated as it is now an unsafe function
+    let set_var_fn_ptr: fn(OsString, OsString) = set_var_tbd; //~ WARN use of function `set_var_tbd` as a normal fn pointer has been deprecated as it is now an unsafe function
+
+    // these shouldn't lint, appropriate unsafe usage
+    let unsafe_set_var_fn_ptr: unsafe fn(OsString, OsString) = set_var;
+    let unsafe_set_var_fn_ptr: unsafe fn(OsString, OsString) = set_var_future;
+    let unsafe_set_var_fn_ptr: unsafe fn(OsString, OsString) = set_var_tbd;
+    fn_taking_unsafe_fn_ptr(set_var);
+    fn_taking_unsafe_fn_ptr(set_var_future);
+    fn_taking_unsafe_fn_ptr(set_var_tbd);
+    unsafe {
+        set_var("TEST_DEPRECATED_SAFE", "set_var_unsafe");
+        set_var_future("TEST_DEPRECATED_SAFE", "set_var_unsafe");
+        set_var_tbd("TEST_DEPRECATED_SAFE", "set_var_unsafe");
+    }
+
+    // all of these coercions should lint
+    fn_taking_fn_ptr(set_var); //~ WARN use of function `set_var` as a normal fn pointer has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fn_impl(Box::new(set_var)); //~ WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+                                                  //~| WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnmut_impl(Box::new(set_var)); //~ WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+                                                  //~| WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnonce_impl(Box::new(set_var)); //~ WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+                                                  //~| WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fn_impl(set_var); //~ WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnmut_impl(set_var); //~ WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnonce_impl(set_var); //~ WARN use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+
+
+    fn_taking_fn_ptr(set_var_future); //~ WARN use of function `set_var_future` as a normal fn pointer has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fn_impl(Box::new(set_var_future)); //~ WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+                                              //~| WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnmut_impl(Box::new(set_var_future)); //~ WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+                                                 //~| WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnonce_impl(Box::new(set_var_future)); //~ WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+                                                  //~| WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fn_impl(set_var_future); //~ WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnmut_impl(set_var_future); //~ WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnonce_impl(set_var_future); //~ WARN use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+
+    fn_taking_fn_ptr(set_var_tbd); //~ WARN use of function `set_var_tbd` as a normal fn pointer has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fn_impl(Box::new(set_var_tbd)); //~ WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+                                                  //~| WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnmut_impl(Box::new(set_var_tbd)); //~ WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+                                                  //~| WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnonce_impl(Box::new(set_var_tbd)); //~ WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+                                                  //~| WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fn_impl(set_var_tbd); //~ WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnmut_impl(set_var_tbd); //~ WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnonce_impl(set_var_tbd); //~ WARN use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+}
+
+fn fn_taking_fn_ptr(_: fn(OsString, OsString)) {}
+fn fn_taking_unsafe_fn_ptr(_: unsafe fn(OsString, OsString)) {}
+
+fn fn_taking_dyn_fn_impl(_: Box<dyn Fn(OsString, OsString)>) {}
+fn fn_taking_dyn_fnmut_impl(_: Box<dyn FnMut(OsString, OsString)>) {}
+fn fn_taking_dyn_fnonce_impl(_: Box<dyn FnOnce(OsString, OsString)>) {}
+
+fn fn_taking_fn_impl(_: impl Fn(OsString, OsString)) {}
+fn fn_taking_fnmut_impl(_: impl FnMut(OsString, OsString)) {}
+fn fn_taking_fnonce_impl(_: impl FnOnce(OsString, OsString)) {}
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-third-party.thir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-third-party.thir.stderr
new file mode 100644
index 0000000000000..249cd46784e6a
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-third-party.thir.stderr
@@ -0,0 +1,1134 @@
+warning: use of trait `PreviouslySafeTrait` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+  --> $DIR/deprecated-safe-third-party.rs:99:1
+   |
+LL | impl PreviouslySafeTrait for PreviouslySafeTraitImpl {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(deprecated_safe)]` on by default
+   = note: this trait was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the trait's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of trait `PreviouslySafeTraitFuture` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+  --> $DIR/deprecated-safe-third-party.rs:100:1
+   |
+LL | impl PreviouslySafeTraitFuture for PreviouslySafeTraitImpl {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this trait was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the trait's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of trait `PreviouslySafeTraitTbd` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+  --> $DIR/deprecated-safe-third-party.rs:101:1
+   |
+LL | impl PreviouslySafeTraitTbd for PreviouslySafeTraitImpl {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this trait was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the trait's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:51:5
+   |
+LL |     set_var
+   |     ^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:51:5
+   |
+LL |     set_var
+   |     ^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:51:5
+   |
+LL |     set_var
+   |     ^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:51:5
+   |
+LL |     set_var
+   |     ^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:57:14
+   |
+LL | fn foo4() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:57:14
+   |
+LL | fn foo4() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:57:46
+   |
+LL |   fn foo4() -> impl FnOnce(OsString, OsString) {
+   |  ______________________________________________^
+LL | |
+LL | |
+LL | |
+...  |
+LL | |
+LL | | }
+   | |_^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:67:5
+   |
+LL |     set_var_future
+   |     ^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:67:5
+   |
+LL |     set_var_future
+   |     ^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:73:14
+   |
+LL | fn foo6() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:73:14
+   |
+LL | fn foo6() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:73:46
+   |
+LL |   fn foo6() -> impl FnOnce(OsString, OsString) {
+   |  ______________________________________________^
+LL | |
+LL | |
+LL | |
+...  |
+LL | |
+LL | | }
+   | |_^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:83:5
+   |
+LL |     set_var_tbd
+   |     ^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:83:5
+   |
+LL |     set_var_tbd
+   |     ^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:89:14
+   |
+LL | fn foo8() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:89:14
+   |
+LL | fn foo8() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:89:46
+   |
+LL |   fn foo8() -> impl FnOnce(OsString, OsString) {
+   |  ______________________________________________^
+LL | |
+LL | |
+LL | |
+...  |
+LL | |
+LL | | }
+   | |_^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:104:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(set_var);
+   |                                                    ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:104:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(set_var);
+   |                                                    ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:104:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(set_var);
+   |                                                    ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:107:55
+   |
+LL |     let fn_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(set_var);
+   |                                                       ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:107:55
+   |
+LL |     let fn_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(set_var);
+   |                                                       ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:109:56
+   |
+LL |     let fn_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(set_var);
+   |                                                        ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:109:56
+   |
+LL |     let fn_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(set_var);
+   |                                                        ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:112:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(set_var_future);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:112:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(set_var_future);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:112:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(set_var_future);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:115:55
+   |
+LL |     let fn_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(set_var_future);
+   |                                                       ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:115:55
+   |
+LL |     let fn_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(set_var_future);
+   |                                                       ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:117:56
+   |
+LL |     let fn_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(set_var_future);
+   |                                                        ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:117:56
+   |
+LL |     let fn_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(set_var_future);
+   |                                                        ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:120:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(set_var_tbd);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:120:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(set_var_tbd);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:120:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(set_var_tbd);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:123:55
+   |
+LL |     let fn_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(set_var_tbd);
+   |                                                       ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:123:55
+   |
+LL |     let fn_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(set_var_tbd);
+   |                                                       ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:125:56
+   |
+LL |     let fn_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(set_var_tbd);
+   |                                                        ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:125:56
+   |
+LL |     let fn_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(set_var_tbd);
+   |                                                        ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:128:5
+   |
+LL |     fn_taking_fn_impl(set_var);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:129:5
+   |
+LL |     fn_taking_fnmut_impl(set_var);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:130:5
+   |
+LL |     fn_taking_fnonce_impl(set_var);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:132:5
+   |
+LL |     fn_taking_fn_impl(set_var_future);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:133:5
+   |
+LL |     fn_taking_fnmut_impl(set_var_future);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:134:5
+   |
+LL |     fn_taking_fnonce_impl(set_var_future);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:136:5
+   |
+LL |     fn_taking_fn_impl(set_var_tbd);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:137:5
+   |
+LL |     fn_taking_fnmut_impl(set_var_tbd);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:138:5
+   |
+LL |     fn_taking_fnonce_impl(set_var_tbd);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:150:50
+   |
+LL |     let set_var_fn_ptr: fn(OsString, OsString) = set_var;
+   |                                                  ^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:151:50
+   |
+LL |     let set_var_fn_ptr: fn(OsString, OsString) = set_var_future;
+   |                                                  ^^^^^^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:152:50
+   |
+LL |     let set_var_fn_ptr: fn(OsString, OsString) = set_var_tbd;
+   |                                                  ^^^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:168:22
+   |
+LL |     fn_taking_fn_ptr(set_var);
+   |                      ^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:169:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(set_var));
+   |                           ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:169:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(set_var));
+   |                           ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:171:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(set_var));
+   |                              ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:171:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(set_var));
+   |                              ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:173:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(set_var));
+   |                               ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:173:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(set_var));
+   |                               ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:175:5
+   |
+LL |     fn_taking_fn_impl(set_var);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:176:5
+   |
+LL |     fn_taking_fnmut_impl(set_var);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:177:5
+   |
+LL |     fn_taking_fnonce_impl(set_var);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:180:22
+   |
+LL |     fn_taking_fn_ptr(set_var_future);
+   |                      ^^^^^^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:181:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(set_var_future));
+   |                           ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:181:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(set_var_future));
+   |                           ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:183:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(set_var_future));
+   |                              ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:183:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(set_var_future));
+   |                              ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:185:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(set_var_future));
+   |                               ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:185:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(set_var_future));
+   |                               ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:187:5
+   |
+LL |     fn_taking_fn_impl(set_var_future);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:188:5
+   |
+LL |     fn_taking_fnmut_impl(set_var_future);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:189:5
+   |
+LL |     fn_taking_fnonce_impl(set_var_future);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:191:22
+   |
+LL |     fn_taking_fn_ptr(set_var_tbd);
+   |                      ^^^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:192:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(set_var_tbd));
+   |                           ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:192:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(set_var_tbd));
+   |                           ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:194:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(set_var_tbd));
+   |                              ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:194:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(set_var_tbd));
+   |                              ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:196:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(set_var_tbd));
+   |                               ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:196:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(set_var_tbd));
+   |                               ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:198:5
+   |
+LL |     fn_taking_fn_impl(set_var_tbd);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:199:5
+   |
+LL |     fn_taking_fnmut_impl(set_var_tbd);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:200:5
+   |
+LL |     fn_taking_fnonce_impl(set_var_tbd);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:39:13
+   |
+LL | type Tait = impl FnOnce(OsString, OsString);
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:39:13
+   |
+LL | type Tait = impl FnOnce(OsString, OsString);
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:83:5
+   |
+LL |     set_var_tbd
+   |     ^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:83:5
+   |
+LL |     set_var_tbd
+   |     ^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:41:16
+   |
+LL | type TaitTbd = impl FnOnce(OsString, OsString);
+   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:41:16
+   |
+LL | type TaitTbd = impl FnOnce(OsString, OsString);
+   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:67:5
+   |
+LL |     set_var_future
+   |     ^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:67:5
+   |
+LL |     set_var_future
+   |     ^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:43:19
+   |
+LL | type TaitFuture = impl FnOnce(OsString, OsString);
+   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:43:19
+   |
+LL | type TaitFuture = impl FnOnce(OsString, OsString);
+   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:62:5
+   |
+LL |     set_var
+   |     ^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:62:5
+   |
+LL |     set_var
+   |     ^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:57:14
+   |
+LL | fn foo4() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:57:14
+   |
+LL | fn foo4() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:78:5
+   |
+LL |     set_var_future
+   |     ^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:78:5
+   |
+LL |     set_var_future
+   |     ^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:73:14
+   |
+LL | fn foo6() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:73:14
+   |
+LL | fn foo6() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:94:5
+   |
+LL |     set_var_tbd
+   |     ^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:94:5
+   |
+LL |     set_var_tbd
+   |     ^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:89:14
+   |
+LL | fn foo8() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:89:14
+   |
+LL | fn foo8() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` without an unsafe function or block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:141:5
+   |
+LL |     set_var("TEST_DEPRECATED_SAFE", "set_var_safe");
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var` without an unsafe function or block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:142:5
+   |
+LL |     set_var("TEST_DEPRECATED_SAFE", "set_var_safe");
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` without an unsafe function or block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:144:5
+   |
+LL |     set_var_future("TEST_DEPRECATED_SAFE", "set_var_safe");
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_future` without an unsafe function or block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:145:5
+   |
+LL |     set_var_future("TEST_DEPRECATED_SAFE", "set_var_safe");
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` without an unsafe function or block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:147:5
+   |
+LL |     set_var_tbd("TEST_DEPRECATED_SAFE", "set_var_safe");
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `set_var_tbd` without an unsafe function or block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-third-party.rs:148:5
+   |
+LL |     set_var_tbd("TEST_DEPRECATED_SAFE", "set_var_safe");
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: 111 warnings emitted
+
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-trait-fn-staged.mir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-trait-fn-staged.mir.stderr
new file mode 100644
index 0000000000000..6b4e42a636651
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-trait-fn-staged.mir.stderr
@@ -0,0 +1,58 @@
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe-trait-fn-staged.rs:17:5
+   |
+LL |     fn depr_safe_fn(&self) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(deprecated_safe)]` on by default
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_generic` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe-trait-fn-staged.rs:18:5
+   |
+LL |     fn depr_safe_fn_generic<K: AsRef<OsStr>, V: AsRef<OsStr>>(&self, key: K, value: V) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_future` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe-trait-fn-staged.rs:19:5
+   |
+LL |     fn depr_safe_fn_future(&self) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+note: the lint level is defined here
+  --> $DIR/deprecated-safe-trait-fn-staged.rs:8:9
+   |
+LL | #![warn(deprecated_safe_in_future, unused_unsafe)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+error[E0053]: method `depr_safe_fn_2015` has an incompatible type for trait
+  --> $DIR/deprecated-safe-trait-fn-staged.rs:20:5
+   |
+LL |     fn depr_safe_fn_2015(&self) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected unsafe fn, found normal fn
+   |
+   = note: expected fn pointer `unsafe fn(&BadImpls)`
+              found fn pointer `fn(&BadImpls)`
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_2018` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe-trait-fn-staged.rs:21:5
+   |
+LL |     fn depr_safe_fn_2018(&self) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+error: aborting due to previous error; 4 warnings emitted
+
+For more information about this error, try `rustc --explain E0053`.
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-trait-fn-staged.rs b/src/test/ui/deprecated-safe/deprecated-safe-trait-fn-staged.rs
new file mode 100644
index 0000000000000..695b2d1961dcc
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-trait-fn-staged.rs
@@ -0,0 +1,33 @@
+// aux-build:deprecated-safe.rs
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
+#![feature(deprecated_safe)]
+#![feature(staged_api)]
+#![stable(feature = "deprecated-safe-test", since = "1.61.0")]
+#![warn(deprecated_safe_in_future, unused_unsafe)]
+
+extern crate deprecated_safe;
+
+use deprecated_safe::DeprSafeFns;
+use std::ffi::OsStr;
+
+struct BadImpls;
+impl DeprSafeFns for BadImpls {
+    fn depr_safe_fn(&self) {} //~ WARN use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+    fn depr_safe_fn_generic<K: AsRef<OsStr>, V: AsRef<OsStr>>(&self, key: K, value: V) {} //~ WARN use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_generic` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+    fn depr_safe_fn_future(&self) {} //~ WARN use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_future` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+    fn depr_safe_fn_2015(&self) {} //~ ERROR method `depr_safe_fn_2015` has an incompatible type for trait
+    fn depr_safe_fn_2018(&self) {} //~ WARN use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_2018` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+}
+
+struct GoodImpls;
+impl DeprSafeFns for GoodImpls {
+    unsafe fn depr_safe_fn(&self) {}
+    unsafe fn depr_safe_fn_generic<K: AsRef<OsStr>, V: AsRef<OsStr>>(&self, key: K, value: V) {}
+    unsafe fn depr_safe_fn_future(&self) {}
+    unsafe fn depr_safe_fn_2015(&self) {}
+    unsafe fn depr_safe_fn_2018(&self) {}
+}
+
+fn main() {}
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-trait-fn-staged.thir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-trait-fn-staged.thir.stderr
new file mode 100644
index 0000000000000..6b4e42a636651
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-trait-fn-staged.thir.stderr
@@ -0,0 +1,58 @@
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe-trait-fn-staged.rs:17:5
+   |
+LL |     fn depr_safe_fn(&self) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(deprecated_safe)]` on by default
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_generic` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe-trait-fn-staged.rs:18:5
+   |
+LL |     fn depr_safe_fn_generic<K: AsRef<OsStr>, V: AsRef<OsStr>>(&self, key: K, value: V) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_future` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe-trait-fn-staged.rs:19:5
+   |
+LL |     fn depr_safe_fn_future(&self) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+note: the lint level is defined here
+  --> $DIR/deprecated-safe-trait-fn-staged.rs:8:9
+   |
+LL | #![warn(deprecated_safe_in_future, unused_unsafe)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+error[E0053]: method `depr_safe_fn_2015` has an incompatible type for trait
+  --> $DIR/deprecated-safe-trait-fn-staged.rs:20:5
+   |
+LL |     fn depr_safe_fn_2015(&self) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected unsafe fn, found normal fn
+   |
+   = note: expected fn pointer `unsafe fn(&BadImpls)`
+              found fn pointer `fn(&BadImpls)`
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_2018` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe-trait-fn-staged.rs:21:5
+   |
+LL |     fn depr_safe_fn_2018(&self) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+error: aborting due to previous error; 4 warnings emitted
+
+For more information about this error, try `rustc --explain E0053`.
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-trait-fn.mir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-trait-fn.mir.stderr
new file mode 100644
index 0000000000000..f837d25d5bb6f
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-trait-fn.mir.stderr
@@ -0,0 +1,52 @@
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe-trait-fn.rs:15:5
+   |
+LL |     fn depr_safe_fn(&self) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(deprecated_safe)]` on by default
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_generic` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe-trait-fn.rs:16:5
+   |
+LL |     fn depr_safe_fn_generic<K: AsRef<OsStr>, V: AsRef<OsStr>>(&self, key: K, value: V) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+error[E0053]: method `depr_safe_fn_future` has an incompatible type for trait
+  --> $DIR/deprecated-safe-trait-fn.rs:17:5
+   |
+LL |     unsafe fn depr_safe_fn_future(&self) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected normal fn, found unsafe fn
+   |
+   = note: expected fn pointer `fn(&BadImpls)`
+              found fn pointer `unsafe fn(&BadImpls)`
+
+error[E0053]: method `depr_safe_fn_2015` has an incompatible type for trait
+  --> $DIR/deprecated-safe-trait-fn.rs:18:5
+   |
+LL |     fn depr_safe_fn_2015(&self) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected unsafe fn, found normal fn
+   |
+   = note: expected fn pointer `unsafe fn(&BadImpls)`
+              found fn pointer `fn(&BadImpls)`
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_2018` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe-trait-fn.rs:19:5
+   |
+LL |     fn depr_safe_fn_2018(&self) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+error: aborting due to 2 previous errors; 3 warnings emitted
+
+For more information about this error, try `rustc --explain E0053`.
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-trait-fn.rs b/src/test/ui/deprecated-safe/deprecated-safe-trait-fn.rs
new file mode 100644
index 0000000000000..fdabe5793295a
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-trait-fn.rs
@@ -0,0 +1,31 @@
+// aux-build:deprecated-safe.rs
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
+#![feature(deprecated_safe)]
+#![warn(unused_unsafe)]
+
+extern crate deprecated_safe;
+
+use deprecated_safe::DeprSafeFns;
+use std::ffi::OsStr;
+
+struct BadImpls;
+impl DeprSafeFns for BadImpls {
+    fn depr_safe_fn(&self) {} //~ WARN use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+    fn depr_safe_fn_generic<K: AsRef<OsStr>, V: AsRef<OsStr>>(&self, key: K, value: V) {} //~ WARN use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_generic` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+    unsafe fn depr_safe_fn_future(&self) {} //~ ERROR method `depr_safe_fn_future` has an incompatible type for trait
+    fn depr_safe_fn_2015(&self) {} //~ ERROR method `depr_safe_fn_2015` has an incompatible type for trait
+    fn depr_safe_fn_2018(&self) {} //~ WARN use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_2018` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+}
+
+struct GoodImpls;
+impl DeprSafeFns for GoodImpls {
+    unsafe fn depr_safe_fn(&self) {}
+    unsafe fn depr_safe_fn_generic<K: AsRef<OsStr>, V: AsRef<OsStr>>(&self, key: K, value: V) {}
+    fn depr_safe_fn_future(&self) {}
+    unsafe fn depr_safe_fn_2015(&self) {}
+    unsafe fn depr_safe_fn_2018(&self) {}
+}
+
+fn main() {}
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-trait-fn.thir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-trait-fn.thir.stderr
new file mode 100644
index 0000000000000..f837d25d5bb6f
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-trait-fn.thir.stderr
@@ -0,0 +1,52 @@
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe-trait-fn.rs:15:5
+   |
+LL |     fn depr_safe_fn(&self) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(deprecated_safe)]` on by default
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_generic` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe-trait-fn.rs:16:5
+   |
+LL |     fn depr_safe_fn_generic<K: AsRef<OsStr>, V: AsRef<OsStr>>(&self, key: K, value: V) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+error[E0053]: method `depr_safe_fn_future` has an incompatible type for trait
+  --> $DIR/deprecated-safe-trait-fn.rs:17:5
+   |
+LL |     unsafe fn depr_safe_fn_future(&self) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected normal fn, found unsafe fn
+   |
+   = note: expected fn pointer `fn(&BadImpls)`
+              found fn pointer `unsafe fn(&BadImpls)`
+
+error[E0053]: method `depr_safe_fn_2015` has an incompatible type for trait
+  --> $DIR/deprecated-safe-trait-fn.rs:18:5
+   |
+LL |     fn depr_safe_fn_2015(&self) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected unsafe fn, found normal fn
+   |
+   = note: expected fn pointer `unsafe fn(&BadImpls)`
+              found fn pointer `fn(&BadImpls)`
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_2018` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe-trait-fn.rs:19:5
+   |
+LL |     fn depr_safe_fn_2018(&self) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+error: aborting due to 2 previous errors; 3 warnings emitted
+
+For more information about this error, try `rustc --explain E0053`.
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-trait-impl-staged.mir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-trait-impl-staged.mir.stderr
new file mode 100644
index 0000000000000..3c49d1a6d80c3
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-trait-impl-staged.mir.stderr
@@ -0,0 +1,101 @@
+error[E0198]: negative impls cannot be unsafe
+  --> $DIR/deprecated-safe-trait-impl-staged.rs:24:13
+   |
+LL | unsafe impl !DeprSafe for D {}
+   | ------      -^^^^^^^^
+   | |           |
+   | |           negative because of this
+   | unsafe because of this
+
+error[E0198]: negative impls cannot be unsafe
+  --> $DIR/deprecated-safe-trait-impl-staged.rs:36:13
+   |
+LL | unsafe impl !DeprSafeFuture for H {}
+   | ------      -^^^^^^^^^^^^^^
+   | |           |
+   | |           negative because of this
+   | unsafe because of this
+
+error[E0198]: negative impls cannot be unsafe
+  --> $DIR/deprecated-safe-trait-impl-staged.rs:48:13
+   |
+LL | unsafe impl !DeprSafe2015 for L {}
+   | ------      -^^^^^^^^^^^^
+   | |           |
+   | |           negative because of this
+   | unsafe because of this
+
+error[E0198]: negative impls cannot be unsafe
+  --> $DIR/deprecated-safe-trait-impl-staged.rs:60:13
+   |
+LL | unsafe impl !DeprSafe2015Future for P {}
+   | ------      -^^^^^^^^^^^^^^^^^^
+   | |           |
+   | |           negative because of this
+   | unsafe because of this
+
+error[E0198]: negative impls cannot be unsafe
+  --> $DIR/deprecated-safe-trait-impl-staged.rs:72:13
+   |
+LL | unsafe impl !DeprSafe2018 for T {}
+   | ------      -^^^^^^^^^^^^
+   | |           |
+   | |           negative because of this
+   | unsafe because of this
+
+warning: use of trait `deprecated_safe::DeprSafe` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+  --> $DIR/deprecated-safe-trait-impl-staged.rs:15:1
+   |
+LL | impl DeprSafe for A {}
+   | ^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(deprecated_safe)]` on by default
+   = note: this trait was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the trait's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of trait `deprecated_safe::DeprSafeFuture` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+  --> $DIR/deprecated-safe-trait-impl-staged.rs:27:1
+   |
+LL | impl DeprSafeFuture for E {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+note: the lint level is defined here
+  --> $DIR/deprecated-safe-trait-impl-staged.rs:8:9
+   |
+LL | #![warn(deprecated_safe_in_future, unused_unsafe)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
+   = note: this trait was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the trait's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+error[E0200]: the trait `DeprSafe2015` requires an `unsafe impl` declaration
+  --> $DIR/deprecated-safe-trait-impl-staged.rs:39:1
+   |
+LL | impl DeprSafe2015 for I {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of trait `deprecated_safe::DeprSafe2015Future` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+  --> $DIR/deprecated-safe-trait-impl-staged.rs:51:1
+   |
+LL | impl DeprSafe2015Future for M {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this trait was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the trait's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of trait `deprecated_safe::DeprSafe2018` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+  --> $DIR/deprecated-safe-trait-impl-staged.rs:63:1
+   |
+LL | impl DeprSafe2018 for Q {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this trait was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the trait's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+error: aborting due to 6 previous errors; 4 warnings emitted
+
+Some errors have detailed explanations: E0198, E0200.
+For more information about an error, try `rustc --explain E0198`.
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-trait-impl-staged.rs b/src/test/ui/deprecated-safe/deprecated-safe-trait-impl-staged.rs
new file mode 100644
index 0000000000000..53ddbfc1b0cda
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-trait-impl-staged.rs
@@ -0,0 +1,74 @@
+// aux-build:deprecated-safe.rs
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
+#![feature(negative_impls)]
+#![feature(staged_api)]
+#![stable(feature = "deprecated-safe-test", since = "1.61.0")]
+#![warn(deprecated_safe_in_future, unused_unsafe)]
+
+extern crate deprecated_safe;
+
+use deprecated_safe::{DeprSafe, DeprSafe2015, DeprSafe2015Future, DeprSafe2018, DeprSafeFuture};
+
+struct A;
+impl DeprSafe for A {} //~ WARN use of trait `deprecated_safe::DeprSafe` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+
+struct B;
+unsafe impl DeprSafe for B {}
+
+struct C;
+impl !DeprSafe for C {}
+
+struct D;
+unsafe impl !DeprSafe for D {} //~ ERROR negative impls cannot be unsafe
+
+struct E;
+impl DeprSafeFuture for E {} //~ WARN use of trait `deprecated_safe::DeprSafeFuture` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+
+struct F;
+unsafe impl DeprSafeFuture for F {}
+
+struct G;
+impl !DeprSafeFuture for G {}
+
+struct H;
+unsafe impl !DeprSafeFuture for H {} //~ ERROR negative impls cannot be unsafe
+
+struct I;
+impl DeprSafe2015 for I {} //~ ERROR the trait `DeprSafe2015` requires an `unsafe impl` declaration
+
+struct J;
+unsafe impl DeprSafe2015 for J {}
+
+struct K;
+impl !DeprSafe2015 for K {}
+
+struct L;
+unsafe impl !DeprSafe2015 for L {} //~ ERROR negative impls cannot be unsafe
+
+struct M;
+impl DeprSafe2015Future for M {} //~ WARN use of trait `deprecated_safe::DeprSafe2015Future` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+
+struct N;
+unsafe impl DeprSafe2015Future for N {}
+
+struct O;
+impl !DeprSafe2015Future for O {}
+
+struct P;
+unsafe impl !DeprSafe2015Future for P {} //~ ERROR negative impls cannot be unsafe
+
+struct Q;
+impl DeprSafe2018 for Q {} //~ WARN use of trait `deprecated_safe::DeprSafe2018` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+
+struct R;
+unsafe impl DeprSafe2018 for R {}
+
+struct S;
+impl !DeprSafe2018 for S {}
+
+struct T;
+unsafe impl !DeprSafe2018 for T {} //~ ERROR negative impls cannot be unsafe
+
+fn main() {}
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-trait-impl-staged.thir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-trait-impl-staged.thir.stderr
new file mode 100644
index 0000000000000..3c49d1a6d80c3
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-trait-impl-staged.thir.stderr
@@ -0,0 +1,101 @@
+error[E0198]: negative impls cannot be unsafe
+  --> $DIR/deprecated-safe-trait-impl-staged.rs:24:13
+   |
+LL | unsafe impl !DeprSafe for D {}
+   | ------      -^^^^^^^^
+   | |           |
+   | |           negative because of this
+   | unsafe because of this
+
+error[E0198]: negative impls cannot be unsafe
+  --> $DIR/deprecated-safe-trait-impl-staged.rs:36:13
+   |
+LL | unsafe impl !DeprSafeFuture for H {}
+   | ------      -^^^^^^^^^^^^^^
+   | |           |
+   | |           negative because of this
+   | unsafe because of this
+
+error[E0198]: negative impls cannot be unsafe
+  --> $DIR/deprecated-safe-trait-impl-staged.rs:48:13
+   |
+LL | unsafe impl !DeprSafe2015 for L {}
+   | ------      -^^^^^^^^^^^^
+   | |           |
+   | |           negative because of this
+   | unsafe because of this
+
+error[E0198]: negative impls cannot be unsafe
+  --> $DIR/deprecated-safe-trait-impl-staged.rs:60:13
+   |
+LL | unsafe impl !DeprSafe2015Future for P {}
+   | ------      -^^^^^^^^^^^^^^^^^^
+   | |           |
+   | |           negative because of this
+   | unsafe because of this
+
+error[E0198]: negative impls cannot be unsafe
+  --> $DIR/deprecated-safe-trait-impl-staged.rs:72:13
+   |
+LL | unsafe impl !DeprSafe2018 for T {}
+   | ------      -^^^^^^^^^^^^
+   | |           |
+   | |           negative because of this
+   | unsafe because of this
+
+warning: use of trait `deprecated_safe::DeprSafe` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+  --> $DIR/deprecated-safe-trait-impl-staged.rs:15:1
+   |
+LL | impl DeprSafe for A {}
+   | ^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(deprecated_safe)]` on by default
+   = note: this trait was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the trait's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of trait `deprecated_safe::DeprSafeFuture` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+  --> $DIR/deprecated-safe-trait-impl-staged.rs:27:1
+   |
+LL | impl DeprSafeFuture for E {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+note: the lint level is defined here
+  --> $DIR/deprecated-safe-trait-impl-staged.rs:8:9
+   |
+LL | #![warn(deprecated_safe_in_future, unused_unsafe)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
+   = note: this trait was previously not marked unsafe, but has been marked unsafe since TBD
+   = note: consult the trait's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+error[E0200]: the trait `DeprSafe2015` requires an `unsafe impl` declaration
+  --> $DIR/deprecated-safe-trait-impl-staged.rs:39:1
+   |
+LL | impl DeprSafe2015 for I {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of trait `deprecated_safe::DeprSafe2015Future` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+  --> $DIR/deprecated-safe-trait-impl-staged.rs:51:1
+   |
+LL | impl DeprSafe2015Future for M {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this trait was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the trait's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of trait `deprecated_safe::DeprSafe2018` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+  --> $DIR/deprecated-safe-trait-impl-staged.rs:63:1
+   |
+LL | impl DeprSafe2018 for Q {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this trait was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the trait's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+error: aborting due to 6 previous errors; 4 warnings emitted
+
+Some errors have detailed explanations: E0198, E0200.
+For more information about an error, try `rustc --explain E0198`.
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-trait-impl.mir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-trait-impl.mir.stderr
new file mode 100644
index 0000000000000..df2796d616a08
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-trait-impl.mir.stderr
@@ -0,0 +1,88 @@
+error[E0198]: negative impls cannot be unsafe
+  --> $DIR/deprecated-safe-trait-impl.rs:22:13
+   |
+LL | unsafe impl !DeprSafe for D {}
+   | ------      -^^^^^^^^
+   | |           |
+   | |           negative because of this
+   | unsafe because of this
+
+error[E0198]: negative impls cannot be unsafe
+  --> $DIR/deprecated-safe-trait-impl.rs:34:13
+   |
+LL | unsafe impl !DeprSafeFuture for H {}
+   | ------      -^^^^^^^^^^^^^^
+   | |           |
+   | |           negative because of this
+   | unsafe because of this
+
+error[E0198]: negative impls cannot be unsafe
+  --> $DIR/deprecated-safe-trait-impl.rs:46:13
+   |
+LL | unsafe impl !DeprSafe2015 for L {}
+   | ------      -^^^^^^^^^^^^
+   | |           |
+   | |           negative because of this
+   | unsafe because of this
+
+error[E0198]: negative impls cannot be unsafe
+  --> $DIR/deprecated-safe-trait-impl.rs:61:13
+   |
+LL | unsafe impl !DeprSafe2015Future for Q {}
+   | ------      -^^^^^^^^^^^^^^^^^^
+   | |           |
+   | |           negative because of this
+   | unsafe because of this
+
+error[E0198]: negative impls cannot be unsafe
+  --> $DIR/deprecated-safe-trait-impl.rs:70:13
+   |
+LL | unsafe impl !DeprSafe2018 for T {}
+   | ------      -^^^^^^^^^^^^
+   | |           |
+   | |           negative because of this
+   | unsafe because of this
+
+warning: use of trait `deprecated_safe::DeprSafe` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+  --> $DIR/deprecated-safe-trait-impl.rs:13:1
+   |
+LL | impl DeprSafe for A {}
+   | ^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(deprecated_safe)]` on by default
+   = note: this trait was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the trait's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+error[E0199]: implementing the trait `DeprSafeFuture` is not unsafe
+  --> $DIR/deprecated-safe-trait-impl.rs:28:1
+   |
+LL | unsafe impl DeprSafeFuture for F {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0200]: the trait `DeprSafe2015` requires an `unsafe impl` declaration
+  --> $DIR/deprecated-safe-trait-impl.rs:37:1
+   |
+LL | impl DeprSafe2015 for I {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of trait `deprecated_safe::DeprSafe2018` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+  --> $DIR/deprecated-safe-trait-impl.rs:49:1
+   |
+LL | impl DeprSafe2018 for M {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this trait was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the trait's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+error[E0199]: implementing the trait `DeprSafe2015Future` is not unsafe
+  --> $DIR/deprecated-safe-trait-impl.rs:55:1
+   |
+LL | unsafe impl DeprSafe2015Future for O {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 8 previous errors; 2 warnings emitted
+
+Some errors have detailed explanations: E0198, E0199, E0200.
+For more information about an error, try `rustc --explain E0198`.
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-trait-impl.rs b/src/test/ui/deprecated-safe/deprecated-safe-trait-impl.rs
new file mode 100644
index 0000000000000..5dd07914bede8
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-trait-impl.rs
@@ -0,0 +1,72 @@
+// aux-build:deprecated-safe.rs
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
+#![feature(negative_impls)]
+#![warn(unused_unsafe)]
+
+extern crate deprecated_safe;
+
+use deprecated_safe::{DeprSafe, DeprSafe2015, DeprSafe2015Future, DeprSafe2018, DeprSafeFuture};
+
+struct A;
+impl DeprSafe for A {} //~ WARN use of trait `deprecated_safe::DeprSafe` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+
+struct B;
+unsafe impl DeprSafe for B {}
+
+struct C;
+impl !DeprSafe for C {}
+
+struct D;
+unsafe impl !DeprSafe for D {} //~ ERROR negative impls cannot be unsafe
+
+struct E;
+impl DeprSafeFuture for E {}
+
+struct F;
+unsafe impl DeprSafeFuture for F {} //~ ERROR implementing the trait `DeprSafeFuture` is not unsafe
+
+struct G;
+impl !DeprSafeFuture for G {}
+
+struct H;
+unsafe impl !DeprSafeFuture for H {} //~ ERROR negative impls cannot be unsafe
+
+struct I;
+impl DeprSafe2015 for I {} //~ ERROR the trait `DeprSafe2015` requires an `unsafe impl` declaration
+
+struct J;
+unsafe impl DeprSafe2015 for J {}
+
+struct K;
+impl !DeprSafe2015 for K {}
+
+struct L;
+unsafe impl !DeprSafe2015 for L {} //~ ERROR negative impls cannot be unsafe
+
+struct M;
+impl DeprSafe2018 for M {} //~ WARN use of trait `deprecated_safe::DeprSafe2018` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+
+struct N;
+impl DeprSafe2015Future for N {}
+
+struct O;
+unsafe impl DeprSafe2015Future for O {} //~ ERROR implementing the trait `DeprSafe2015Future` is not unsafe
+
+struct P;
+impl !DeprSafe2015Future for P {}
+
+struct Q;
+unsafe impl !DeprSafe2015Future for Q {} //~ ERROR negative impls cannot be unsafe
+
+struct R;
+unsafe impl DeprSafe2018 for R {}
+
+struct S;
+impl !DeprSafe2018 for S {}
+
+struct T;
+unsafe impl !DeprSafe2018 for T {} //~ ERROR negative impls cannot be unsafe
+
+fn main() {}
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-trait-impl.thir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-trait-impl.thir.stderr
new file mode 100644
index 0000000000000..df2796d616a08
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-trait-impl.thir.stderr
@@ -0,0 +1,88 @@
+error[E0198]: negative impls cannot be unsafe
+  --> $DIR/deprecated-safe-trait-impl.rs:22:13
+   |
+LL | unsafe impl !DeprSafe for D {}
+   | ------      -^^^^^^^^
+   | |           |
+   | |           negative because of this
+   | unsafe because of this
+
+error[E0198]: negative impls cannot be unsafe
+  --> $DIR/deprecated-safe-trait-impl.rs:34:13
+   |
+LL | unsafe impl !DeprSafeFuture for H {}
+   | ------      -^^^^^^^^^^^^^^
+   | |           |
+   | |           negative because of this
+   | unsafe because of this
+
+error[E0198]: negative impls cannot be unsafe
+  --> $DIR/deprecated-safe-trait-impl.rs:46:13
+   |
+LL | unsafe impl !DeprSafe2015 for L {}
+   | ------      -^^^^^^^^^^^^
+   | |           |
+   | |           negative because of this
+   | unsafe because of this
+
+error[E0198]: negative impls cannot be unsafe
+  --> $DIR/deprecated-safe-trait-impl.rs:61:13
+   |
+LL | unsafe impl !DeprSafe2015Future for Q {}
+   | ------      -^^^^^^^^^^^^^^^^^^
+   | |           |
+   | |           negative because of this
+   | unsafe because of this
+
+error[E0198]: negative impls cannot be unsafe
+  --> $DIR/deprecated-safe-trait-impl.rs:70:13
+   |
+LL | unsafe impl !DeprSafe2018 for T {}
+   | ------      -^^^^^^^^^^^^
+   | |           |
+   | |           negative because of this
+   | unsafe because of this
+
+warning: use of trait `deprecated_safe::DeprSafe` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+  --> $DIR/deprecated-safe-trait-impl.rs:13:1
+   |
+LL | impl DeprSafe for A {}
+   | ^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(deprecated_safe)]` on by default
+   = note: this trait was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the trait's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+error[E0199]: implementing the trait `DeprSafeFuture` is not unsafe
+  --> $DIR/deprecated-safe-trait-impl.rs:28:1
+   |
+LL | unsafe impl DeprSafeFuture for F {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0200]: the trait `DeprSafe2015` requires an `unsafe impl` declaration
+  --> $DIR/deprecated-safe-trait-impl.rs:37:1
+   |
+LL | impl DeprSafe2015 for I {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of trait `deprecated_safe::DeprSafe2018` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+  --> $DIR/deprecated-safe-trait-impl.rs:49:1
+   |
+LL | impl DeprSafe2018 for M {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this trait was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the trait's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+error[E0199]: implementing the trait `DeprSafe2015Future` is not unsafe
+  --> $DIR/deprecated-safe-trait-impl.rs:55:1
+   |
+LL | unsafe impl DeprSafe2015Future for O {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 8 previous errors; 2 warnings emitted
+
+Some errors have detailed explanations: E0198, E0199, E0200.
+For more information about an error, try `rustc --explain E0198`.
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-unsafe-edition-call.mir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-edition-call.mir.stderr
new file mode 100644
index 0000000000000..f63a0459cbd79
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-edition-call.mir.stderr
@@ -0,0 +1,34 @@
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+  --> $DIR/deprecated-safe-unsafe-edition-call.rs:16:5
+   |
+LL |     depr_safe_2015();
+   |     ^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+
+warning: use of function `deprecated_safe::depr_safe_2018` without an unsafe function or block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition-call.rs:18:5
+   |
+LL |     depr_safe_2018();
+   |     ^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: `#[warn(deprecated_safe)]` on by default
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-edition-call.rs:24:5
+   |
+LL |     unsafe {
+   |     ^^^^^^ unnecessary `unsafe` block
+   |
+note: the lint level is defined here
+  --> $DIR/deprecated-safe-unsafe-edition-call.rs:5:9
+   |
+LL | #![warn(unused_unsafe)]
+   |         ^^^^^^^^^^^^^
+
+error: aborting due to previous error; 2 warnings emitted
+
+For more information about this error, try `rustc --explain E0133`.
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-unsafe-edition-call.rs b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-edition-call.rs
new file mode 100644
index 0000000000000..026023cf3cc4f
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-edition-call.rs
@@ -0,0 +1,31 @@
+// aux-build:deprecated-safe.rs
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
+#![warn(unused_unsafe)]
+
+extern crate deprecated_safe;
+
+use deprecated_safe::{depr_safe_2015, depr_safe_2015_future, depr_safe_2018};
+
+fn main() {
+    // NOTE: this test is separate from deprecated-safe-unsafe-edition as the other compiler
+    // errors will stop compilation before these calls are checked
+
+    // usage without unsafe should lint
+    depr_safe_2015(); //~ ERROR call to unsafe function is unsafe and requires unsafe function or block
+    depr_safe_2015_future();
+    depr_safe_2018(); //~ WARN use of function `deprecated_safe::depr_safe_2018` without an unsafe function or block has been deprecated as it is now an unsafe function
+
+    // these shouldn't lint, appropriate unsafe usage
+    unsafe {
+        depr_safe_2015();
+    }
+    unsafe {
+        //~^ WARN unnecessary `unsafe` block
+        depr_safe_2015_future();
+    }
+    unsafe {
+        depr_safe_2018();
+    }
+}
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-unsafe-edition-call.thir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-edition-call.thir.stderr
new file mode 100644
index 0000000000000..f63a0459cbd79
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-edition-call.thir.stderr
@@ -0,0 +1,34 @@
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+  --> $DIR/deprecated-safe-unsafe-edition-call.rs:16:5
+   |
+LL |     depr_safe_2015();
+   |     ^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+
+warning: use of function `deprecated_safe::depr_safe_2018` without an unsafe function or block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition-call.rs:18:5
+   |
+LL |     depr_safe_2018();
+   |     ^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: `#[warn(deprecated_safe)]` on by default
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-edition-call.rs:24:5
+   |
+LL |     unsafe {
+   |     ^^^^^^ unnecessary `unsafe` block
+   |
+note: the lint level is defined here
+  --> $DIR/deprecated-safe-unsafe-edition-call.rs:5:9
+   |
+LL | #![warn(unused_unsafe)]
+   |         ^^^^^^^^^^^^^
+
+error: aborting due to previous error; 2 warnings emitted
+
+For more information about this error, try `rustc --explain E0133`.
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-unsafe-edition-impl.mir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-edition-impl.mir.stderr
new file mode 100644
index 0000000000000..c8a3971930cdd
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-edition-impl.mir.stderr
@@ -0,0 +1,27 @@
+error[E0200]: the trait `DeprSafe2015` requires an `unsafe impl` declaration
+  --> $DIR/deprecated-safe-unsafe-edition-impl.rs:12:1
+   |
+LL | impl DeprSafe2015 for DeprSafeImpl {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of trait `deprecated_safe::DeprSafe2018` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+  --> $DIR/deprecated-safe-unsafe-edition-impl.rs:14:1
+   |
+LL | impl DeprSafe2018 for DeprSafeImpl {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(deprecated_safe)]` on by default
+   = note: this trait was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the trait's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+error[E0199]: implementing the trait `DeprSafe2015Future` is not unsafe
+  --> $DIR/deprecated-safe-unsafe-edition-impl.rs:18:1
+   |
+LL | unsafe impl DeprSafe2015Future for DeprSafeUnsafeImpl {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors; 1 warning emitted
+
+Some errors have detailed explanations: E0199, E0200.
+For more information about an error, try `rustc --explain E0199`.
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-unsafe-edition-impl.rs b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-edition-impl.rs
new file mode 100644
index 0000000000000..f901d2aad78f9
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-edition-impl.rs
@@ -0,0 +1,24 @@
+// aux-build:deprecated-safe.rs
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
+#![warn(unused_unsafe)]
+
+extern crate deprecated_safe;
+
+use deprecated_safe::{DeprSafe2015, DeprSafe2015Future, DeprSafe2018};
+
+struct DeprSafeImpl;
+impl DeprSafe2015 for DeprSafeImpl {} //~ ERROR the trait `DeprSafe2015` requires an `unsafe impl` declaration
+impl DeprSafe2015Future for DeprSafeImpl {}
+impl DeprSafe2018 for DeprSafeImpl {} //~ WARN use of trait `deprecated_safe::DeprSafe2018` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+
+struct DeprSafeUnsafeImpl;
+unsafe impl DeprSafe2015 for DeprSafeUnsafeImpl {}
+unsafe impl DeprSafe2015Future for DeprSafeUnsafeImpl {} //~ ERROR implementing the trait `DeprSafe2015Future` is not unsafe
+unsafe impl DeprSafe2018 for DeprSafeUnsafeImpl {}
+
+fn main() {
+    // NOTE: this test is separate from deprecated-safe-unsafe-edition as the other compiler
+    // errors will stop compilation before these calls are checked
+}
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-unsafe-edition-impl.thir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-edition-impl.thir.stderr
new file mode 100644
index 0000000000000..c8a3971930cdd
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-edition-impl.thir.stderr
@@ -0,0 +1,27 @@
+error[E0200]: the trait `DeprSafe2015` requires an `unsafe impl` declaration
+  --> $DIR/deprecated-safe-unsafe-edition-impl.rs:12:1
+   |
+LL | impl DeprSafe2015 for DeprSafeImpl {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of trait `deprecated_safe::DeprSafe2018` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+  --> $DIR/deprecated-safe-unsafe-edition-impl.rs:14:1
+   |
+LL | impl DeprSafe2018 for DeprSafeImpl {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(deprecated_safe)]` on by default
+   = note: this trait was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the trait's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+error[E0199]: implementing the trait `DeprSafe2015Future` is not unsafe
+  --> $DIR/deprecated-safe-unsafe-edition-impl.rs:18:1
+   |
+LL | unsafe impl DeprSafe2015Future for DeprSafeUnsafeImpl {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors; 1 warning emitted
+
+Some errors have detailed explanations: E0199, E0200.
+For more information about an error, try `rustc --explain E0199`.
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-unsafe-edition.mir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-edition.mir.stderr
new file mode 100644
index 0000000000000..e6f3aa966786c
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-edition.mir.stderr
@@ -0,0 +1,493 @@
+error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:21:34
+   |
+LL |     let fn_impl: Box<dyn Fn()> = Box::new(depr_safe_2015);
+   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |
+   = help: the trait `Fn<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+   = note: required for the cast to the object type `dyn Fn()`
+
+error[E0277]: expected a `FnMut<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:22:37
+   |
+LL |     let fn_impl: Box<dyn FnMut()> = Box::new(depr_safe_2015);
+   |                                     ^^^^^^^^^^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |
+   = help: the trait `FnMut<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+   = note: required for the cast to the object type `dyn FnMut()`
+
+error[E0277]: expected a `FnOnce<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:23:38
+   |
+LL |     let fn_impl: Box<dyn FnOnce()> = Box::new(depr_safe_2015);
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |
+   = help: the trait `FnOnce<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+   = note: required for the cast to the object type `dyn FnOnce()`
+
+error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:26:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(depr_safe_2015));
+   |     --------------------- ^^^^^^^^^^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the trait `Fn<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+   = note: required for the cast to the object type `dyn Fn()`
+
+error[E0277]: expected a `FnMut<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:27:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(depr_safe_2015));
+   |     ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the trait `FnMut<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+   = note: required for the cast to the object type `dyn FnMut()`
+
+error[E0277]: expected a `FnOnce<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:28:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(depr_safe_2015));
+   |     ------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the trait `FnOnce<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+   = note: required for the cast to the object type `dyn FnOnce()`
+
+error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:31:23
+   |
+LL |     fn_taking_fn_impl(depr_safe_2015);
+   |     ----------------- ^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the trait `Fn<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+note: required by a bound in `fn_taking_fn_impl`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:111:30
+   |
+LL | fn fn_taking_fn_impl(_: impl Fn()) {}
+   |                              ^^^^ required by this bound in `fn_taking_fn_impl`
+
+error[E0277]: expected a `FnMut<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:32:26
+   |
+LL |     fn_taking_fnmut_impl(depr_safe_2015);
+   |     -------------------- ^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the trait `FnMut<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+note: required by a bound in `fn_taking_fnmut_impl`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:112:33
+   |
+LL | fn fn_taking_fnmut_impl(_: impl FnMut()) {}
+   |                                 ^^^^^^^ required by this bound in `fn_taking_fnmut_impl`
+
+error[E0277]: expected a `FnOnce<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:33:27
+   |
+LL |     fn_taking_fnonce_impl(depr_safe_2015);
+   |     --------------------- ^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the trait `FnOnce<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+note: required by a bound in `fn_taking_fnonce_impl`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:113:34
+   |
+LL | fn fn_taking_fnonce_impl(_: impl FnOnce()) {}
+   |                                  ^^^^^^^^ required by this bound in `fn_taking_fnonce_impl`
+
+error[E0308]: mismatched types
+  --> $DIR/deprecated-safe-unsafe-edition.rs:37:34
+   |
+LL |     let depr_safe_fn_ptr: fn() = depr_safe_2015;
+   |                           ----   ^^^^^^^^^^^^^^ expected normal fn, found unsafe fn
+   |                           |
+   |                           expected due to this
+   |
+   = note: expected fn pointer `fn()`
+                 found fn item `unsafe fn() {depr_safe_2015}`
+
+error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:38:44
+   |
+LL |     let depr_safe_fn_impl: Box<dyn Fn()> = Box::new(depr_safe_2015);
+   |                                            ^^^^^^^^^^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |
+   = help: the trait `Fn<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+   = note: required for the cast to the object type `dyn Fn()`
+
+error[E0277]: expected a `FnMut<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:39:54
+   |
+LL | ...impl: Box<dyn FnMut()> = Box::new(depr_safe_2015);
+   |                             ^^^^^^^^^^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |
+   = help: the trait `FnMut<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+   = note: required for the cast to the object type `dyn FnMut()`
+
+error[E0277]: expected a `FnOnce<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:40:52
+   |
+LL |     let depr_safe_fnonce_impl: Box<dyn FnOnce()> = Box::new(depr_safe_2015);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |
+   = help: the trait `FnOnce<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+   = note: required for the cast to the object type `dyn FnOnce()`
+
+error[E0308]: mismatched types
+  --> $DIR/deprecated-safe-unsafe-edition.rs:50:22
+   |
+LL |     fn_taking_fn_ptr(depr_safe_2015);
+   |                      ^^^^^^^^^^^^^^ expected normal fn, found unsafe fn
+   |
+   = note: expected fn pointer `fn()`
+                 found fn item `unsafe fn() {depr_safe_2015}`
+
+error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:51:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(depr_safe_2015));
+   |     --------------------- ^^^^^^^^^^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the trait `Fn<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+   = note: required for the cast to the object type `dyn Fn()`
+
+error[E0277]: expected a `FnMut<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:52:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(depr_safe_2015));
+   |     ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the trait `FnMut<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+   = note: required for the cast to the object type `dyn FnMut()`
+
+error[E0277]: expected a `FnOnce<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:53:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(depr_safe_2015));
+   |     ------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the trait `FnOnce<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+   = note: required for the cast to the object type `dyn FnOnce()`
+
+error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:54:23
+   |
+LL |     fn_taking_fn_impl(depr_safe_2015);
+   |     ----------------- ^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the trait `Fn<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+note: required by a bound in `fn_taking_fn_impl`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:111:30
+   |
+LL | fn fn_taking_fn_impl(_: impl Fn()) {}
+   |                              ^^^^ required by this bound in `fn_taking_fn_impl`
+
+error[E0277]: expected a `FnMut<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:55:26
+   |
+LL |     fn_taking_fnmut_impl(depr_safe_2015);
+   |     -------------------- ^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the trait `FnMut<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+note: required by a bound in `fn_taking_fnmut_impl`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:112:33
+   |
+LL | fn fn_taking_fnmut_impl(_: impl FnMut()) {}
+   |                                 ^^^^^^^ required by this bound in `fn_taking_fnmut_impl`
+
+error[E0277]: expected a `FnOnce<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:56:27
+   |
+LL |     fn_taking_fnonce_impl(depr_safe_2015);
+   |     --------------------- ^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the trait `FnOnce<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+note: required by a bound in `fn_taking_fnonce_impl`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:113:34
+   |
+LL | fn fn_taking_fnonce_impl(_: impl FnOnce()) {}
+   |                                  ^^^^^^^^ required by this bound in `fn_taking_fnonce_impl`
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:62:34
+   |
+LL |     let fn_impl: Box<dyn Fn()> = Box::new(depr_safe_2018);
+   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(deprecated_safe)]` on by default
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:62:34
+   |
+LL |     let fn_impl: Box<dyn Fn()> = Box::new(depr_safe_2018);
+   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:62:34
+   |
+LL |     let fn_impl: Box<dyn Fn()> = Box::new(depr_safe_2018);
+   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:65:37
+   |
+LL |     let fn_impl: Box<dyn FnMut()> = Box::new(depr_safe_2018);
+   |                                     ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:65:37
+   |
+LL |     let fn_impl: Box<dyn FnMut()> = Box::new(depr_safe_2018);
+   |                                     ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:67:38
+   |
+LL |     let fn_impl: Box<dyn FnOnce()> = Box::new(depr_safe_2018);
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:67:38
+   |
+LL |     let fn_impl: Box<dyn FnOnce()> = Box::new(depr_safe_2018);
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:71:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(depr_safe_2018));
+   |                           ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:72:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(depr_safe_2018));
+   |                              ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:73:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(depr_safe_2018));
+   |                               ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:76:5
+   |
+LL |     fn_taking_fn_impl(depr_safe_2018);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:77:5
+   |
+LL |     fn_taking_fnmut_impl(depr_safe_2018);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:78:5
+   |
+LL |     fn_taking_fnonce_impl(depr_safe_2018);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:82:34
+   |
+LL |     let depr_safe_fn_ptr: fn() = depr_safe_2018;
+   |                                  ^^^^^^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:83:44
+   |
+LL |     let depr_safe_fn_impl: Box<dyn Fn()> = Box::new(depr_safe_2018);
+   |                                            ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:84:54
+   |
+LL |     let mut depr_safe_fnmut_impl: Box<dyn FnMut()> = Box::new(depr_safe_2018);
+   |                                                      ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:85:52
+   |
+LL |     let depr_safe_fnonce_impl: Box<dyn FnOnce()> = Box::new(depr_safe_2018);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:95:22
+   |
+LL |     fn_taking_fn_ptr(depr_safe_2018);
+   |                      ^^^^^^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:96:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(depr_safe_2018));
+   |                           ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:97:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(depr_safe_2018));
+   |                              ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:98:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(depr_safe_2018));
+   |                               ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:99:5
+   |
+LL |     fn_taking_fn_impl(depr_safe_2018);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:100:5
+   |
+LL |     fn_taking_fnmut_impl(depr_safe_2018);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:101:5
+   |
+LL |     fn_taking_fnonce_impl(depr_safe_2018);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+error: aborting due to 20 previous errors; 24 warnings emitted
+
+Some errors have detailed explanations: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-unsafe-edition.rs b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-edition.rs
new file mode 100644
index 0000000000000..0f8f1416e0442
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-edition.rs
@@ -0,0 +1,113 @@
+// aux-build:deprecated-safe.rs
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
+#![feature(deprecated_safe)]
+#![warn(unused_unsafe)]
+
+extern crate deprecated_safe;
+
+use deprecated_safe::{depr_safe_2015, depr_safe_2018};
+use std::ffi::{OsStr, OsString};
+
+unsafe fn unsafe_fn() {
+    depr_safe_2015();
+    depr_safe_2018();
+}
+
+fn main() {
+    // test for dyn Fn() coercion where arguments don't match, where an
+    // intermediate fn() will be used
+    let fn_impl: Box<dyn Fn()> = Box::new(depr_safe_2015); //~ ERROR expected a `Fn<()>` closure, found `unsafe fn() {depr_safe_2015}`
+    let fn_impl: Box<dyn FnMut()> = Box::new(depr_safe_2015); //~ ERROR expected a `FnMut<()>` closure, found `unsafe fn() {depr_safe_2015}`
+    let fn_impl: Box<dyn FnOnce()> = Box::new(depr_safe_2015); //~ ERROR expected a `FnOnce<()>` closure, found `unsafe fn() {depr_safe_2015}`
+
+    // test variant where coercion occurs on a function argument instead of a variable
+    fn_taking_dyn_fn_impl(Box::new(depr_safe_2015)); //~ ERROR expected a `Fn<()>` closure, found `unsafe fn() {depr_safe_2015}`
+    fn_taking_dyn_fnmut_impl(Box::new(depr_safe_2015)); //~ ERROR expected a `FnMut<()>` closure, found `unsafe fn() {depr_safe_2015}`
+    fn_taking_dyn_fnonce_impl(Box::new(depr_safe_2015)); //~ ERROR expected a `FnOnce<()>` closure, found `unsafe fn() {depr_safe_2015}`
+
+    // test for non-dyn Fn() coercion (no unsizing)
+    fn_taking_fn_impl(depr_safe_2015); //~ ERROR expected a `Fn<()>` closure, found `unsafe fn() {depr_safe_2015}`
+    fn_taking_fnmut_impl(depr_safe_2015); //~ ERROR expected a `FnMut<()>` closure, found `unsafe fn() {depr_safe_2015}`
+    fn_taking_fnonce_impl(depr_safe_2015); //~ ERROR expected a `FnOnce<()>` closure, found `unsafe fn() {depr_safe_2015}`
+
+    // test for fn() coercion where arguments don't match, where an
+    // intermediate fn() will be used
+    let depr_safe_fn_ptr: fn() = depr_safe_2015; //~ ERROR mismatched types
+    let depr_safe_fn_impl: Box<dyn Fn()> = Box::new(depr_safe_2015); //~ ERROR expected a `Fn<()>` closure, found `unsafe fn() {depr_safe_2015}`
+    let mut depr_safe_fnmut_impl: Box<dyn FnMut()> = Box::new(depr_safe_2015); //~ ERROR expected a `FnMut<()>` closure, found `unsafe fn() {depr_safe_2015}`
+    let depr_safe_fnonce_impl: Box<dyn FnOnce()> = Box::new(depr_safe_2015); //~ ERROR expected a `FnOnce<()>` closure, found `unsafe fn() {depr_safe_2015}`
+
+    // these shouldn't lint, appropriate unsafe usage
+    let unsafe_depr_safe_fn_ptr: unsafe fn() = depr_safe_2015;
+    fn_taking_unsafe_fn_ptr(depr_safe_2015);
+    unsafe {
+        depr_safe_2015();
+    }
+
+    // all of these coercions should lint
+    fn_taking_fn_ptr(depr_safe_2015); //~ ERROR mismatched types
+    fn_taking_dyn_fn_impl(Box::new(depr_safe_2015)); //~ ERROR expected a `Fn<()>` closure, found `unsafe fn() {depr_safe_2015}`
+    fn_taking_dyn_fnmut_impl(Box::new(depr_safe_2015)); //~ ERROR expected a `FnMut<()>` closure, found `unsafe fn() {depr_safe_2015}`
+    fn_taking_dyn_fnonce_impl(Box::new(depr_safe_2015)); //~ ERROR expected a `FnOnce<()>` closure, found `unsafe fn() {depr_safe_2015}`
+    fn_taking_fn_impl(depr_safe_2015); //~ ERROR expected a `Fn<()>` closure, found `unsafe fn() {depr_safe_2015}`
+    fn_taking_fnmut_impl(depr_safe_2015); //~ ERROR expected a `FnMut<()>` closure, found `unsafe fn() {depr_safe_2015}`
+    fn_taking_fnonce_impl(depr_safe_2015); //~ ERROR expected a `FnOnce<()>` closure, found `unsafe fn() {depr_safe_2015}`
+}
+
+fn main_2018() {
+    // test for dyn Fn() coercion where arguments don't match, where an
+    // intermediate fn() will be used
+    let fn_impl: Box<dyn Fn()> = Box::new(depr_safe_2018); //~ WARN use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+                                                           //~| WARN use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+                                                           //~| WARN use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+    let fn_impl: Box<dyn FnMut()> = Box::new(depr_safe_2018); //~ WARN use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+                                                              //~| WARN use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+    let fn_impl: Box<dyn FnOnce()> = Box::new(depr_safe_2018); //~ WARN use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+                                                               //~| WARN use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+
+    // test variant where coercion occurs on a function argument instead of a variable
+    fn_taking_dyn_fn_impl(Box::new(depr_safe_2018)); //~ WARN use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnmut_impl(Box::new(depr_safe_2018)); //~ WARN use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnonce_impl(Box::new(depr_safe_2018)); //~ WARN use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+
+    // test for non-dyn Fn() coercion (no unsizing)
+    fn_taking_fn_impl(depr_safe_2018); //~ WARN use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnmut_impl(depr_safe_2018); //~ WARN use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnonce_impl(depr_safe_2018); //~ WARN use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+
+    // test for fn() coercion where arguments don't match, where an
+    // intermediate fn() will be used
+    let depr_safe_fn_ptr: fn() = depr_safe_2018; //~ WARN use of function `deprecated_safe::depr_safe_2018` as a normal fn pointer has been deprecated as it is now an unsafe function
+    let depr_safe_fn_impl: Box<dyn Fn()> = Box::new(depr_safe_2018); //~ WARN use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+    let mut depr_safe_fnmut_impl: Box<dyn FnMut()> = Box::new(depr_safe_2018); //~ WARN use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+    let depr_safe_fnonce_impl: Box<dyn FnOnce()> = Box::new(depr_safe_2018); //~ WARN use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+
+    // these shouldn't lint, appropriate unsafe usage
+    let unsafe_depr_safe_fn_ptr: unsafe fn() = depr_safe_2018;
+    fn_taking_unsafe_fn_ptr(depr_safe_2018);
+    unsafe {
+        depr_safe_2018();
+    }
+
+    // all of these coercions should lint
+    fn_taking_fn_ptr(depr_safe_2018); //~ WARN use of function `deprecated_safe::depr_safe_2018` as a normal fn pointer has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fn_impl(Box::new(depr_safe_2018)); //~ WARN use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnmut_impl(Box::new(depr_safe_2018)); //~ WARN use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnonce_impl(Box::new(depr_safe_2018)); //~ WARN use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fn_impl(depr_safe_2018); //~ WARN use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnmut_impl(depr_safe_2018); //~ WARN use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnonce_impl(depr_safe_2018); //~ WARN use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+}
+
+fn fn_taking_fn_ptr(_: fn()) {}
+fn fn_taking_unsafe_fn_ptr(_: unsafe fn()) {}
+
+fn fn_taking_dyn_fn_impl(_: Box<dyn Fn()>) {}
+fn fn_taking_dyn_fnmut_impl(_: Box<dyn FnMut()>) {}
+fn fn_taking_dyn_fnonce_impl(_: Box<dyn FnOnce()>) {}
+
+fn fn_taking_fn_impl(_: impl Fn()) {}
+fn fn_taking_fnmut_impl(_: impl FnMut()) {}
+fn fn_taking_fnonce_impl(_: impl FnOnce()) {}
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-unsafe-edition.thir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-edition.thir.stderr
new file mode 100644
index 0000000000000..e6f3aa966786c
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-edition.thir.stderr
@@ -0,0 +1,493 @@
+error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:21:34
+   |
+LL |     let fn_impl: Box<dyn Fn()> = Box::new(depr_safe_2015);
+   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |
+   = help: the trait `Fn<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+   = note: required for the cast to the object type `dyn Fn()`
+
+error[E0277]: expected a `FnMut<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:22:37
+   |
+LL |     let fn_impl: Box<dyn FnMut()> = Box::new(depr_safe_2015);
+   |                                     ^^^^^^^^^^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |
+   = help: the trait `FnMut<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+   = note: required for the cast to the object type `dyn FnMut()`
+
+error[E0277]: expected a `FnOnce<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:23:38
+   |
+LL |     let fn_impl: Box<dyn FnOnce()> = Box::new(depr_safe_2015);
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |
+   = help: the trait `FnOnce<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+   = note: required for the cast to the object type `dyn FnOnce()`
+
+error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:26:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(depr_safe_2015));
+   |     --------------------- ^^^^^^^^^^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the trait `Fn<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+   = note: required for the cast to the object type `dyn Fn()`
+
+error[E0277]: expected a `FnMut<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:27:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(depr_safe_2015));
+   |     ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the trait `FnMut<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+   = note: required for the cast to the object type `dyn FnMut()`
+
+error[E0277]: expected a `FnOnce<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:28:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(depr_safe_2015));
+   |     ------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the trait `FnOnce<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+   = note: required for the cast to the object type `dyn FnOnce()`
+
+error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:31:23
+   |
+LL |     fn_taking_fn_impl(depr_safe_2015);
+   |     ----------------- ^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the trait `Fn<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+note: required by a bound in `fn_taking_fn_impl`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:111:30
+   |
+LL | fn fn_taking_fn_impl(_: impl Fn()) {}
+   |                              ^^^^ required by this bound in `fn_taking_fn_impl`
+
+error[E0277]: expected a `FnMut<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:32:26
+   |
+LL |     fn_taking_fnmut_impl(depr_safe_2015);
+   |     -------------------- ^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the trait `FnMut<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+note: required by a bound in `fn_taking_fnmut_impl`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:112:33
+   |
+LL | fn fn_taking_fnmut_impl(_: impl FnMut()) {}
+   |                                 ^^^^^^^ required by this bound in `fn_taking_fnmut_impl`
+
+error[E0277]: expected a `FnOnce<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:33:27
+   |
+LL |     fn_taking_fnonce_impl(depr_safe_2015);
+   |     --------------------- ^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the trait `FnOnce<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+note: required by a bound in `fn_taking_fnonce_impl`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:113:34
+   |
+LL | fn fn_taking_fnonce_impl(_: impl FnOnce()) {}
+   |                                  ^^^^^^^^ required by this bound in `fn_taking_fnonce_impl`
+
+error[E0308]: mismatched types
+  --> $DIR/deprecated-safe-unsafe-edition.rs:37:34
+   |
+LL |     let depr_safe_fn_ptr: fn() = depr_safe_2015;
+   |                           ----   ^^^^^^^^^^^^^^ expected normal fn, found unsafe fn
+   |                           |
+   |                           expected due to this
+   |
+   = note: expected fn pointer `fn()`
+                 found fn item `unsafe fn() {depr_safe_2015}`
+
+error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:38:44
+   |
+LL |     let depr_safe_fn_impl: Box<dyn Fn()> = Box::new(depr_safe_2015);
+   |                                            ^^^^^^^^^^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |
+   = help: the trait `Fn<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+   = note: required for the cast to the object type `dyn Fn()`
+
+error[E0277]: expected a `FnMut<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:39:54
+   |
+LL | ...impl: Box<dyn FnMut()> = Box::new(depr_safe_2015);
+   |                             ^^^^^^^^^^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |
+   = help: the trait `FnMut<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+   = note: required for the cast to the object type `dyn FnMut()`
+
+error[E0277]: expected a `FnOnce<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:40:52
+   |
+LL |     let depr_safe_fnonce_impl: Box<dyn FnOnce()> = Box::new(depr_safe_2015);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |
+   = help: the trait `FnOnce<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+   = note: required for the cast to the object type `dyn FnOnce()`
+
+error[E0308]: mismatched types
+  --> $DIR/deprecated-safe-unsafe-edition.rs:50:22
+   |
+LL |     fn_taking_fn_ptr(depr_safe_2015);
+   |                      ^^^^^^^^^^^^^^ expected normal fn, found unsafe fn
+   |
+   = note: expected fn pointer `fn()`
+                 found fn item `unsafe fn() {depr_safe_2015}`
+
+error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:51:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(depr_safe_2015));
+   |     --------------------- ^^^^^^^^^^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the trait `Fn<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+   = note: required for the cast to the object type `dyn Fn()`
+
+error[E0277]: expected a `FnMut<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:52:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(depr_safe_2015));
+   |     ------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the trait `FnMut<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+   = note: required for the cast to the object type `dyn FnMut()`
+
+error[E0277]: expected a `FnOnce<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:53:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(depr_safe_2015));
+   |     ------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the trait `FnOnce<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+   = note: required for the cast to the object type `dyn FnOnce()`
+
+error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:54:23
+   |
+LL |     fn_taking_fn_impl(depr_safe_2015);
+   |     ----------------- ^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the trait `Fn<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+note: required by a bound in `fn_taking_fn_impl`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:111:30
+   |
+LL | fn fn_taking_fn_impl(_: impl Fn()) {}
+   |                              ^^^^ required by this bound in `fn_taking_fn_impl`
+
+error[E0277]: expected a `FnMut<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:55:26
+   |
+LL |     fn_taking_fnmut_impl(depr_safe_2015);
+   |     -------------------- ^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the trait `FnMut<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+note: required by a bound in `fn_taking_fnmut_impl`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:112:33
+   |
+LL | fn fn_taking_fnmut_impl(_: impl FnMut()) {}
+   |                                 ^^^^^^^ required by this bound in `fn_taking_fnmut_impl`
+
+error[E0277]: expected a `FnOnce<()>` closure, found `unsafe fn() {depr_safe_2015}`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:56:27
+   |
+LL |     fn_taking_fnonce_impl(depr_safe_2015);
+   |     --------------------- ^^^^^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
+   |     |
+   |     required by a bound introduced by this call
+   |
+   = help: the trait `FnOnce<()>` is not implemented for `unsafe fn() {depr_safe_2015}`
+   = note: wrap the `unsafe fn() {depr_safe_2015}` in a closure with no arguments: `|| { /* code */ }`
+note: required by a bound in `fn_taking_fnonce_impl`
+  --> $DIR/deprecated-safe-unsafe-edition.rs:113:34
+   |
+LL | fn fn_taking_fnonce_impl(_: impl FnOnce()) {}
+   |                                  ^^^^^^^^ required by this bound in `fn_taking_fnonce_impl`
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:62:34
+   |
+LL |     let fn_impl: Box<dyn Fn()> = Box::new(depr_safe_2018);
+   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(deprecated_safe)]` on by default
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:62:34
+   |
+LL |     let fn_impl: Box<dyn Fn()> = Box::new(depr_safe_2018);
+   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:62:34
+   |
+LL |     let fn_impl: Box<dyn Fn()> = Box::new(depr_safe_2018);
+   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:65:37
+   |
+LL |     let fn_impl: Box<dyn FnMut()> = Box::new(depr_safe_2018);
+   |                                     ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:65:37
+   |
+LL |     let fn_impl: Box<dyn FnMut()> = Box::new(depr_safe_2018);
+   |                                     ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:67:38
+   |
+LL |     let fn_impl: Box<dyn FnOnce()> = Box::new(depr_safe_2018);
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:67:38
+   |
+LL |     let fn_impl: Box<dyn FnOnce()> = Box::new(depr_safe_2018);
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:71:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(depr_safe_2018));
+   |                           ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:72:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(depr_safe_2018));
+   |                              ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:73:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(depr_safe_2018));
+   |                               ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:76:5
+   |
+LL |     fn_taking_fn_impl(depr_safe_2018);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:77:5
+   |
+LL |     fn_taking_fnmut_impl(depr_safe_2018);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:78:5
+   |
+LL |     fn_taking_fnonce_impl(depr_safe_2018);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:82:34
+   |
+LL |     let depr_safe_fn_ptr: fn() = depr_safe_2018;
+   |                                  ^^^^^^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:83:44
+   |
+LL |     let depr_safe_fn_impl: Box<dyn Fn()> = Box::new(depr_safe_2018);
+   |                                            ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:84:54
+   |
+LL |     let mut depr_safe_fnmut_impl: Box<dyn FnMut()> = Box::new(depr_safe_2018);
+   |                                                      ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:85:52
+   |
+LL |     let depr_safe_fnonce_impl: Box<dyn FnOnce()> = Box::new(depr_safe_2018);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:95:22
+   |
+LL |     fn_taking_fn_ptr(depr_safe_2018);
+   |                      ^^^^^^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:96:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(depr_safe_2018));
+   |                           ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:97:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(depr_safe_2018));
+   |                              ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:98:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(depr_safe_2018));
+   |                               ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:99:5
+   |
+LL |     fn_taking_fn_impl(depr_safe_2018);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:100:5
+   |
+LL |     fn_taking_fnmut_impl(depr_safe_2018);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-edition.rs:101:5
+   |
+LL |     fn_taking_fnonce_impl(depr_safe_2018);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+error: aborting due to 20 previous errors; 24 warnings emitted
+
+Some errors have detailed explanations: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-unsafe-op-in-unsafe-fn-staged.mir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-op-in-unsafe-fn-staged.mir.stderr
new file mode 100644
index 0000000000000..9dc02d4fdb9ea
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-op-in-unsafe-fn-staged.mir.stderr
@@ -0,0 +1,188 @@
+warning: use of function `deprecated_safe::depr_safe` without an unsafe block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:19:5
+   |
+LL |     depr_safe();
+   |     ^^^^^^^^^^^ call to unsafe function
+   |
+   = note: `#[warn(deprecated_safe)]` on by default
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` without an unsafe block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:25:5
+   |
+LL |     depr_safe_future();
+   |     ^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+note: the lint level is defined here
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:7:9
+   |
+LL | #![warn(deprecated_safe_in_future, unused_unsafe)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+error: call to unsafe function is unsafe and requires unsafe block (error E0133)
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:31:5
+   |
+LL |     depr_safe_2015();
+   |     ^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+note: the lint level is defined here
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:8:9
+   |
+LL | #![deny(unsafe_op_in_unsafe_fn)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+
+warning: use of function `deprecated_safe::depr_safe_2015_future` without an unsafe block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:37:5
+   |
+LL |     depr_safe_2015_future();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` without an unsafe block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:43:5
+   |
+LL |     depr_safe_2018();
+   |     ^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:17:5
+   |
+LL |     unsafe {}
+   |     ^^^^^^ unnecessary `unsafe` block
+   |
+note: the lint level is defined here
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:7:36
+   |
+LL | #![warn(deprecated_safe_in_future, unused_unsafe)]
+   |                                    ^^^^^^^^^^^^^
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:22:9
+   |
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:28:9
+   |
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:34:9
+   |
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:40:9
+   |
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:46:9
+   |
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: use of function `deprecated_safe::depr_safe` without an unsafe block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:53:5
+   |
+LL |     depr_safe();
+   |     ^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_future` without an unsafe block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:59:5
+   |
+LL |     depr_safe_future();
+   |     ^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:65:5
+   |
+LL |     depr_safe_2015();
+   |     ^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+
+warning: use of function `deprecated_safe::depr_safe_2015_future` without an unsafe block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:71:5
+   |
+LL |     depr_safe_2015_future();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_2018` without an unsafe block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:77:5
+   |
+LL |     depr_safe_2018();
+   |     ^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:51:5
+   |
+LL |     unsafe {}
+   |     ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:56:9
+   |
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:62:9
+   |
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:68:9
+   |
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:74:9
+   |
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:80:9
+   |
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+error: aborting due to 2 previous errors; 20 warnings emitted
+
+For more information about this error, try `rustc --explain E0133`.
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs
new file mode 100644
index 0000000000000..f5e8322a30628
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs
@@ -0,0 +1,82 @@
+// aux-build:deprecated-safe.rs
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
+#![feature(staged_api)]
+#![stable(feature = "deprecated-safe-test", since = "1.61.0")]
+#![warn(deprecated_safe_in_future, unused_unsafe)]
+#![deny(unsafe_op_in_unsafe_fn)]
+
+extern crate deprecated_safe;
+
+use deprecated_safe::{
+    depr_safe, depr_safe_2015, depr_safe_2015_future, depr_safe_2018, depr_safe_future,
+};
+
+unsafe fn unsafe_fn() {
+    unsafe {} //~ WARN unnecessary `unsafe` block
+
+    depr_safe(); //~ WARN use of function `deprecated_safe::depr_safe` without an unsafe block has been deprecated as it is now an unsafe function
+    unsafe {
+        depr_safe();
+        unsafe {} //~ WARN unnecessary `unsafe` block
+    }
+
+    depr_safe_future(); //~ WARN use of function `deprecated_safe::depr_safe_future` without an unsafe block has been deprecated as it is now an unsafe function
+    unsafe {
+        depr_safe_future();
+        unsafe {} //~ WARN unnecessary `unsafe` block
+    }
+
+    depr_safe_2015(); //~ ERROR call to unsafe function is unsafe and requires unsafe block
+    unsafe {
+        depr_safe_2015();
+        unsafe {} //~ WARN unnecessary `unsafe` block
+    }
+
+    depr_safe_2015_future(); //~ WARN use of function `deprecated_safe::depr_safe_2015_future` without an unsafe block has been deprecated as it is now an unsafe function
+    unsafe {
+        depr_safe_2015_future();
+        unsafe {} //~ WARN unnecessary `unsafe` block
+    }
+
+    depr_safe_2018(); //~ WARN use of function `deprecated_safe::depr_safe_2018` without an unsafe block has been deprecated as it is now an unsafe function
+    unsafe {
+        depr_safe_2018();
+        unsafe {} //~ WARN unnecessary `unsafe` block
+    }
+}
+
+fn main() {
+    unsafe {} //~ WARN unnecessary `unsafe` block
+
+    depr_safe(); //~ WARN use of function `deprecated_safe::depr_safe` without an unsafe block has been deprecated as it is now an unsafe function
+    unsafe {
+        depr_safe();
+        unsafe {} //~ WARN unnecessary `unsafe` block
+    }
+
+    depr_safe_future(); //~ WARN use of function `deprecated_safe::depr_safe_future` without an unsafe block has been deprecated as it is now an unsafe function
+    unsafe {
+        depr_safe_future();
+        unsafe {} //~ WARN unnecessary `unsafe` block
+    }
+
+    depr_safe_2015(); //~ ERROR call to unsafe function is unsafe and requires unsafe block
+    unsafe {
+        depr_safe_2015();
+        unsafe {} //~ WARN unnecessary `unsafe` block
+    }
+
+    depr_safe_2015_future(); //~ WARN use of function `deprecated_safe::depr_safe_2015_future` without an unsafe block has been deprecated as it is now an unsafe function
+    unsafe {
+        depr_safe_2015_future();
+        unsafe {} //~ WARN unnecessary `unsafe` block
+    }
+
+    depr_safe_2018(); //~ WARN use of function `deprecated_safe::depr_safe_2018` without an unsafe block has been deprecated as it is now an unsafe function
+    unsafe {
+        depr_safe_2018();
+        unsafe {} //~ WARN unnecessary `unsafe` block
+    }
+}
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-unsafe-op-in-unsafe-fn-staged.thir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-op-in-unsafe-fn-staged.thir.stderr
new file mode 100644
index 0000000000000..072bb91b0054e
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-op-in-unsafe-fn-staged.thir.stderr
@@ -0,0 +1,218 @@
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:17:5
+   |
+LL |     unsafe {}
+   |     ^^^^^^ unnecessary `unsafe` block
+   |
+note: the lint level is defined here
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:7:36
+   |
+LL | #![warn(deprecated_safe_in_future, unused_unsafe)]
+   |                                    ^^^^^^^^^^^^^
+
+warning: use of function `deprecated_safe::depr_safe` without an unsafe block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:19:5
+   |
+LL |     depr_safe();
+   |     ^^^^^^^^^^^ call to unsafe function
+   |
+   = note: `#[warn(deprecated_safe)]` on by default
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:22:9
+   |
+LL |     unsafe {
+   |     ------ because it's nested under this `unsafe` block
+LL |         depr_safe();
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: use of function `deprecated_safe::depr_safe_future` without an unsafe block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:25:5
+   |
+LL |     depr_safe_future();
+   |     ^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+note: the lint level is defined here
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:7:9
+   |
+LL | #![warn(deprecated_safe_in_future, unused_unsafe)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:28:9
+   |
+LL |     unsafe {
+   |     ------ because it's nested under this `unsafe` block
+LL |         depr_safe_future();
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+error: call to unsafe function is unsafe and requires unsafe block (error E0133)
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:31:5
+   |
+LL |     depr_safe_2015();
+   |     ^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+note: the lint level is defined here
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:8:9
+   |
+LL | #![deny(unsafe_op_in_unsafe_fn)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:34:9
+   |
+LL |     unsafe {
+   |     ------ because it's nested under this `unsafe` block
+LL |         depr_safe_2015();
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: use of function `deprecated_safe::depr_safe_2015_future` without an unsafe block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:37:5
+   |
+LL |     depr_safe_2015_future();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:40:9
+   |
+LL |     unsafe {
+   |     ------ because it's nested under this `unsafe` block
+LL |         depr_safe_2015_future();
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: use of function `deprecated_safe::depr_safe_2018` without an unsafe block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:43:5
+   |
+LL |     depr_safe_2018();
+   |     ^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:46:9
+   |
+LL |     unsafe {
+   |     ------ because it's nested under this `unsafe` block
+LL |         depr_safe_2018();
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:51:5
+   |
+LL |     unsafe {}
+   |     ^^^^^^ unnecessary `unsafe` block
+
+warning: use of function `deprecated_safe::depr_safe` without an unsafe block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:53:5
+   |
+LL |     depr_safe();
+   |     ^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:56:9
+   |
+LL |     unsafe {
+   |     ------ because it's nested under this `unsafe` block
+LL |         depr_safe();
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: use of function `deprecated_safe::depr_safe_future` without an unsafe block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:59:5
+   |
+LL |     depr_safe_future();
+   |     ^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:62:9
+   |
+LL |     unsafe {
+   |     ------ because it's nested under this `unsafe` block
+LL |         depr_safe_future();
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:65:5
+   |
+LL |     depr_safe_2015();
+   |     ^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:68:9
+   |
+LL |     unsafe {
+   |     ------ because it's nested under this `unsafe` block
+LL |         depr_safe_2015();
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: use of function `deprecated_safe::depr_safe_2015_future` without an unsafe block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:71:5
+   |
+LL |     depr_safe_2015_future();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 99.99.99
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:74:9
+   |
+LL |     unsafe {
+   |     ------ because it's nested under this `unsafe` block
+LL |         depr_safe_2015_future();
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: use of function `deprecated_safe::depr_safe_2018` without an unsafe block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:77:5
+   |
+LL |     depr_safe_2018();
+   |     ^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn-staged.rs:80:9
+   |
+LL |     unsafe {
+   |     ------ because it's nested under this `unsafe` block
+LL |         depr_safe_2018();
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+error: aborting due to 2 previous errors; 20 warnings emitted
+
+For more information about this error, try `rustc --explain E0133`.
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-unsafe-op-in-unsafe-fn.mir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-op-in-unsafe-fn.mir.stderr
new file mode 100644
index 0000000000000..42ccca58d0d34
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-op-in-unsafe-fn.mir.stderr
@@ -0,0 +1,167 @@
+warning: use of function `deprecated_safe::depr_safe` without an unsafe block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:17:5
+   |
+LL |     depr_safe();
+   |     ^^^^^^^^^^^ call to unsafe function
+   |
+   = note: `#[warn(deprecated_safe)]` on by default
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+error: call to unsafe function is unsafe and requires unsafe block (error E0133)
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:30:5
+   |
+LL |     depr_safe_2015();
+   |     ^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+note: the lint level is defined here
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:5:9
+   |
+LL | #![deny(unsafe_op_in_unsafe_fn)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+
+warning: use of function `deprecated_safe::depr_safe_2018` without an unsafe block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:43:5
+   |
+LL |     depr_safe_2018();
+   |     ^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:15:5
+   |
+LL |     unsafe {}
+   |     ^^^^^^ unnecessary `unsafe` block
+   |
+note: the lint level is defined here
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:6:9
+   |
+LL | #![warn(unused_unsafe)]
+   |         ^^^^^^^^^^^^^
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:20:9
+   |
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:24:5
+   |
+LL |     unsafe {
+   |     ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:27:9
+   |
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:33:9
+   |
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:37:5
+   |
+LL |     unsafe {
+   |     ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:40:9
+   |
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:46:9
+   |
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: use of function `deprecated_safe::depr_safe` without an unsafe block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:53:5
+   |
+LL |     depr_safe();
+   |     ^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:66:5
+   |
+LL |     depr_safe_2015();
+   |     ^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+
+warning: use of function `deprecated_safe::depr_safe_2018` without an unsafe block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:79:5
+   |
+LL |     depr_safe_2018();
+   |     ^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:51:5
+   |
+LL |     unsafe {}
+   |     ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:56:9
+   |
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:60:5
+   |
+LL |     unsafe {
+   |     ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:63:9
+   |
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:69:9
+   |
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:73:5
+   |
+LL |     unsafe {
+   |     ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:76:9
+   |
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:82:9
+   |
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+error: aborting due to 2 previous errors; 20 warnings emitted
+
+For more information about this error, try `rustc --explain E0133`.
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-unsafe-op-in-unsafe-fn.rs b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-op-in-unsafe-fn.rs
new file mode 100644
index 0000000000000..e1a8fd2628db2
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-op-in-unsafe-fn.rs
@@ -0,0 +1,84 @@
+// aux-build:deprecated-safe.rs
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
+#![deny(unsafe_op_in_unsafe_fn)]
+#![warn(unused_unsafe)]
+
+extern crate deprecated_safe;
+
+use deprecated_safe::{
+    depr_safe, depr_safe_2015, depr_safe_2015_future, depr_safe_2018, depr_safe_future,
+};
+
+unsafe fn unsafe_fn() {
+    unsafe {} //~ WARN unnecessary `unsafe` block
+
+    depr_safe(); //~ WARN use of function `deprecated_safe::depr_safe` without an unsafe block has been deprecated as it is now an unsafe function
+    unsafe {
+        depr_safe();
+        unsafe {} //~ WARN unnecessary `unsafe` block
+    }
+
+    depr_safe_future();
+    unsafe {
+        //~^ WARN unnecessary `unsafe` block
+        depr_safe_future();
+        unsafe {} //~ WARN unnecessary `unsafe` block
+    }
+
+    depr_safe_2015(); //~ ERROR call to unsafe function is unsafe and requires unsafe block
+    unsafe {
+        depr_safe_2015();
+        unsafe {} //~ WARN unnecessary `unsafe` block
+    }
+
+    depr_safe_2015_future();
+    unsafe {
+        //~^ WARN unnecessary `unsafe` block
+        depr_safe_2015_future();
+        unsafe {} //~ WARN unnecessary `unsafe` block
+    }
+
+    depr_safe_2018(); //~ WARN use of function `deprecated_safe::depr_safe_2018` without an unsafe block has been deprecated as it is now an unsafe function
+    unsafe {
+        depr_safe_2018();
+        unsafe {} //~ WARN unnecessary `unsafe` block
+    }
+}
+
+fn main() {
+    unsafe {} //~ WARN unnecessary `unsafe` block
+
+    depr_safe(); //~ WARN use of function `deprecated_safe::depr_safe` without an unsafe block has been deprecated as it is now an unsafe function
+    unsafe {
+        depr_safe();
+        unsafe {} //~ WARN unnecessary `unsafe` block
+    }
+
+    depr_safe_future();
+    unsafe {
+        //~^ WARN unnecessary `unsafe` block
+        depr_safe_future();
+        unsafe {} //~ WARN unnecessary `unsafe` block
+    }
+
+    depr_safe_2015(); //~ ERROR call to unsafe function is unsafe and requires unsafe block
+    unsafe {
+        depr_safe_2015();
+        unsafe {} //~ WARN unnecessary `unsafe` block
+    }
+
+    depr_safe_2015_future();
+    unsafe {
+        //~^ WARN unnecessary `unsafe` block
+        depr_safe_2015_future();
+        unsafe {} //~ WARN unnecessary `unsafe` block
+    }
+
+    depr_safe_2018(); //~ WARN use of function `deprecated_safe::depr_safe_2018` without an unsafe block has been deprecated as it is now an unsafe function
+    unsafe {
+        depr_safe_2018();
+        unsafe {} //~ WARN unnecessary `unsafe` block
+    }
+}
diff --git a/src/test/ui/deprecated-safe/deprecated-safe-unsafe-op-in-unsafe-fn.thir.stderr b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-op-in-unsafe-fn.thir.stderr
new file mode 100644
index 0000000000000..d1c5eb2b2a0ee
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe-unsafe-op-in-unsafe-fn.thir.stderr
@@ -0,0 +1,197 @@
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:15:5
+   |
+LL |     unsafe {}
+   |     ^^^^^^ unnecessary `unsafe` block
+   |
+note: the lint level is defined here
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:6:9
+   |
+LL | #![warn(unused_unsafe)]
+   |         ^^^^^^^^^^^^^
+
+warning: use of function `deprecated_safe::depr_safe` without an unsafe block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:17:5
+   |
+LL |     depr_safe();
+   |     ^^^^^^^^^^^ call to unsafe function
+   |
+   = note: `#[warn(deprecated_safe)]` on by default
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:20:9
+   |
+LL |     unsafe {
+   |     ------ because it's nested under this `unsafe` block
+LL |         depr_safe();
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:27:9
+   |
+LL |     unsafe {
+   |     ------ because it's nested under this `unsafe` block
+...
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:24:5
+   |
+LL |     unsafe {
+   |     ^^^^^^ unnecessary `unsafe` block
+
+error: call to unsafe function is unsafe and requires unsafe block (error E0133)
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:30:5
+   |
+LL |     depr_safe_2015();
+   |     ^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+note: the lint level is defined here
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:5:9
+   |
+LL | #![deny(unsafe_op_in_unsafe_fn)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:33:9
+   |
+LL |     unsafe {
+   |     ------ because it's nested under this `unsafe` block
+LL |         depr_safe_2015();
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:40:9
+   |
+LL |     unsafe {
+   |     ------ because it's nested under this `unsafe` block
+...
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:37:5
+   |
+LL |     unsafe {
+   |     ^^^^^^ unnecessary `unsafe` block
+
+warning: use of function `deprecated_safe::depr_safe_2018` without an unsafe block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:43:5
+   |
+LL |     depr_safe_2018();
+   |     ^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:46:9
+   |
+LL |     unsafe {
+   |     ------ because it's nested under this `unsafe` block
+LL |         depr_safe_2018();
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:51:5
+   |
+LL |     unsafe {}
+   |     ^^^^^^ unnecessary `unsafe` block
+
+warning: use of function `deprecated_safe::depr_safe` without an unsafe block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:53:5
+   |
+LL |     depr_safe();
+   |     ^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:56:9
+   |
+LL |     unsafe {
+   |     ------ because it's nested under this `unsafe` block
+LL |         depr_safe();
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:63:9
+   |
+LL |     unsafe {
+   |     ------ because it's nested under this `unsafe` block
+...
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:60:5
+   |
+LL |     unsafe {
+   |     ^^^^^^ unnecessary `unsafe` block
+
+error[E0133]: call to unsafe function is unsafe and requires unsafe block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:66:5
+   |
+LL |     depr_safe_2015();
+   |     ^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:69:9
+   |
+LL |     unsafe {
+   |     ------ because it's nested under this `unsafe` block
+LL |         depr_safe_2015();
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:76:9
+   |
+LL |     unsafe {
+   |     ------ because it's nested under this `unsafe` block
+...
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:73:5
+   |
+LL |     unsafe {
+   |     ^^^^^^ unnecessary `unsafe` block
+
+warning: use of function `deprecated_safe::depr_safe_2018` without an unsafe block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:79:5
+   |
+LL |     depr_safe_2018();
+   |     ^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe-unsafe-op-in-unsafe-fn.rs:82:9
+   |
+LL |     unsafe {
+   |     ------ because it's nested under this `unsafe` block
+LL |         depr_safe_2018();
+LL |         unsafe {}
+   |         ^^^^^^ unnecessary `unsafe` block
+
+error: aborting due to 2 previous errors; 20 warnings emitted
+
+For more information about this error, try `rustc --explain E0133`.
diff --git a/src/test/ui/deprecated-safe/deprecated-safe.mir.stderr b/src/test/ui/deprecated-safe/deprecated-safe.mir.stderr
new file mode 100644
index 0000000000000..b800d89d9bce8
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe.mir.stderr
@@ -0,0 +1,1906 @@
+warning: use of trait `deprecated_safe::DeprSafe` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+  --> $DIR/deprecated-safe.rs:165:1
+   |
+LL | impl DeprSafe for DeprSafeImpl {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(deprecated_safe)]` on by default
+   = note: this trait was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the trait's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:62:5
+   |
+LL |     depr_safe
+   |     ^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:62:5
+   |
+LL |     depr_safe
+   |     ^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:62:5
+   |
+LL |     depr_safe
+   |     ^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:62:5
+   |
+LL |     depr_safe
+   |     ^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:68:14
+   |
+LL | fn foo2() -> impl FnOnce() {
+   |              ^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:68:14
+   |
+LL | fn foo2() -> impl FnOnce() {
+   |              ^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:68:28
+   |
+LL |   fn foo2() -> impl FnOnce() {
+   |  ____________________________^
+LL | |
+LL | |
+LL | |
+...  |
+LL | |
+LL | | }
+   | |_^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:79:5
+   |
+LL |     depr_safe_params
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:79:5
+   |
+LL |     depr_safe_params
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:85:14
+   |
+LL | fn foo4() -> impl FnOnce(u32, u64) {
+   |              ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:85:14
+   |
+LL | fn foo4() -> impl FnOnce(u32, u64) {
+   |              ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:85:36
+   |
+LL |   fn foo4() -> impl FnOnce(u32, u64) {
+   |  ____________________________________^
+LL | |
+LL | |
+LL | |
+...  |
+LL | |
+LL | | }
+   | |_^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:96:5
+   |
+LL |     depr_safe_generic
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:96:5
+   |
+LL |     depr_safe_generic
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:102:14
+   |
+LL | fn foo6() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:102:14
+   |
+LL | fn foo6() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:102:46
+   |
+LL |   fn foo6() -> impl FnOnce(OsString, OsString) {
+   |  ______________________________________________^
+LL | |
+LL | |
+LL | |
+...  |
+LL | |
+LL | | }
+   | |_^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:121:5
+   |
+LL |     Box::new(depr_safe)
+   |     ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:121:5
+   |
+LL |     Box::new(depr_safe)
+   |     ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:121:5
+   |
+LL |     Box::new(depr_safe)
+   |     ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:127:5
+   |
+LL |     Box::new(depr_safe)
+   |     ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:127:5
+   |
+LL |     Box::new(depr_safe)
+   |     ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:127:5
+   |
+LL |     Box::new(depr_safe)
+   |     ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:133:5
+   |
+LL |     Box::new(depr_safe_params)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:133:5
+   |
+LL |     Box::new(depr_safe_params)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:133:5
+   |
+LL |     Box::new(depr_safe_params)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:139:5
+   |
+LL |     Box::new(depr_safe_params)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:139:5
+   |
+LL |     Box::new(depr_safe_params)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:139:5
+   |
+LL |     Box::new(depr_safe_params)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:145:5
+   |
+LL |     Box::new(depr_safe_generic)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:145:5
+   |
+LL |     Box::new(depr_safe_generic)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:145:5
+   |
+LL |     Box::new(depr_safe_generic)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:151:5
+   |
+LL |     Box::new(depr_safe_generic)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:151:5
+   |
+LL |     Box::new(depr_safe_generic)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:151:5
+   |
+LL |     Box::new(depr_safe_generic)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:248:34
+   |
+LL |     let fn_impl: Box<dyn Fn()> = Box::new(depr_safe);
+   |                                  ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:248:34
+   |
+LL |     let fn_impl: Box<dyn Fn()> = Box::new(depr_safe);
+   |                                  ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:248:34
+   |
+LL |     let fn_impl: Box<dyn Fn()> = Box::new(depr_safe);
+   |                                  ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:251:37
+   |
+LL |     let fn_impl: Box<dyn FnMut()> = Box::new(depr_safe);
+   |                                     ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:251:37
+   |
+LL |     let fn_impl: Box<dyn FnMut()> = Box::new(depr_safe);
+   |                                     ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:253:38
+   |
+LL |     let fn_impl: Box<dyn FnOnce()> = Box::new(depr_safe);
+   |                                      ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:253:38
+   |
+LL |     let fn_impl: Box<dyn FnOnce()> = Box::new(depr_safe);
+   |                                      ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:257:34
+   |
+LL |     let fn_impl: Box<dyn Fn()> = Box::new(depr_safe);
+   |                                  ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:258:37
+   |
+LL |     let fn_impl: Box<dyn FnMut()> = Box::new(depr_safe);
+   |                                     ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:259:38
+   |
+LL |     let fn_impl: Box<dyn FnOnce()> = Box::new(depr_safe);
+   |                                      ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:262:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(depr_safe));
+   |                           ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:263:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(depr_safe));
+   |                              ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:264:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(depr_safe));
+   |                               ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:267:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(depr_safe));
+   |                           ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:268:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(depr_safe));
+   |                              ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:269:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(depr_safe));
+   |                               ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:272:5
+   |
+LL |     fn_taking_fn_impl(depr_safe);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:273:5
+   |
+LL |     fn_taking_fnmut_impl(depr_safe);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:274:5
+   |
+LL |     fn_taking_fnonce_impl(depr_safe);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:277:5
+   |
+LL |     fn_taking_fn_impl(depr_safe);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:278:5
+   |
+LL |     fn_taking_fnmut_impl(depr_safe);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:279:5
+   |
+LL |     fn_taking_fnonce_impl(depr_safe);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:286:34
+   |
+LL |     let depr_safe_fn_ptr: fn() = depr_safe;
+   |                                  ^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:289:34
+   |
+LL |     let depr_safe_fn_ptr: fn() = depr_safe;
+   |                                  ^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:293:34
+   |
+LL |     let depr_safe_fn_ptr: fn() = depr_safe;
+   |                                  ^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:294:44
+   |
+LL |     let depr_safe_fn_impl: Box<dyn Fn()> = Box::new(depr_safe);
+   |                                            ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:295:54
+   |
+LL |     let mut depr_safe_fnmut_impl: Box<dyn FnMut()> = Box::new(depr_safe);
+   |                                                      ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:296:52
+   |
+LL |     let depr_safe_fnonce_impl: Box<dyn FnOnce()> = Box::new(depr_safe);
+   |                                                    ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:299:34
+   |
+LL |     let depr_safe_fn_ptr: fn() = depr_safe;
+   |                                  ^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:300:44
+   |
+LL |     let depr_safe_fn_impl: Box<dyn Fn()> = Box::new(depr_safe);
+   |                                            ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:301:54
+   |
+LL |     let mut depr_safe_fnmut_impl: Box<dyn FnMut()> = Box::new(depr_safe);
+   |                                                      ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:302:52
+   |
+LL |     let depr_safe_fnonce_impl: Box<dyn FnOnce()> = Box::new(depr_safe);
+   |                                                    ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:312:22
+   |
+LL |     fn_taking_fn_ptr(depr_safe);
+   |                      ^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:313:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(depr_safe));
+   |                           ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:314:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(depr_safe));
+   |                              ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:315:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(depr_safe));
+   |                               ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:316:5
+   |
+LL |     fn_taking_fn_impl(depr_safe);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:317:5
+   |
+LL |     fn_taking_fnmut_impl(depr_safe);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:318:5
+   |
+LL |     fn_taking_fnonce_impl(depr_safe);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:321:22
+   |
+LL |     fn_taking_fn_ptr(depr_safe);
+   |                      ^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:322:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(depr_safe));
+   |                           ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:323:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(depr_safe));
+   |                              ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:324:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(depr_safe));
+   |                               ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:325:5
+   |
+LL |     fn_taking_fn_impl(depr_safe);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:326:5
+   |
+LL |     fn_taking_fnmut_impl(depr_safe);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:327:5
+   |
+LL |     fn_taking_fnonce_impl(depr_safe);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:331:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:331:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:331:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:334:55
+   |
+LL |     let fn_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:334:55
+   |
+LL |     let fn_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:336:56
+   |
+LL |     let fn_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:336:56
+   |
+LL |     let fn_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:340:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:340:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:342:55
+   |
+LL |     let fn_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:342:55
+   |
+LL |     let fn_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:344:56
+   |
+LL |     let fn_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:344:56
+   |
+LL |     let fn_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:348:35
+   |
+LL |     fn_taking_dyn_fn_impl_generic(Box::new(depr_safe_generic));
+   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:348:35
+   |
+LL |     fn_taking_dyn_fn_impl_generic(Box::new(depr_safe_generic));
+   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:350:38
+   |
+LL |     fn_taking_dyn_fnmut_impl_generic(Box::new(depr_safe_generic));
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:350:38
+   |
+LL |     fn_taking_dyn_fnmut_impl_generic(Box::new(depr_safe_generic));
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:352:39
+   |
+LL |     fn_taking_dyn_fnonce_impl_generic(Box::new(depr_safe_generic));
+   |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:352:39
+   |
+LL |     fn_taking_dyn_fnonce_impl_generic(Box::new(depr_safe_generic));
+   |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:356:35
+   |
+LL |     fn_taking_dyn_fn_impl_generic(Box::new(depr_safe_generic));
+   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:356:35
+   |
+LL |     fn_taking_dyn_fn_impl_generic(Box::new(depr_safe_generic));
+   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:358:38
+   |
+LL |     fn_taking_dyn_fnmut_impl_generic(Box::new(depr_safe_generic));
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:358:38
+   |
+LL |     fn_taking_dyn_fnmut_impl_generic(Box::new(depr_safe_generic));
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:360:39
+   |
+LL |     fn_taking_dyn_fnonce_impl_generic(Box::new(depr_safe_generic));
+   |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:360:39
+   |
+LL |     fn_taking_dyn_fnonce_impl_generic(Box::new(depr_safe_generic));
+   |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:364:5
+   |
+LL |     fn_taking_fn_impl_generic(depr_safe_generic);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:365:5
+   |
+LL |     fn_taking_fnmut_impl_generic(depr_safe_generic);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:366:5
+   |
+LL |     fn_taking_fnonce_impl_generic(depr_safe_generic);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:369:5
+   |
+LL |     fn_taking_fn_impl_generic(depr_safe_generic);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:370:5
+   |
+LL |     fn_taking_fnmut_impl_generic(depr_safe_generic);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:371:5
+   |
+LL |     fn_taking_fnonce_impl_generic(depr_safe_generic);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:378:42
+   |
+LL |     let depr_safe_generic_fn_ptr: fn() = depr_safe;
+   |                                          ^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:381:42
+   |
+LL |     let depr_safe_generic_fn_ptr: fn() = depr_safe;
+   |                                          ^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:385:60
+   |
+LL |     let depr_safe_generic_fn_ptr: fn(OsString, OsString) = depr_safe_generic;
+   |                                                            ^^^^^^^^^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:386:70
+   |
+LL |     let depr_safe_generic_fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:386:70
+   |
+LL |     let depr_safe_generic_fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:388:80
+   |
+LL |     let mut depr_safe_generic_fnmut_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:388:80
+   |
+LL |     let mut depr_safe_generic_fnmut_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:390:78
+   |
+LL |     let depr_safe_generic_fnonce_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:390:78
+   |
+LL |     let depr_safe_generic_fnonce_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:394:60
+   |
+LL |     let depr_safe_generic_fn_ptr: fn(OsString, OsString) = depr_safe_generic;
+   |                                                            ^^^^^^^^^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:395:70
+   |
+LL |     let depr_safe_generic_fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:395:70
+   |
+LL |     let depr_safe_generic_fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:397:80
+   |
+LL |     let mut depr_safe_generic_fnmut_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:397:80
+   |
+LL |     let mut depr_safe_generic_fnmut_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:399:78
+   |
+LL |     let depr_safe_generic_fnonce_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:399:78
+   |
+LL |     let depr_safe_generic_fnonce_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:410:30
+   |
+LL |     fn_taking_fn_ptr_generic(depr_safe_generic);
+   |                              ^^^^^^^^^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:411:35
+   |
+LL |     fn_taking_dyn_fn_impl_generic(Box::new(depr_safe_generic));
+   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:411:35
+   |
+LL |     fn_taking_dyn_fn_impl_generic(Box::new(depr_safe_generic));
+   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:413:38
+   |
+LL |     fn_taking_dyn_fnmut_impl_generic(Box::new(depr_safe_generic));
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:413:38
+   |
+LL |     fn_taking_dyn_fnmut_impl_generic(Box::new(depr_safe_generic));
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:415:39
+   |
+LL |     fn_taking_dyn_fnonce_impl_generic(Box::new(depr_safe_generic));
+   |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:415:39
+   |
+LL |     fn_taking_dyn_fnonce_impl_generic(Box::new(depr_safe_generic));
+   |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:417:5
+   |
+LL |     fn_taking_fn_impl_generic(depr_safe_generic);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:418:5
+   |
+LL |     fn_taking_fnmut_impl_generic(depr_safe_generic);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:419:5
+   |
+LL |     fn_taking_fnonce_impl_generic(depr_safe_generic);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:422:30
+   |
+LL |     fn_taking_fn_ptr_generic(depr_safe_generic);
+   |                              ^^^^^^^^^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:423:35
+   |
+LL |     fn_taking_dyn_fn_impl_generic(Box::new(depr_safe_generic));
+   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:423:35
+   |
+LL |     fn_taking_dyn_fn_impl_generic(Box::new(depr_safe_generic));
+   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:425:38
+   |
+LL |     fn_taking_dyn_fnmut_impl_generic(Box::new(depr_safe_generic));
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:425:38
+   |
+LL |     fn_taking_dyn_fnmut_impl_generic(Box::new(depr_safe_generic));
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:427:39
+   |
+LL |     fn_taking_dyn_fnonce_impl_generic(Box::new(depr_safe_generic));
+   |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:427:39
+   |
+LL |     fn_taking_dyn_fnonce_impl_generic(Box::new(depr_safe_generic));
+   |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:429:5
+   |
+LL |     fn_taking_fn_impl_generic(depr_safe_generic);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:430:5
+   |
+LL |     fn_taking_fnmut_impl_generic(depr_safe_generic);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:431:5
+   |
+LL |     fn_taking_fnonce_impl_generic(depr_safe_generic);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:24:14
+   |
+LL | type Tait1 = impl FnOnce();
+   |              ^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:24:14
+   |
+LL | type Tait1 = impl FnOnce();
+   |              ^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:79:5
+   |
+LL |     depr_safe_params
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:79:5
+   |
+LL |     depr_safe_params
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:26:14
+   |
+LL | type Tait2 = impl FnOnce(u32, u64);
+   |              ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:26:14
+   |
+LL | type Tait2 = impl FnOnce(u32, u64);
+   |              ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:96:5
+   |
+LL |     depr_safe_generic
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:96:5
+   |
+LL |     depr_safe_generic
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:28:14
+   |
+LL | type Tait3 = impl FnOnce(OsString, OsString);
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:28:14
+   |
+LL | type Tait3 = impl FnOnce(OsString, OsString);
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:74:5
+   |
+LL |     depr_safe
+   |     ^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:74:5
+   |
+LL |     depr_safe
+   |     ^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:68:14
+   |
+LL | fn foo2() -> impl FnOnce() {
+   |              ^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:68:14
+   |
+LL | fn foo2() -> impl FnOnce() {
+   |              ^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:91:5
+   |
+LL |     depr_safe_params
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:91:5
+   |
+LL |     depr_safe_params
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:85:14
+   |
+LL | fn foo4() -> impl FnOnce(u32, u64) {
+   |              ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:85:14
+   |
+LL | fn foo4() -> impl FnOnce(u32, u64) {
+   |              ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:108:5
+   |
+LL |     depr_safe_generic
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:108:5
+   |
+LL |     depr_safe_generic
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:102:14
+   |
+LL | fn foo6() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:102:14
+   |
+LL | fn foo6() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe.rs:194:5
+   |
+LL |     fn depr_safe_fn(&self) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_params` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe.rs:196:5
+   |
+LL |     fn depr_safe_params(&self, _: u32, _: u64) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_generic` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe.rs:198:5
+   |
+LL |     fn depr_safe_fn_generic<K: AsRef<OsStr>, V: AsRef<OsStr>>(&self, key: K, value: V) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_2018` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe.rs:206:5
+   |
+LL |     fn depr_safe_fn_2018(&self) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn` without an unsafe function or block has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe.rs:211:5
+   |
+LL |     good.depr_safe_fn();
+   |     ^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_params` without an unsafe function or block has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe.rs:212:5
+   |
+LL |     good.depr_safe_params(0, 0);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_generic` without an unsafe function or block has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe.rs:213:5
+   |
+LL |     good.depr_safe_fn_generic("", "");
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_2018` without an unsafe function or block has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe.rs:219:5
+   |
+LL |     good.depr_safe_fn_2018();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn` without an unsafe function or block has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe.rs:222:5
+   |
+LL |     bad.depr_safe_fn();
+   |     ^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_params` without an unsafe function or block has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe.rs:223:5
+   |
+LL |     bad.depr_safe_params(0, 0);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_generic` without an unsafe function or block has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe.rs:224:5
+   |
+LL |     bad.depr_safe_fn_generic("", "");
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_2018` without an unsafe function or block has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe.rs:230:5
+   |
+LL |     bad.depr_safe_fn_2018();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe.rs:239:5
+   |
+LL |     unsafe {
+   |     ^^^^^^ unnecessary `unsafe` block
+   |
+note: the lint level is defined here
+  --> $DIR/deprecated-safe.rs:10:9
+   |
+LL | #![warn(unused_unsafe)]
+   |         ^^^^^^^^^^^^^
+
+warning: use of function `deprecated_safe::depr_safe` without an unsafe function or block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:282:5
+   |
+LL |     depr_safe();
+   |     ^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` without an unsafe function or block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:283:5
+   |
+LL |     depr_safe();
+   |     ^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` without an unsafe function or block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:374:5
+   |
+LL |     depr_safe_generic("", "");
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` without an unsafe function or block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:375:5
+   |
+LL |     depr_safe_generic("", "");
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: 188 warnings emitted
+
diff --git a/src/test/ui/deprecated-safe/deprecated-safe.rs b/src/test/ui/deprecated-safe/deprecated-safe.rs
new file mode 100644
index 0000000000000..7541781362e52
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe.rs
@@ -0,0 +1,454 @@
+// aux-build:deprecated-safe.rs
+// check-pass
+// revisions: mir thir
+// [thir]compile-flags: -Z thir-unsafeck
+
+// FIXME(skippy) add tests in combination with #[target_feature], ensure #[deprecated_safe]
+// doesn't silence these accidentally
+
+#![feature(type_alias_impl_trait)]
+#![warn(unused_unsafe)]
+
+extern crate deprecated_safe;
+
+use deprecated_safe::{
+    depr_safe, depr_safe_params, depr_safe_future, depr_safe_generic,
+    DeprSafe, DeprSafeFns
+};
+use std::ffi::{OsStr, OsString};
+
+trait Bla {
+    type T;
+}
+
+type Tait1 = impl FnOnce(); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+//~| WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+type Tait2 = impl FnOnce(u32, u64); //~ WARN use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+//~| WARN use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+type Tait3 = impl FnOnce(OsString, OsString); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+//~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+type Tait4 = impl FnOnce();
+type Tait5 = Box<dyn FnOnce()>;
+type Tait6 = Box<dyn FnOnce(u32, u64)>;
+type Tait7 = Box<dyn FnOnce(OsString, OsString)>;
+type Tait8 = Box<dyn FnOnce()>;
+
+impl Bla for u8 {
+    type T = Tait1;
+}
+impl Bla for u16 {
+    type T = Tait2;
+}
+impl Bla for u32 {
+    type T = Tait3;
+}
+impl Bla for u64 {
+    type T = Tait4;
+}
+impl Bla for i8 {
+    type T = Tait5;
+}
+impl Bla for i16 {
+    type T = Tait6;
+}
+impl Bla for i32 {
+    type T = Tait7;
+}
+impl Bla for i64 {
+    type T = Tait8;
+}
+
+fn foo1() -> Tait1 {
+    depr_safe //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+}
+
+fn foo2() -> impl FnOnce() {
+    //~^ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    depr_safe //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+}
+
+fn foo3() -> Tait2 {
+    depr_safe_params //~ WARN use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+}
+
+fn foo4() -> impl FnOnce(u32, u64) {
+    //~^ WARN use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+    depr_safe_params //~ WARN use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+}
+
+fn foo5() -> Tait3 {
+    depr_safe_generic //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+}
+
+fn foo6() -> impl FnOnce(OsString, OsString) {
+    //~^ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    depr_safe_generic //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+}
+
+fn foo7() -> Tait4 {
+    depr_safe_future
+}
+
+fn foo8() -> impl FnOnce() {
+    depr_safe_future
+}
+
+fn foo10() -> Tait5 {
+    Box::new(depr_safe) //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+}
+
+fn foo11() -> Box<dyn FnOnce()> {
+    Box::new(depr_safe) //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+}
+
+fn foo12() -> Tait6 {
+    Box::new(depr_safe_params) //~ WARN use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+}
+
+fn foo13() -> Box<dyn FnOnce(u32, u64)> {
+    Box::new(depr_safe_params) //~ WARN use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+}
+
+fn foo14() -> Tait7 {
+    Box::new(depr_safe_generic) //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+}
+
+fn foo15() -> Box<dyn FnOnce(OsString, OsString)> {
+    Box::new(depr_safe_generic) //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+}
+
+fn foo16() -> Tait8 {
+    Box::new(depr_safe_future)
+}
+
+fn foo17() -> Box<dyn FnOnce()> {
+    Box::new(depr_safe_future)
+}
+
+struct DeprSafeImpl;
+impl DeprSafe for DeprSafeImpl {} //~ WARN use of trait `deprecated_safe::DeprSafe` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+
+struct DeprSafeUnsafeImpl;
+unsafe impl DeprSafe for DeprSafeUnsafeImpl {}
+
+unsafe fn unsafe_fn() {
+    depr_safe();
+    depr_safe_generic("", "");
+}
+
+struct DeprSafeFnsGood;
+impl DeprSafeFns for DeprSafeFnsGood {
+    unsafe fn depr_safe_fn(&self) {}
+
+    unsafe fn depr_safe_params(&self, _: u32, _: u64) {}
+
+    unsafe fn depr_safe_fn_generic<K: AsRef<OsStr>, V: AsRef<OsStr>>(&self, key: K, value: V) {}
+
+    fn depr_safe_fn_future(&self) {}
+
+    unsafe fn depr_safe_fn_2015(&self) {}
+
+    fn depr_safe_fn_2015_future(&self) {}
+
+    unsafe fn depr_safe_fn_2018(&self) {}
+}
+
+struct DeprSafeFnsBad;
+impl DeprSafeFns for DeprSafeFnsBad {
+    fn depr_safe_fn(&self) {} //~ WARN use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+
+    fn depr_safe_params(&self, _: u32, _: u64) {} //~ WARN use of associated function `deprecated_safe::DeprSafeFns::depr_safe_params` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+
+    fn depr_safe_fn_generic<K: AsRef<OsStr>, V: AsRef<OsStr>>(&self, key: K, value: V) {} //~ WARN use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_generic` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+
+    fn depr_safe_fn_future(&self) {}
+
+    unsafe fn depr_safe_fn_2015(&self) {}
+
+    fn depr_safe_fn_2015_future(&self) {}
+
+    fn depr_safe_fn_2018(&self) {} //~ WARN use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_2018` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+}
+
+fn foo0() {
+    let good = DeprSafeFnsGood;
+    good.depr_safe_fn(); //~ WARN use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn` without an unsafe function or block has been deprecated as it is now an unsafe associated function
+    good.depr_safe_params(0, 0); //~ WARN use of associated function `deprecated_safe::DeprSafeFns::depr_safe_params` without an unsafe function or block has been deprecated as it is now an unsafe associated function
+    good.depr_safe_fn_generic("", ""); //~ WARN use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_generic` without an unsafe function or block has been deprecated as it is now an unsafe associated function
+    good.depr_safe_fn_future();
+    unsafe {
+        good.depr_safe_fn_2015();
+    }
+    good.depr_safe_fn_2015_future();
+    good.depr_safe_fn_2018(); //~ WARN use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_2018` without an unsafe function or block has been deprecated as it is now an unsafe associated function
+
+    let bad = DeprSafeFnsBad;
+    bad.depr_safe_fn(); //~ WARN use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn` without an unsafe function or block has been deprecated as it is now an unsafe associated function
+    bad.depr_safe_params(0, 0); //~ WARN use of associated function `deprecated_safe::DeprSafeFns::depr_safe_params` without an unsafe function or block has been deprecated as it is now an unsafe associated function
+    bad.depr_safe_fn_generic("", ""); //~ WARN use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_generic` without an unsafe function or block has been deprecated as it is now an unsafe associated function
+    bad.depr_safe_fn_future();
+    unsafe {
+        bad.depr_safe_fn_2015();
+    }
+    bad.depr_safe_fn_2015_future();
+    bad.depr_safe_fn_2018(); //~ WARN use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_2018` without an unsafe function or block has been deprecated as it is now an unsafe associated function
+
+    unsafe{
+        good.depr_safe_fn();
+        good.depr_safe_params(0, 0);
+        good.depr_safe_fn_generic("", "");
+        good.depr_safe_fn_2015();
+        good.depr_safe_fn_2018();
+    }
+    unsafe {
+        //~^ WARN unnecessary `unsafe` block
+        good.depr_safe_fn_future();
+        good.depr_safe_fn_2015_future();
+    }
+}
+
+fn main() {
+    // test for dyn Fn() coercion where arguments match (no args)
+    let fn_impl: Box<dyn Fn()> = Box::new(depr_safe); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+                                                      //~| WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+                                                      //~| WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    let fn_impl: Box<dyn FnMut()> = Box::new(depr_safe); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+                                                         //~| WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    let fn_impl: Box<dyn FnOnce()> = Box::new(depr_safe); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+                                                          //~| WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+
+    // test that second usage still lints
+    let fn_impl: Box<dyn Fn()> = Box::new(depr_safe); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    let fn_impl: Box<dyn FnMut()> = Box::new(depr_safe); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    let fn_impl: Box<dyn FnOnce()> = Box::new(depr_safe); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+
+    // test variant where coercion occurs on a function argument instead of a variable
+    fn_taking_dyn_fn_impl(Box::new(depr_safe)); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnmut_impl(Box::new(depr_safe)); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnonce_impl(Box::new(depr_safe)); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+
+    // test that second usage still lints
+    fn_taking_dyn_fn_impl(Box::new(depr_safe)); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnmut_impl(Box::new(depr_safe)); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnonce_impl(Box::new(depr_safe)); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+
+    // test for non-dyn Fn() coercion (no unsizing)
+    fn_taking_fn_impl(depr_safe); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnmut_impl(depr_safe); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnonce_impl(depr_safe); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+
+    // test that second usage still lints
+    fn_taking_fn_impl(depr_safe); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnmut_impl(depr_safe); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnonce_impl(depr_safe); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+
+    // usage without unsafe should lint
+    depr_safe(); //~ WARN use of function `deprecated_safe::depr_safe` without an unsafe function or block has been deprecated as it is now an unsafe function
+    depr_safe(); //~ WARN use of function `deprecated_safe::depr_safe` without an unsafe function or block has been deprecated as it is now an unsafe function
+
+    // test for fn() coercion where arguments match (no args)
+    let depr_safe_fn_ptr: fn() = depr_safe; //~ WARN use of function `deprecated_safe::depr_safe` as a normal fn pointer has been deprecated as it is now an unsafe function
+
+    // test that second usage still lints
+    let depr_safe_fn_ptr: fn() = depr_safe; //~ WARN use of function `deprecated_safe::depr_safe` as a normal fn pointer has been deprecated as it is now an unsafe function
+
+    // test for fn() coercion where arguments don't match, where an
+    // intermediate fn() will be used
+    let depr_safe_fn_ptr: fn() = depr_safe; //~ WARN use of function `deprecated_safe::depr_safe` as a normal fn pointer has been deprecated as it is now an unsafe function
+    let depr_safe_fn_impl: Box<dyn Fn()> = Box::new(depr_safe); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    let mut depr_safe_fnmut_impl: Box<dyn FnMut()> = Box::new(depr_safe); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    let depr_safe_fnonce_impl: Box<dyn FnOnce()> = Box::new(depr_safe); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+
+    // test that second usage still lints
+    let depr_safe_fn_ptr: fn() = depr_safe; //~ WARN use of function `deprecated_safe::depr_safe` as a normal fn pointer has been deprecated as it is now an unsafe function
+    let depr_safe_fn_impl: Box<dyn Fn()> = Box::new(depr_safe); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    let mut depr_safe_fnmut_impl: Box<dyn FnMut()> = Box::new(depr_safe); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    let depr_safe_fnonce_impl: Box<dyn FnOnce()> = Box::new(depr_safe); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+
+    // these shouldn't lint, appropriate unsafe usage
+    let unsafe_depr_safe_fn_ptr: unsafe fn() = depr_safe;
+    fn_taking_unsafe_fn_ptr(depr_safe);
+    unsafe {
+        depr_safe();
+    }
+
+    // all of these coercions should lint
+    fn_taking_fn_ptr(depr_safe); //~ WARN use of function `deprecated_safe::depr_safe` as a normal fn pointer has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fn_impl(Box::new(depr_safe)); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnmut_impl(Box::new(depr_safe)); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnonce_impl(Box::new(depr_safe)); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fn_impl(depr_safe); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnmut_impl(depr_safe); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnonce_impl(depr_safe); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+
+    // ensure lint still fires if coerced again
+    fn_taking_fn_ptr(depr_safe); //~ WARN use of function `deprecated_safe::depr_safe` as a normal fn pointer has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fn_impl(Box::new(depr_safe)); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnmut_impl(Box::new(depr_safe)); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnonce_impl(Box::new(depr_safe)); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fn_impl(depr_safe); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnmut_impl(depr_safe); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnonce_impl(depr_safe); //~ WARN use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+
+    // test for dyn Fn() coercion where arguments don't match, where an
+    // intermediate fn() will be used
+    let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(depr_safe_generic); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+                                                                      //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+                                                                      //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    let fn_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(depr_safe_generic); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+                                                                         //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    let fn_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(depr_safe_generic); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+                                                                          //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+
+    // test that second usage still lints
+    let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(depr_safe_generic); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+                                                                      //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    let fn_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(depr_safe_generic); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+                                                                         //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    let fn_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(depr_safe_generic); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+                                                                          //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+
+    // test variant where coercion occurs on a function argument instead of a variable
+    fn_taking_dyn_fn_impl_generic(Box::new(depr_safe_generic)); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+                                              //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnmut_impl_generic(Box::new(depr_safe_generic)); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+                                                 //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnonce_impl_generic(Box::new(depr_safe_generic)); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+                                                  //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+
+    // test that second usage still lints
+    fn_taking_dyn_fn_impl_generic(Box::new(depr_safe_generic)); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+                                              //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnmut_impl_generic(Box::new(depr_safe_generic)); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+                                                 //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnonce_impl_generic(Box::new(depr_safe_generic)); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+                                                  //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+
+    // test for non-dyn Fn() coercion (no unsizing)
+    fn_taking_fn_impl_generic(depr_safe_generic); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnmut_impl_generic(depr_safe_generic); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnonce_impl_generic(depr_safe_generic); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+
+    // test that second usage still lints
+    fn_taking_fn_impl_generic(depr_safe_generic); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnmut_impl_generic(depr_safe_generic); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnonce_impl_generic(depr_safe_generic); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+
+    // usage without unsafe should lint
+    depr_safe_generic("", ""); //~ WARN use of function `deprecated_safe::depr_safe_generic` without an unsafe function or block has been deprecated as it is now an unsafe function
+    depr_safe_generic("", ""); //~ WARN use of function `deprecated_safe::depr_safe_generic` without an unsafe function or block has been deprecated as it is now an unsafe function
+
+    // test for fn() coercion where arguments match (no args)
+    let depr_safe_generic_fn_ptr: fn() = depr_safe; //~ WARN use of function `deprecated_safe::depr_safe` as a normal fn pointer has been deprecated as it is now an unsafe function
+
+    // test that second usage still lints
+    let depr_safe_generic_fn_ptr: fn() = depr_safe; //~ WARN use of function `deprecated_safe::depr_safe` as a normal fn pointer has been deprecated as it is now an unsafe function
+
+    // test for fn() coercion where arguments don't match, where an
+    // intermediate fn() will be used
+    let depr_safe_generic_fn_ptr: fn(OsString, OsString) = depr_safe_generic; //~ WARN use of function `deprecated_safe::depr_safe_generic` as a normal fn pointer has been deprecated as it is now an unsafe function
+    let depr_safe_generic_fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(depr_safe_generic); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+                                                                              //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    let mut depr_safe_generic_fnmut_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(depr_safe_generic); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+                                                                                        //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    let depr_safe_generic_fnonce_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(depr_safe_generic); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+                                                                                      //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+
+    // test that second usage still lints
+    let depr_safe_generic_fn_ptr: fn(OsString, OsString) = depr_safe_generic; //~ WARN use of function `deprecated_safe::depr_safe_generic` as a normal fn pointer has been deprecated as it is now an unsafe function
+    let depr_safe_generic_fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(depr_safe_generic); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+                                                                              //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    let mut depr_safe_generic_fnmut_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(depr_safe_generic); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+                                                                                        //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    let depr_safe_generic_fnonce_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(depr_safe_generic); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+                                                                                      //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+
+    // these shouldn't lint, appropriate unsafe usage
+    let unsafe_depr_safe_generic_fn_ptr: unsafe fn(OsString, OsString) = depr_safe_generic;
+    fn_taking_unsafe_fn_ptr_generic(depr_safe_generic);
+    unsafe {
+        depr_safe_generic("", "");
+    }
+
+    // all of these coercions should lint
+    fn_taking_fn_ptr_generic(depr_safe_generic); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a normal fn pointer has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fn_impl_generic(Box::new(depr_safe_generic)); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+                                              //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnmut_impl_generic(Box::new(depr_safe_generic)); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+                                                 //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnonce_impl_generic(Box::new(depr_safe_generic)); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+                                                  //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fn_impl_generic(depr_safe_generic); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnmut_impl_generic(depr_safe_generic); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnonce_impl_generic(depr_safe_generic); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+
+    // ensure lint still fires if coerced again
+    fn_taking_fn_ptr_generic(depr_safe_generic); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a normal fn pointer has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fn_impl_generic(Box::new(depr_safe_generic)); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+                                              //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnmut_impl_generic(Box::new(depr_safe_generic)); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+                                                 //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_dyn_fnonce_impl_generic(Box::new(depr_safe_generic)); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+                                                  //~| WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fn_impl_generic(depr_safe_generic); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnmut_impl_generic(depr_safe_generic); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+    fn_taking_fnonce_impl_generic(depr_safe_generic); //~ WARN use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+}
+
+fn fn_taking_fn_ptr(_: fn()) {}
+fn fn_taking_unsafe_fn_ptr(_: unsafe fn()) {}
+
+fn fn_taking_dyn_fn_impl(_: Box<dyn Fn()>) {}
+fn fn_taking_dyn_fnmut_impl(_: Box<dyn FnMut()>) {}
+fn fn_taking_dyn_fnonce_impl(_: Box<dyn FnOnce()>) {}
+
+fn fn_taking_fn_impl(_: impl Fn()) {}
+fn fn_taking_fnmut_impl(_: impl FnMut()) {}
+fn fn_taking_fnonce_impl(_: impl FnOnce()) {}
+
+fn fn_taking_fn_ptr_generic(_: fn(OsString, OsString)) {}
+fn fn_taking_unsafe_fn_ptr_generic(_: unsafe fn(OsString, OsString)) {}
+
+fn fn_taking_dyn_fn_impl_generic(_: Box<dyn Fn(OsString, OsString)>) {}
+fn fn_taking_dyn_fnmut_impl_generic(_: Box<dyn FnMut(OsString, OsString)>) {}
+fn fn_taking_dyn_fnonce_impl_generic(_: Box<dyn FnOnce(OsString, OsString)>) {}
+
+fn fn_taking_fn_impl_generic(_: impl Fn(OsString, OsString)) {}
+fn fn_taking_fnmut_impl_generic(_: impl FnMut(OsString, OsString)) {}
+fn fn_taking_fnonce_impl_generic(_: impl FnOnce(OsString, OsString)) {}
diff --git a/src/test/ui/deprecated-safe/deprecated-safe.thir.stderr b/src/test/ui/deprecated-safe/deprecated-safe.thir.stderr
new file mode 100644
index 0000000000000..b800d89d9bce8
--- /dev/null
+++ b/src/test/ui/deprecated-safe/deprecated-safe.thir.stderr
@@ -0,0 +1,1906 @@
+warning: use of trait `deprecated_safe::DeprSafe` without an `unsafe impl` declaration has been deprecated as it is now an unsafe trait
+  --> $DIR/deprecated-safe.rs:165:1
+   |
+LL | impl DeprSafe for DeprSafeImpl {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(deprecated_safe)]` on by default
+   = note: this trait was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the trait's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:62:5
+   |
+LL |     depr_safe
+   |     ^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:62:5
+   |
+LL |     depr_safe
+   |     ^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:62:5
+   |
+LL |     depr_safe
+   |     ^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:62:5
+   |
+LL |     depr_safe
+   |     ^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:68:14
+   |
+LL | fn foo2() -> impl FnOnce() {
+   |              ^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:68:14
+   |
+LL | fn foo2() -> impl FnOnce() {
+   |              ^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:68:28
+   |
+LL |   fn foo2() -> impl FnOnce() {
+   |  ____________________________^
+LL | |
+LL | |
+LL | |
+...  |
+LL | |
+LL | | }
+   | |_^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:79:5
+   |
+LL |     depr_safe_params
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:79:5
+   |
+LL |     depr_safe_params
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:85:14
+   |
+LL | fn foo4() -> impl FnOnce(u32, u64) {
+   |              ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:85:14
+   |
+LL | fn foo4() -> impl FnOnce(u32, u64) {
+   |              ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:85:36
+   |
+LL |   fn foo4() -> impl FnOnce(u32, u64) {
+   |  ____________________________________^
+LL | |
+LL | |
+LL | |
+...  |
+LL | |
+LL | | }
+   | |_^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:96:5
+   |
+LL |     depr_safe_generic
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:96:5
+   |
+LL |     depr_safe_generic
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:102:14
+   |
+LL | fn foo6() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:102:14
+   |
+LL | fn foo6() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:102:46
+   |
+LL |   fn foo6() -> impl FnOnce(OsString, OsString) {
+   |  ______________________________________________^
+LL | |
+LL | |
+LL | |
+...  |
+LL | |
+LL | | }
+   | |_^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:121:5
+   |
+LL |     Box::new(depr_safe)
+   |     ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:121:5
+   |
+LL |     Box::new(depr_safe)
+   |     ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:121:5
+   |
+LL |     Box::new(depr_safe)
+   |     ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:127:5
+   |
+LL |     Box::new(depr_safe)
+   |     ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:127:5
+   |
+LL |     Box::new(depr_safe)
+   |     ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:127:5
+   |
+LL |     Box::new(depr_safe)
+   |     ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:133:5
+   |
+LL |     Box::new(depr_safe_params)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:133:5
+   |
+LL |     Box::new(depr_safe_params)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:133:5
+   |
+LL |     Box::new(depr_safe_params)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:139:5
+   |
+LL |     Box::new(depr_safe_params)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:139:5
+   |
+LL |     Box::new(depr_safe_params)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:139:5
+   |
+LL |     Box::new(depr_safe_params)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:145:5
+   |
+LL |     Box::new(depr_safe_generic)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:145:5
+   |
+LL |     Box::new(depr_safe_generic)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:145:5
+   |
+LL |     Box::new(depr_safe_generic)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:151:5
+   |
+LL |     Box::new(depr_safe_generic)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:151:5
+   |
+LL |     Box::new(depr_safe_generic)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:151:5
+   |
+LL |     Box::new(depr_safe_generic)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:248:34
+   |
+LL |     let fn_impl: Box<dyn Fn()> = Box::new(depr_safe);
+   |                                  ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:248:34
+   |
+LL |     let fn_impl: Box<dyn Fn()> = Box::new(depr_safe);
+   |                                  ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:248:34
+   |
+LL |     let fn_impl: Box<dyn Fn()> = Box::new(depr_safe);
+   |                                  ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:251:37
+   |
+LL |     let fn_impl: Box<dyn FnMut()> = Box::new(depr_safe);
+   |                                     ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:251:37
+   |
+LL |     let fn_impl: Box<dyn FnMut()> = Box::new(depr_safe);
+   |                                     ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:253:38
+   |
+LL |     let fn_impl: Box<dyn FnOnce()> = Box::new(depr_safe);
+   |                                      ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:253:38
+   |
+LL |     let fn_impl: Box<dyn FnOnce()> = Box::new(depr_safe);
+   |                                      ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:257:34
+   |
+LL |     let fn_impl: Box<dyn Fn()> = Box::new(depr_safe);
+   |                                  ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:258:37
+   |
+LL |     let fn_impl: Box<dyn FnMut()> = Box::new(depr_safe);
+   |                                     ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:259:38
+   |
+LL |     let fn_impl: Box<dyn FnOnce()> = Box::new(depr_safe);
+   |                                      ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:262:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(depr_safe));
+   |                           ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:263:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(depr_safe));
+   |                              ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:264:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(depr_safe));
+   |                               ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:267:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(depr_safe));
+   |                           ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:268:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(depr_safe));
+   |                              ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:269:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(depr_safe));
+   |                               ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:272:5
+   |
+LL |     fn_taking_fn_impl(depr_safe);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:273:5
+   |
+LL |     fn_taking_fnmut_impl(depr_safe);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:274:5
+   |
+LL |     fn_taking_fnonce_impl(depr_safe);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:277:5
+   |
+LL |     fn_taking_fn_impl(depr_safe);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:278:5
+   |
+LL |     fn_taking_fnmut_impl(depr_safe);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:279:5
+   |
+LL |     fn_taking_fnonce_impl(depr_safe);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:286:34
+   |
+LL |     let depr_safe_fn_ptr: fn() = depr_safe;
+   |                                  ^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:289:34
+   |
+LL |     let depr_safe_fn_ptr: fn() = depr_safe;
+   |                                  ^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:293:34
+   |
+LL |     let depr_safe_fn_ptr: fn() = depr_safe;
+   |                                  ^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:294:44
+   |
+LL |     let depr_safe_fn_impl: Box<dyn Fn()> = Box::new(depr_safe);
+   |                                            ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:295:54
+   |
+LL |     let mut depr_safe_fnmut_impl: Box<dyn FnMut()> = Box::new(depr_safe);
+   |                                                      ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:296:52
+   |
+LL |     let depr_safe_fnonce_impl: Box<dyn FnOnce()> = Box::new(depr_safe);
+   |                                                    ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:299:34
+   |
+LL |     let depr_safe_fn_ptr: fn() = depr_safe;
+   |                                  ^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:300:44
+   |
+LL |     let depr_safe_fn_impl: Box<dyn Fn()> = Box::new(depr_safe);
+   |                                            ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:301:54
+   |
+LL |     let mut depr_safe_fnmut_impl: Box<dyn FnMut()> = Box::new(depr_safe);
+   |                                                      ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:302:52
+   |
+LL |     let depr_safe_fnonce_impl: Box<dyn FnOnce()> = Box::new(depr_safe);
+   |                                                    ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:312:22
+   |
+LL |     fn_taking_fn_ptr(depr_safe);
+   |                      ^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:313:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(depr_safe));
+   |                           ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:314:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(depr_safe));
+   |                              ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:315:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(depr_safe));
+   |                               ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:316:5
+   |
+LL |     fn_taking_fn_impl(depr_safe);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:317:5
+   |
+LL |     fn_taking_fnmut_impl(depr_safe);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:318:5
+   |
+LL |     fn_taking_fnonce_impl(depr_safe);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:321:22
+   |
+LL |     fn_taking_fn_ptr(depr_safe);
+   |                      ^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:322:27
+   |
+LL |     fn_taking_dyn_fn_impl(Box::new(depr_safe));
+   |                           ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:323:30
+   |
+LL |     fn_taking_dyn_fnmut_impl(Box::new(depr_safe));
+   |                              ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:324:31
+   |
+LL |     fn_taking_dyn_fnonce_impl(Box::new(depr_safe));
+   |                               ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:325:5
+   |
+LL |     fn_taking_fn_impl(depr_safe);
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:326:5
+   |
+LL |     fn_taking_fnmut_impl(depr_safe);
+   |     ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:327:5
+   |
+LL |     fn_taking_fnonce_impl(depr_safe);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:331:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:331:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:331:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:334:55
+   |
+LL |     let fn_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:334:55
+   |
+LL |     let fn_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:336:56
+   |
+LL |     let fn_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:336:56
+   |
+LL |     let fn_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:340:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:340:52
+   |
+LL |     let fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:342:55
+   |
+LL |     let fn_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:342:55
+   |
+LL |     let fn_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:344:56
+   |
+LL |     let fn_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:344:56
+   |
+LL |     let fn_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:348:35
+   |
+LL |     fn_taking_dyn_fn_impl_generic(Box::new(depr_safe_generic));
+   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:348:35
+   |
+LL |     fn_taking_dyn_fn_impl_generic(Box::new(depr_safe_generic));
+   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:350:38
+   |
+LL |     fn_taking_dyn_fnmut_impl_generic(Box::new(depr_safe_generic));
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:350:38
+   |
+LL |     fn_taking_dyn_fnmut_impl_generic(Box::new(depr_safe_generic));
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:352:39
+   |
+LL |     fn_taking_dyn_fnonce_impl_generic(Box::new(depr_safe_generic));
+   |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:352:39
+   |
+LL |     fn_taking_dyn_fnonce_impl_generic(Box::new(depr_safe_generic));
+   |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:356:35
+   |
+LL |     fn_taking_dyn_fn_impl_generic(Box::new(depr_safe_generic));
+   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:356:35
+   |
+LL |     fn_taking_dyn_fn_impl_generic(Box::new(depr_safe_generic));
+   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:358:38
+   |
+LL |     fn_taking_dyn_fnmut_impl_generic(Box::new(depr_safe_generic));
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:358:38
+   |
+LL |     fn_taking_dyn_fnmut_impl_generic(Box::new(depr_safe_generic));
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:360:39
+   |
+LL |     fn_taking_dyn_fnonce_impl_generic(Box::new(depr_safe_generic));
+   |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:360:39
+   |
+LL |     fn_taking_dyn_fnonce_impl_generic(Box::new(depr_safe_generic));
+   |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:364:5
+   |
+LL |     fn_taking_fn_impl_generic(depr_safe_generic);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:365:5
+   |
+LL |     fn_taking_fnmut_impl_generic(depr_safe_generic);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:366:5
+   |
+LL |     fn_taking_fnonce_impl_generic(depr_safe_generic);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:369:5
+   |
+LL |     fn_taking_fn_impl_generic(depr_safe_generic);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:370:5
+   |
+LL |     fn_taking_fnmut_impl_generic(depr_safe_generic);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:371:5
+   |
+LL |     fn_taking_fnonce_impl_generic(depr_safe_generic);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:378:42
+   |
+LL |     let depr_safe_generic_fn_ptr: fn() = depr_safe;
+   |                                          ^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:381:42
+   |
+LL |     let depr_safe_generic_fn_ptr: fn() = depr_safe;
+   |                                          ^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:385:60
+   |
+LL |     let depr_safe_generic_fn_ptr: fn(OsString, OsString) = depr_safe_generic;
+   |                                                            ^^^^^^^^^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:386:70
+   |
+LL |     let depr_safe_generic_fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:386:70
+   |
+LL |     let depr_safe_generic_fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:388:80
+   |
+LL |     let mut depr_safe_generic_fnmut_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:388:80
+   |
+LL |     let mut depr_safe_generic_fnmut_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:390:78
+   |
+LL |     let depr_safe_generic_fnonce_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:390:78
+   |
+LL |     let depr_safe_generic_fnonce_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:394:60
+   |
+LL |     let depr_safe_generic_fn_ptr: fn(OsString, OsString) = depr_safe_generic;
+   |                                                            ^^^^^^^^^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:395:70
+   |
+LL |     let depr_safe_generic_fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:395:70
+   |
+LL |     let depr_safe_generic_fn_impl: Box<dyn Fn(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:397:80
+   |
+LL |     let mut depr_safe_generic_fnmut_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:397:80
+   |
+LL |     let mut depr_safe_generic_fnmut_impl: Box<dyn FnMut(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:399:78
+   |
+LL |     let depr_safe_generic_fnonce_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:399:78
+   |
+LL |     let depr_safe_generic_fnonce_impl: Box<dyn FnOnce(OsString, OsString)> = Box::new(depr_safe_generic);
+   |                                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:410:30
+   |
+LL |     fn_taking_fn_ptr_generic(depr_safe_generic);
+   |                              ^^^^^^^^^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:411:35
+   |
+LL |     fn_taking_dyn_fn_impl_generic(Box::new(depr_safe_generic));
+   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:411:35
+   |
+LL |     fn_taking_dyn_fn_impl_generic(Box::new(depr_safe_generic));
+   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:413:38
+   |
+LL |     fn_taking_dyn_fnmut_impl_generic(Box::new(depr_safe_generic));
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:413:38
+   |
+LL |     fn_taking_dyn_fnmut_impl_generic(Box::new(depr_safe_generic));
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:415:39
+   |
+LL |     fn_taking_dyn_fnonce_impl_generic(Box::new(depr_safe_generic));
+   |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:415:39
+   |
+LL |     fn_taking_dyn_fnonce_impl_generic(Box::new(depr_safe_generic));
+   |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:417:5
+   |
+LL |     fn_taking_fn_impl_generic(depr_safe_generic);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:418:5
+   |
+LL |     fn_taking_fnmut_impl_generic(depr_safe_generic);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:419:5
+   |
+LL |     fn_taking_fnonce_impl_generic(depr_safe_generic);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a normal fn pointer has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:422:30
+   |
+LL |     fn_taking_fn_ptr_generic(depr_safe_generic);
+   |                              ^^^^^^^^^^^^^^^^^ expected normal fn pointer, found unsafe fn pointer
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:423:35
+   |
+LL |     fn_taking_dyn_fn_impl_generic(Box::new(depr_safe_generic));
+   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:423:35
+   |
+LL |     fn_taking_dyn_fn_impl_generic(Box::new(depr_safe_generic));
+   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:425:38
+   |
+LL |     fn_taking_dyn_fnmut_impl_generic(Box::new(depr_safe_generic));
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:425:38
+   |
+LL |     fn_taking_dyn_fnmut_impl_generic(Box::new(depr_safe_generic));
+   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:427:39
+   |
+LL |     fn_taking_dyn_fnonce_impl_generic(Box::new(depr_safe_generic));
+   |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:427:39
+   |
+LL |     fn_taking_dyn_fnonce_impl_generic(Box::new(depr_safe_generic));
+   |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:429:5
+   |
+LL |     fn_taking_fn_impl_generic(depr_safe_generic);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:430:5
+   |
+LL |     fn_taking_fnmut_impl_generic(depr_safe_generic);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:431:5
+   |
+LL |     fn_taking_fnonce_impl_generic(depr_safe_generic);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:24:14
+   |
+LL | type Tait1 = impl FnOnce();
+   |              ^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:24:14
+   |
+LL | type Tait1 = impl FnOnce();
+   |              ^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:79:5
+   |
+LL |     depr_safe_params
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:79:5
+   |
+LL |     depr_safe_params
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:26:14
+   |
+LL | type Tait2 = impl FnOnce(u32, u64);
+   |              ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:26:14
+   |
+LL | type Tait2 = impl FnOnce(u32, u64);
+   |              ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:96:5
+   |
+LL |     depr_safe_generic
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:96:5
+   |
+LL |     depr_safe_generic
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:28:14
+   |
+LL | type Tait3 = impl FnOnce(OsString, OsString);
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:28:14
+   |
+LL | type Tait3 = impl FnOnce(OsString, OsString);
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:74:5
+   |
+LL |     depr_safe
+   |     ^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:74:5
+   |
+LL |     depr_safe
+   |     ^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:68:14
+   |
+LL | fn foo2() -> impl FnOnce() {
+   |              ^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:68:14
+   |
+LL | fn foo2() -> impl FnOnce() {
+   |              ^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:91:5
+   |
+LL |     depr_safe_params
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:91:5
+   |
+LL |     depr_safe_params
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:85:14
+   |
+LL | fn foo4() -> impl FnOnce(u32, u64) {
+   |              ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_params` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:85:14
+   |
+LL | fn foo4() -> impl FnOnce(u32, u64) {
+   |              ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:108:5
+   |
+LL |     depr_safe_generic
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:108:5
+   |
+LL |     depr_safe_generic
+   |     ^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:102:14
+   |
+LL | fn foo6() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` as a closure has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:102:14
+   |
+LL | fn foo6() -> impl FnOnce(OsString, OsString) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe.rs:194:5
+   |
+LL |     fn depr_safe_fn(&self) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_params` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe.rs:196:5
+   |
+LL |     fn depr_safe_params(&self, _: u32, _: u64) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_generic` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe.rs:198:5
+   |
+LL |     fn depr_safe_fn_generic<K: AsRef<OsStr>, V: AsRef<OsStr>>(&self, key: K, value: V) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_2018` without an `unsafe fn` declaration has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe.rs:206:5
+   |
+LL |     fn depr_safe_fn_2018(&self) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn` without an unsafe function or block has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe.rs:211:5
+   |
+LL |     good.depr_safe_fn();
+   |     ^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_params` without an unsafe function or block has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe.rs:212:5
+   |
+LL |     good.depr_safe_params(0, 0);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_generic` without an unsafe function or block has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe.rs:213:5
+   |
+LL |     good.depr_safe_fn_generic("", "");
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_2018` without an unsafe function or block has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe.rs:219:5
+   |
+LL |     good.depr_safe_fn_2018();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn` without an unsafe function or block has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe.rs:222:5
+   |
+LL |     bad.depr_safe_fn();
+   |     ^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_params` without an unsafe function or block has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe.rs:223:5
+   |
+LL |     bad.depr_safe_params(0, 0);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_generic` without an unsafe function or block has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe.rs:224:5
+   |
+LL |     bad.depr_safe_fn_generic("", "");
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of associated function `deprecated_safe::DeprSafeFns::depr_safe_fn_2018` without an unsafe function or block has been deprecated as it is now an unsafe associated function
+  --> $DIR/deprecated-safe.rs:230:5
+   |
+LL |     bad.depr_safe_fn_2018();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this associated function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the associated function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: unnecessary `unsafe` block
+  --> $DIR/deprecated-safe.rs:239:5
+   |
+LL |     unsafe {
+   |     ^^^^^^ unnecessary `unsafe` block
+   |
+note: the lint level is defined here
+  --> $DIR/deprecated-safe.rs:10:9
+   |
+LL | #![warn(unused_unsafe)]
+   |         ^^^^^^^^^^^^^
+
+warning: use of function `deprecated_safe::depr_safe` without an unsafe function or block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:282:5
+   |
+LL |     depr_safe();
+   |     ^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe` without an unsafe function or block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:283:5
+   |
+LL |     depr_safe();
+   |     ^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` without an unsafe function or block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:374:5
+   |
+LL |     depr_safe_generic("", "");
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: use of function `deprecated_safe::depr_safe_generic` without an unsafe function or block has been deprecated as it is now an unsafe function
+  --> $DIR/deprecated-safe.rs:375:5
+   |
+LL |     depr_safe_generic("", "");
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+   |
+   = note: this function was previously not marked unsafe, but has been marked unsafe since 1.61.0
+   = note: consult the function's documentation for information on how to avoid undefined behavior
+   = note: reason
+
+warning: 188 warnings emitted
+
diff --git a/src/test/ui/process/process-envs.rs b/src/test/ui/process/process-envs.rs
index 8fc99b23fd210..b210730e4eba2 100644
--- a/src/test/ui/process/process-envs.rs
+++ b/src/test/ui/process/process-envs.rs
@@ -29,7 +29,11 @@ fn main() {
     // save original environment
     let old_env = env::var_os("RUN_TEST_NEW_ENV");
 
-    env::set_var("RUN_TEST_NEW_ENV", "123");
+    // SAFETY: in main(), no other threads could be reading or writing the environment
+    #[cfg_attr(bootstrap, allow(unused_unsafe))]
+    unsafe {
+        env::set_var("RUN_TEST_NEW_ENV", "123");
+    }
 
     // create filtered environment vector
     let filtered_env : HashMap<String, String> =
@@ -40,9 +44,13 @@ fn main() {
     cmd.envs(&filtered_env);
 
     // restore original environment
-    match old_env {
-        None => env::remove_var("RUN_TEST_NEW_ENV"),
-        Some(val) => env::set_var("RUN_TEST_NEW_ENV", &val)
+    // SAFETY: in main(), no other threads could be reading or writing the environment
+    #[cfg_attr(bootstrap, allow(unused_unsafe))]
+    unsafe {
+        match old_env {
+            None => env::remove_var("RUN_TEST_NEW_ENV"),
+            Some(val) => env::set_var("RUN_TEST_NEW_ENV", &val)
+        }
     }
 
     let result = cmd.output().unwrap();
diff --git a/src/test/ui/process/process-remove-from-env.rs b/src/test/ui/process/process-remove-from-env.rs
index af4e49dfdbb5b..4d5a15983a87a 100644
--- a/src/test/ui/process/process-remove-from-env.rs
+++ b/src/test/ui/process/process-remove-from-env.rs
@@ -28,15 +28,23 @@ fn main() {
     // save original environment
     let old_env = env::var_os("RUN_TEST_NEW_ENV");
 
-    env::set_var("RUN_TEST_NEW_ENV", "123");
+    // SAFETY: in main(), no other threads could be reading or writing the environment
+    #[cfg_attr(bootstrap, allow(unused_unsafe))]
+    unsafe {
+        env::set_var("RUN_TEST_NEW_ENV", "123");
+    }
 
     let mut cmd = env_cmd();
     cmd.env_remove("RUN_TEST_NEW_ENV");
 
     // restore original environment
-    match old_env {
-        None => env::remove_var("RUN_TEST_NEW_ENV"),
-        Some(val) => env::set_var("RUN_TEST_NEW_ENV", &val)
+    // SAFETY: in main(), no other threads could be reading or writing the environment
+    #[cfg_attr(bootstrap, allow(unused_unsafe))]
+    unsafe {
+        match old_env {
+            None => env::remove_var("RUN_TEST_NEW_ENV"),
+            Some(val) => env::set_var("RUN_TEST_NEW_ENV", &val)
+        }
     }
 
     let result = cmd.output().unwrap();
diff --git a/src/test/ui/std-backtrace.rs b/src/test/ui/std-backtrace.rs
index b5e76666af1f8..d2480158075e9 100644
--- a/src/test/ui/std-backtrace.rs
+++ b/src/test/ui/std-backtrace.rs
@@ -19,12 +19,16 @@ fn main() {
     } else if args.len() >= 2 {
         println!("stack backtrace:\n{}", std::backtrace::Backtrace::capture());
     } else {
-        runtest(&args[0]);
+        // SAFETY: in main(), no other threads could be reading or writing the environment
+        unsafe {
+            runtest(&args[0]);
+        }
         println!("test ok");
     }
 }
 
-fn runtest(me: &str) {
+// SAFETY: must not be called when any other thread could be reading or writing the environment
+unsafe fn runtest(me: &str) {
     env::remove_var("RUST_BACKTRACE");
     env::remove_var("RUST_LIB_BACKTRACE");
 
diff --git a/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs b/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs
index 891531951c1a0..a9c3ac1d4596b 100644
--- a/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs
+++ b/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs
@@ -142,7 +142,7 @@ fn check_rvalue<'tcx>(
         },
         Rvalue::Cast(
             CastKind::Pointer(
-                PointerCast::UnsafeFnPointer | PointerCast::ClosureFnPointer(_) | PointerCast::ReifyFnPointer,
+                PointerCast::UnsafeFnPointer | PointerCast::DeprecatedSafeFnPointer | PointerCast::ClosureFnPointer(_) | PointerCast::ReifyFnPointer,
             ),
             _,
             _,
diff --git a/src/tools/clippy/tests/compile-test.rs b/src/tools/clippy/tests/compile-test.rs
index c9710e3db8e8d..163ddc7e62c2e 100644
--- a/src/tools/clippy/tests/compile-test.rs
+++ b/src/tools/clippy/tests/compile-test.rs
@@ -330,6 +330,8 @@ fn run_ui_cargo() {
 
 #[test]
 fn compile_test() {
+    // FIXME(skippy) there's no fix for deprecated_safe until tests can be run single threaded
+    #[cfg_attr(not(bootstrap), allow(deprecated_safe))]
     set_var("CLIPPY_DISABLE_DOCS_LINKS", "true");
     run_ui();
     run_ui_toml();
@@ -345,6 +347,10 @@ struct VarGuard {
 }
 
 impl VarGuard {
+    // FIXME(skippy) there's no fix for deprecated_safe until tests can be run single threaded
+    // FIXME(skippy) this function should become unsafe with the obligation that no other thread
+    //               could be reading or writing the environment
+    #[cfg_attr(not(bootstrap), allow(deprecated_safe))]
     fn set(key: &'static str, val: impl AsRef<OsStr>) -> Self {
         let value = var_os(key);
         set_var(key, val);
@@ -353,6 +359,10 @@ impl VarGuard {
 }
 
 impl Drop for VarGuard {
+    // FIXME(skippy) there's no fix for deprecated_safe until tests can be run single threaded
+    // FIXME(skippy) this function should become unsafe with the obligation that no other thread
+    //               could be reading or writing the environment
+    #[cfg_attr(not(bootstrap), allow(deprecated_safe))]
     fn drop(&mut self) {
         match self.value.as_deref() {
             None => remove_var(self.key),
diff --git a/src/tools/lint-docs/src/lib.rs b/src/tools/lint-docs/src/lib.rs
index fdc89a184da52..c841ed1b50cff 100644
--- a/src/tools/lint-docs/src/lib.rs
+++ b/src/tools/lint-docs/src/lib.rs
@@ -196,7 +196,7 @@ impl<'a> LintExtractor<'a> {
             };
             // These lints are specifically undocumented. This should be reserved
             // for internal rustc-lints only.
-            if name == "deprecated_in_future" {
+            if name == "deprecated_in_future" || name == "deprecated_safe_in_future" {
                 continue;
             }
             // Read the level.