Skip to content

Commit 7b522f8

Browse files
authored
Unrolled build for rust-lang#125990
Rollup merge of rust-lang#125990 - tbu-:pr_unsafe_env_lint_name, r=ehuss Rename `deprecated_safe` lint to `deprecated_safe_2024` Create a lint group `deprecated_safe` that includes `deprecated_safe_2024`. Addresses rust-lang#124866 (comment). r? `@ehuss`
2 parents 20f23ab + bf96c56 commit 7b522f8

File tree

7 files changed

+15
-12
lines changed

7 files changed

+15
-12
lines changed

compiler/rustc_lint/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,8 @@ fn register_builtins(store: &mut LintStore) {
322322
REFINING_IMPL_TRAIT_INTERNAL
323323
);
324324

325+
add_lint_group!("deprecated_safe", DEPRECATED_SAFE_2024);
326+
325327
// Register renamed and removed lints.
326328
store.register_renamed("single_use_lifetime", "single_use_lifetimes");
327329
store.register_renamed("elided_lifetime_in_path", "elided_lifetimes_in_paths");

compiler/rustc_lint_defs/src/builtin.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ declare_lint_pass! {
3737
DEPRECATED,
3838
DEPRECATED_CFG_ATTR_CRATE_TYPE_NAME,
3939
DEPRECATED_IN_FUTURE,
40-
DEPRECATED_SAFE,
40+
DEPRECATED_SAFE_2024,
4141
DEPRECATED_WHERE_CLAUSE_LOCATION,
4242
DUPLICATE_MACRO_ATTRIBUTES,
4343
ELIDED_LIFETIMES_IN_ASSOCIATED_CONSTANT,
@@ -4812,8 +4812,8 @@ declare_lint! {
48124812
}
48134813

48144814
declare_lint! {
4815-
/// The `deprecated_safe` lint detects unsafe functions being used as safe
4816-
/// functions.
4815+
/// The `deprecated_safe_2024` lint detects unsafe functions being used as
4816+
/// safe functions.
48174817
///
48184818
/// ### Example
48194819
///
@@ -4832,8 +4832,8 @@ declare_lint! {
48324832
///
48334833
/// Rust [editions] allow the language to evolve without breaking backward
48344834
/// compatibility. This lint catches code that uses `unsafe` functions that
4835-
/// were declared as safe (non-`unsafe`) in earlier editions. If you switch
4836-
/// the compiler to a new edition without updating the code, then it
4835+
/// were declared as safe (non-`unsafe`) in editions prior to Rust 2024. If
4836+
/// you switch the compiler to Rust 2024 without updating the code, then it
48374837
/// will fail to compile if you are using a function previously marked as
48384838
/// safe.
48394839
///
@@ -4850,7 +4850,7 @@ declare_lint! {
48504850
/// future.
48514851
///
48524852
/// [editions]: https://doc.rust-lang.org/edition-guide/
4853-
pub DEPRECATED_SAFE,
4853+
pub DEPRECATED_SAFE_2024,
48544854
Allow,
48554855
"detects unsafe functions being used as safe functions",
48564856
@future_incompatible = FutureIncompatibleInfo {

compiler/rustc_mir_build/src/check_unsafety.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc_middle::thir::visit::Visitor;
1010
use rustc_middle::thir::*;
1111
use rustc_middle::ty::print::with_no_trimmed_paths;
1212
use rustc_middle::ty::{self, ParamEnv, Ty, TyCtxt};
13-
use rustc_session::lint::builtin::{DEPRECATED_SAFE, UNSAFE_OP_IN_UNSAFE_FN, UNUSED_UNSAFE};
13+
use rustc_session::lint::builtin::{DEPRECATED_SAFE_2024, UNSAFE_OP_IN_UNSAFE_FN, UNUSED_UNSAFE};
1414
use rustc_session::lint::Level;
1515
use rustc_span::def_id::{DefId, LocalDefId};
1616
use rustc_span::symbol::Symbol;
@@ -99,7 +99,7 @@ impl<'tcx> UnsafetyVisitor<'_, 'tcx> {
9999
{
100100
let sm = self.tcx.sess.source_map();
101101
self.tcx.emit_node_span_lint(
102-
DEPRECATED_SAFE,
102+
DEPRECATED_SAFE_2024,
103103
self.hir_context,
104104
span,
105105
CallToDeprecatedSafeFnRequiresUnsafe {

src/tools/lint-docs/src/groups.rs

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ static GROUP_DESCRIPTIONS: &[(&str, &str)] = &[
2424
"keyword-idents",
2525
"Lints that detect identifiers which will be come keywords in later editions",
2626
),
27+
("deprecated-safe", "Lints for functions which were erroneously marked as safe in the past"),
2728
];
2829

2930
type LintGroups = BTreeMap<String, BTreeSet<String>>;

tests/ui/rust-2024/unsafe-env-suggestion.fixed

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ run-rustfix
22

3-
#![deny(deprecated_safe)]
3+
#![deny(deprecated_safe_2024)]
44

55
use std::env;
66

tests/ui/rust-2024/unsafe-env-suggestion.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ run-rustfix
22

3-
#![deny(deprecated_safe)]
3+
#![deny(deprecated_safe_2024)]
44

55
use std::env;
66

tests/ui/rust-2024/unsafe-env-suggestion.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ LL | env::set_var("FOO", "BAR");
99
note: the lint level is defined here
1010
--> $DIR/unsafe-env-suggestion.rs:3:9
1111
|
12-
LL | #![deny(deprecated_safe)]
13-
| ^^^^^^^^^^^^^^^
12+
LL | #![deny(deprecated_safe_2024)]
13+
| ^^^^^^^^^^^^^^^^^^^^
1414
help: you can wrap the call in an `unsafe` block if you can guarantee the code is only ever called from single-threaded code
1515
|
1616
LL + // TODO: Audit that the environment access only happens in single-threaded code.

0 commit comments

Comments
 (0)