Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 48caf81

Browse files
authored
Rollup merge of rust-lang#138084 - nnethercote:workspace-lints, r=jieyouxu
Use workspace lints for crates in `compiler/` This is nicer and hopefully less error prone than specifying lints via bootstrap. r? ``@jieyouxu``
2 parents c666287 + 8a3e033 commit 48caf81

File tree

144 files changed

+252
-90
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+252
-90
lines changed

Cargo.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,20 @@ exclude = [
6363
"src/tools/x",
6464
]
6565

66+
# These lints are applied to many crates in the workspace. In practice, this is
67+
# all crates under `compiler/`.
68+
#
69+
# NOTE: rustc-specific lints (e.g. `rustc::internal`) aren't supported by
70+
# Cargo. (Support for them is possibly blocked by #44690 (attributes for
71+
# tools).) Those lints are instead specified for `compiler/` crates in
72+
# `src/bootstrap/src/core/builder/cargo.rs`.
73+
[workspace.lints.rust]
74+
# FIXME(edition_2024): Change this to `-Wrust_2024_idioms` when all of the
75+
# individual lints are satisfied.
76+
keyword_idents_2024 = "warn"
77+
unreachable_pub = "warn"
78+
unsafe_op_in_unsafe_fn = "warn"
79+
6680
[profile.release.package.rustc-rayon-core]
6781
# The rustc fork of Rayon has deadlock detection code which intermittently
6882
# causes overflows in the CI (see https://github.com/rust-lang/rust/issues/90227)

compiler/rustc/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ llvm = ['rustc_driver_impl/llvm']
3232
max_level_info = ['rustc_driver_impl/max_level_info']
3333
rustc_randomized_layouts = ['rustc_driver_impl/rustc_randomized_layouts']
3434
# tidy-alphabetical-end
35+
36+
[lints]
37+
workspace = true

compiler/rustc_abi/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@ nightly = [
3131
]
3232
randomize = ["dep:rand", "dep:rand_xoshiro", "nightly"]
3333
# tidy-alphabetical-end
34+
35+
[lints]
36+
workspace = true

compiler/rustc_abi/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#![cfg_attr(feature = "nightly", feature(rustc_attrs))]
66
#![cfg_attr(feature = "nightly", feature(rustdoc_internals))]
77
#![cfg_attr(feature = "nightly", feature(step_trait))]
8-
#![warn(unreachable_pub)]
98
// tidy-alphabetical-end
109

1110
/*! ABI handling for rustc

compiler/rustc_arena/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ edition = "2024"
77
# tidy-alphabetical-start
88
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
99
# tidy-alphabetical-end
10+
11+
[lints]
12+
workspace = true

compiler/rustc_arena/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#![feature(maybe_uninit_slice)]
2424
#![feature(rustc_attrs)]
2525
#![feature(rustdoc_internals)]
26-
#![warn(unreachable_pub)]
2726
// tidy-alphabetical-end
2827

2928
use std::alloc::Layout;

compiler/rustc_ast/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
1818
thin-vec = "0.2.12"
1919
tracing = "0.1"
2020
# tidy-alphabetical-end
21+
22+
[lints]
23+
workspace = true

compiler/rustc_ast/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#![feature(never_type)]
2020
#![feature(rustdoc_internals)]
2121
#![feature(stmt_expr_attributes)]
22-
#![warn(unreachable_pub)]
2322
// tidy-alphabetical-end
2423

2524
pub mod util {

compiler/rustc_ast_ir/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ nightly = [
1919
"dep:rustc_macros",
2020
"dep:rustc_span",
2121
]
22+
23+
[lints]
24+
workspace = true

compiler/rustc_ast_ir/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#![cfg_attr(feature = "nightly", allow(internal_features))]
1010
#![cfg_attr(feature = "nightly", feature(never_type))]
1111
#![cfg_attr(feature = "nightly", feature(rustc_attrs))]
12-
#![warn(unreachable_pub)]
1312
// tidy-alphabetical-end
1413

1514
#[cfg(feature = "nightly")]

0 commit comments

Comments
 (0)