diff options
| author | Tobias Bucher <tobiasbucher5991@gmail.com> | 2024-06-04 21:36:29 +0200 |
|---|---|---|
| committer | Tobias Bucher <tobiasbucher5991@gmail.com> | 2024-07-17 14:39:56 +0200 |
| commit | bf96c56e840971e931e2e11329b8d7b32ac2eab9 (patch) | |
| tree | 70d2f3980cf2cd64619914afd96354ed4df9a5c0 /compiler | |
| parent | cb12b52f160c633551bd6e5be8d4c6e2e8660950 (diff) | |
Rename `deprecated_safe` lint to `deprecated_safe_2024`
Create a lint group `deprecated_safe` that includes `deprecated_safe_2024`. Addresses https://github.com/rust-lang/rust/issues/124866#issuecomment-2142814375.
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_lint/src/lib.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_lint_defs/src/builtin.rs | 12 | ||||
| -rw-r--r-- | compiler/rustc_mir_build/src/check_unsafety.rs | 4 |
3 files changed, 10 insertions, 8 deletions
diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs index 4e83ef0c629..7040775e755 100644 --- a/compiler/rustc_lint/src/lib.rs +++ b/compiler/rustc_lint/src/lib.rs @@ -322,6 +322,8 @@ fn register_builtins(store: &mut LintStore) { REFINING_IMPL_TRAIT_INTERNAL ); + add_lint_group!("deprecated_safe", DEPRECATED_SAFE_2024); + // Register renamed and removed lints. store.register_renamed("single_use_lifetime", "single_use_lifetimes"); store.register_renamed("elided_lifetime_in_path", "elided_lifetimes_in_paths"); diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index aa7844f4012..d8fcbd836d2 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -37,7 +37,7 @@ declare_lint_pass! { DEPRECATED, DEPRECATED_CFG_ATTR_CRATE_TYPE_NAME, DEPRECATED_IN_FUTURE, - DEPRECATED_SAFE, + DEPRECATED_SAFE_2024, DEPRECATED_WHERE_CLAUSE_LOCATION, DUPLICATE_MACRO_ATTRIBUTES, ELIDED_LIFETIMES_IN_ASSOCIATED_CONSTANT, @@ -4812,8 +4812,8 @@ declare_lint! { } declare_lint! { - /// The `deprecated_safe` lint detects unsafe functions being used as safe - /// functions. + /// The `deprecated_safe_2024` lint detects unsafe functions being used as + /// safe functions. /// /// ### Example /// @@ -4832,8 +4832,8 @@ declare_lint! { /// /// Rust [editions] allow the language to evolve without breaking backward /// compatibility. This lint catches code that uses `unsafe` functions that - /// were declared as safe (non-`unsafe`) in earlier editions. If you switch - /// the compiler to a new edition without updating the code, then it + /// were declared as safe (non-`unsafe`) in editions prior to Rust 2024. If + /// you switch the compiler to Rust 2024 without updating the code, then it /// will fail to compile if you are using a function previously marked as /// safe. /// @@ -4850,7 +4850,7 @@ declare_lint! { /// future. /// /// [editions]: https://doc.rust-lang.org/edition-guide/ - pub DEPRECATED_SAFE, + pub DEPRECATED_SAFE_2024, Allow, "detects unsafe functions being used as safe functions", @future_incompatible = FutureIncompatibleInfo { diff --git a/compiler/rustc_mir_build/src/check_unsafety.rs b/compiler/rustc_mir_build/src/check_unsafety.rs index a65586ccdb7..bff4d6af4aa 100644 --- a/compiler/rustc_mir_build/src/check_unsafety.rs +++ b/compiler/rustc_mir_build/src/check_unsafety.rs @@ -10,7 +10,7 @@ use rustc_middle::thir::visit::Visitor; use rustc_middle::thir::*; use rustc_middle::ty::print::with_no_trimmed_paths; use rustc_middle::ty::{self, ParamEnv, Ty, TyCtxt}; -use rustc_session::lint::builtin::{DEPRECATED_SAFE, UNSAFE_OP_IN_UNSAFE_FN, UNUSED_UNSAFE}; +use rustc_session::lint::builtin::{DEPRECATED_SAFE_2024, UNSAFE_OP_IN_UNSAFE_FN, UNUSED_UNSAFE}; use rustc_session::lint::Level; use rustc_span::def_id::{DefId, LocalDefId}; use rustc_span::symbol::Symbol; @@ -99,7 +99,7 @@ impl<'tcx> UnsafetyVisitor<'_, 'tcx> { { let sm = self.tcx.sess.source_map(); self.tcx.emit_node_span_lint( - DEPRECATED_SAFE, + DEPRECATED_SAFE_2024, self.hir_context, span, CallToDeprecatedSafeFnRequiresUnsafe { |
