Skip to content

Commit 063ef18

Browse files
committed
Revert "Use workspace lints for crates in compiler/ #138084"
Revert <#138084> to buy time to consider options that avoids breaking downstream usages of cargo on distributed `rustc-src` artifacts, where such cargo invocations fail due to inability to inherit `lints` from workspace root manifest's `workspace.lints` (this is only valid for the source rust-lang/rust workspace, but not really the distributed `rustc-src` artifacts). This breakage was reported in <#138304>. This reverts commit 48caf81, reversing changes made to c666287.
1 parent 2c6a12e commit 063ef18

File tree

144 files changed

+90
-252
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

+90
-252
lines changed

Cargo.toml

-14
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,6 @@ 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-
8066
[profile.release.package.rustc-rayon-core]
8167
# The rustc fork of Rayon has deadlock detection code which intermittently
8268
# causes overflows in the CI (see https://github.com/rust-lang/rust/issues/90227)

compiler/rustc/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,3 @@ 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

-3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,3 @@ 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

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
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)]
89
// tidy-alphabetical-end
910

1011
/*! ABI handling for rustc

compiler/rustc_arena/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,3 @@ 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

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#![feature(maybe_uninit_slice)]
2424
#![feature(rustc_attrs)]
2525
#![feature(rustdoc_internals)]
26+
#![warn(unreachable_pub)]
2627
// tidy-alphabetical-end
2728

2829
use std::alloc::Layout;

compiler/rustc_ast/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,3 @@ 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

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#![feature(never_type)]
2020
#![feature(rustdoc_internals)]
2121
#![feature(stmt_expr_attributes)]
22+
#![warn(unreachable_pub)]
2223
// tidy-alphabetical-end
2324

2425
pub mod util {

compiler/rustc_ast_ir/Cargo.toml

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

compiler/rustc_ast_ir/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
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)]
1213
// tidy-alphabetical-end
1314

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

compiler/rustc_ast_lowering/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,3 @@ smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
2828
thin-vec = "0.2.12"
2929
tracing = "0.1"
3030
# tidy-alphabetical-end
31-
32-
[lints]
33-
workspace = true

compiler/rustc_ast_lowering/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#![feature(if_let_guard)]
3939
#![feature(let_chains)]
4040
#![feature(rustdoc_internals)]
41+
#![warn(unreachable_pub)]
4142
// tidy-alphabetical-end
4243

4344
use std::sync::Arc;

compiler/rustc_ast_passes/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,3 @@ rustc_session = { path = "../rustc_session" }
2020
rustc_span = { path = "../rustc_span" }
2121
thin-vec = "0.2.12"
2222
# tidy-alphabetical-end
23-
24-
[lints]
25-
workspace = true

compiler/rustc_ast_passes/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#![feature(iter_is_partitioned)]
1111
#![feature(let_chains)]
1212
#![feature(rustdoc_internals)]
13+
#![warn(unreachable_pub)]
1314
// tidy-alphabetical-end
1415

1516
pub mod ast_validation;

compiler/rustc_ast_pretty/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,3 @@ rustc_lexer = { path = "../rustc_lexer" }
1212
rustc_span = { path = "../rustc_span" }
1313
thin-vec = "0.2.12"
1414
# tidy-alphabetical-end
15-
16-
[lints]
17-
workspace = true

compiler/rustc_ast_pretty/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#![doc(rust_logo)]
44
#![feature(box_patterns)]
55
#![feature(rustdoc_internals)]
6+
#![warn(unreachable_pub)]
67
// tidy-alphabetical-end
78

89
mod helpers;

compiler/rustc_attr_data_structures/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,3 @@ rustc_serialize = {path = "../rustc_serialize"}
1414
rustc_span = {path = "../rustc_span"}
1515
thin-vec = "0.2.12"
1616
# tidy-alphabetical-end
17-
18-
[lints]
19-
workspace = true

compiler/rustc_attr_data_structures/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#![doc(rust_logo)]
44
#![feature(let_chains)]
55
#![feature(rustdoc_internals)]
6+
#![warn(unreachable_pub)]
67
// tidy-alphabetical-end
78

89
mod attributes;

compiler/rustc_attr_parsing/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,3 @@ rustc_session = { path = "../rustc_session" }
2222
rustc_span = { path = "../rustc_span" }
2323
thin-vec = "0.2.12"
2424
# tidy-alphabetical-end
25-
26-
[lints]
27-
workspace = true

compiler/rustc_attr_parsing/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
#![doc(rust_logo)]
8181
#![feature(let_chains)]
8282
#![feature(rustdoc_internals)]
83+
#![warn(unreachable_pub)]
8384
// tidy-alphabetical-end
8485

8586
#[macro_use]

compiler/rustc_baked_icu_data/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,3 @@ icu_locid_transform = "1.3.2"
1111
icu_provider = { version = "1.2", features = ["sync"] }
1212
zerovec = "0.10.0"
1313
# tidy-alphabetical-end
14-
15-
[lints]
16-
workspace = true

compiler/rustc_baked_icu_data/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
// tidy-alphabetical-start
2424
#![allow(elided_lifetimes_in_paths)]
2525
#![allow(internal_features)]
26-
#![allow(unreachable_pub)] // because this crate is mostly generated code
2726
#![doc(rust_logo)]
2827
#![feature(rustdoc_internals)]
28+
// #![warn(unreachable_pub)] // don't use because this crate is mostly generated code
2929
// tidy-alphabetical-end
3030

3131
mod data {

compiler/rustc_borrowck/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,3 @@ rustc_traits = { path = "../rustc_traits" }
2727
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
2828
tracing = "0.1"
2929
# tidy-alphabetical-end
30-
31-
[lints]
32-
workspace = true

compiler/rustc_borrowck/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#![feature(rustdoc_internals)]
1414
#![feature(stmt_expr_attributes)]
1515
#![feature(try_blocks)]
16+
#![warn(unreachable_pub)]
1617
// tidy-alphabetical-end
1718

1819
use std::borrow::Cow;

compiler/rustc_builtin_macros/Cargo.toml

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ name = "rustc_builtin_macros"
33
version = "0.0.0"
44
edition = "2024"
55

6+
7+
[lints.rust]
8+
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(llvm_enzyme)'] }
9+
610
[lib]
711
doctest = false
812

@@ -30,6 +34,3 @@ smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
3034
thin-vec = "0.2.12"
3135
tracing = "0.1"
3236
# tidy-alphabetical-end
33-
34-
[lints]
35-
workspace = true

compiler/rustc_builtin_macros/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#![feature(rustdoc_internals)]
1919
#![feature(string_from_utf8_lossy_owned)]
2020
#![feature(try_blocks)]
21+
#![warn(unreachable_pub)]
2122
// tidy-alphabetical-end
2223

2324
extern crate proc_macro;

compiler/rustc_codegen_llvm/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,3 @@ serde_json = "1"
4343
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
4444
tracing = "0.1"
4545
# tidy-alphabetical-end
46-
47-
[lints]
48-
workspace = true

compiler/rustc_codegen_llvm/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#![feature(rustdoc_internals)]
2020
#![feature(slice_as_array)]
2121
#![feature(try_blocks)]
22+
#![warn(unreachable_pub)]
2223
// tidy-alphabetical-end
2324

2425
use std::any::Any;

compiler/rustc_codegen_ssa/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,3 @@ features = ["read_core", "elf", "macho", "pe", "xcoff", "unaligned", "archive",
6363
[target.'cfg(windows)'.dependencies.windows]
6464
version = "0.59.0"
6565
features = ["Win32_Globalization"]
66-
67-
[lints]
68-
workspace = true

compiler/rustc_codegen_ssa/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#![feature(rustdoc_internals)]
1515
#![feature(trait_alias)]
1616
#![feature(try_blocks)]
17+
#![warn(unreachable_pub)]
1718
// tidy-alphabetical-end
1819

1920
//! This crate contains codegen code that is used by all codegen backends (LLVM and others).

compiler/rustc_const_eval/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,3 @@ rustc_trait_selection = { path = "../rustc_trait_selection" }
2626
rustc_type_ir = { path = "../rustc_type_ir" }
2727
tracing = "0.1"
2828
# tidy-alphabetical-end
29-
30-
[lints]
31-
workspace = true

compiler/rustc_const_eval/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#![feature(unqualified_local_imports)]
1717
#![feature(yeet_expr)]
1818
#![warn(unqualified_local_imports)]
19+
#![warn(unreachable_pub)]
1920
// tidy-alphabetical-end
2021

2122
pub mod check_consts;

compiler/rustc_data_structures/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,3 @@ memmap2 = "0.2.1"
5454

5555
[target.'cfg(not(target_has_atomic = "64"))'.dependencies]
5656
portable-atomic = "1.5.1"
57-
58-
[lints]
59-
workspace = true

compiler/rustc_data_structures/src/graph/tests.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ use std::cmp::max;
33
use super::*;
44
use crate::fx::FxHashMap;
55

6-
pub(super) struct TestGraph {
6+
pub struct TestGraph {
77
num_nodes: usize,
88
start_node: usize,
99
successors: FxHashMap<usize, Vec<usize>>,
1010
predecessors: FxHashMap<usize, Vec<usize>>,
1111
}
1212

1313
impl TestGraph {
14-
pub(super) fn new(start_node: usize, edges: &[(usize, usize)]) -> Self {
14+
pub fn new(start_node: usize, edges: &[(usize, usize)]) -> Self {
1515
let mut graph = TestGraph {
1616
num_nodes: start_node + 1,
1717
start_node,

compiler/rustc_data_structures/src/obligation_forest/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ pub struct Error<O, E> {
313313

314314
mod helper {
315315
use super::*;
316-
pub(super) type ObligationTreeIdGenerator = impl Iterator<Item = ObligationTreeId>;
316+
pub type ObligationTreeIdGenerator = impl Iterator<Item = ObligationTreeId>;
317317
impl<O: ForestObligation> ObligationForest<O> {
318318
pub fn new() -> ObligationForest<O> {
319319
ObligationForest {

compiler/rustc_data_structures/src/sync.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ mod mode {
8888

8989
// Whether thread safety might be enabled.
9090
#[inline]
91-
pub(super) fn might_be_dyn_thread_safe() -> bool {
91+
pub fn might_be_dyn_thread_safe() -> bool {
9292
DYN_THREAD_SAFE_MODE.load(Ordering::Relaxed) != DYN_NOT_THREAD_SAFE
9393
}
9494

compiler/rustc_data_structures/src/sync/parallel.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub fn parallel_guard<R>(f: impl FnOnce(&ParallelGuard) -> R) -> R {
4646
ret
4747
}
4848

49-
fn serial_join<A, B, RA, RB>(oper_a: A, oper_b: B) -> (RA, RB)
49+
pub fn serial_join<A, B, RA, RB>(oper_a: A, oper_b: B) -> (RA, RB)
5050
where
5151
A: FnOnce() -> RA,
5252
B: FnOnce() -> RB,

compiler/rustc_data_structures/src/tagged_ptr/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::stable_hasher::{HashStable, StableHasher};
77

88
/// A tag type used in [`TaggedRef`] tests.
99
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
10-
enum Tag2 {
10+
pub enum Tag2 {
1111
B00 = 0b00,
1212
B01 = 0b01,
1313
B10 = 0b10,

compiler/rustc_driver/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,3 @@ crate-type = ["dylib"]
1010
# tidy-alphabetical-start
1111
rustc_driver_impl = { path = "../rustc_driver_impl" }
1212
# tidy-alphabetical-end
13-
14-
[lints]
15-
workspace = true

compiler/rustc_driver_impl/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,3 @@ rustc_randomized_layouts = [
7979
'rustc_middle/rustc_randomized_layouts'
8080
]
8181
# tidy-alphabetical-end
82-
83-
[lints]
84-
workspace = true

compiler/rustc_driver_impl/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#![feature(result_flattening)]
1717
#![feature(rustdoc_internals)]
1818
#![feature(try_blocks)]
19+
#![warn(unreachable_pub)]
1920
// tidy-alphabetical-end
2021

2122
use std::cmp::max;

compiler/rustc_error_codes/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,3 @@ edition = "2024"
66
[dependencies]
77
# tidy-alphabetical-start
88
# tidy-alphabetical-end
9-
10-
[lints]
11-
workspace = true

compiler/rustc_error_codes/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#![deny(rustdoc::invalid_codeblock_attributes)]
77
#![doc(rust_logo)]
88
#![feature(rustdoc_internals)]
9+
#![warn(unreachable_pub)]
910
// tidy-alphabetical-end
1011

1112
// This higher-order macro defines the error codes that are in use. It is used

compiler/rustc_error_messages/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,3 @@ rustc_span = { path = "../rustc_span" }
1919
tracing = "0.1"
2020
unic-langid = { version = "0.9.0", features = ["macros"] }
2121
# tidy-alphabetical-end
22-
23-
[lints]
24-
workspace = true

compiler/rustc_error_messages/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#![feature(rustc_attrs)]
55
#![feature(rustdoc_internals)]
66
#![feature(type_alias_impl_trait)]
7+
#![warn(unreachable_pub)]
78
// tidy-alphabetical-end
89

910
use std::borrow::Cow;

compiler/rustc_errors/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,3 @@ features = [
3939
"Win32_Security",
4040
"Win32_System_Threading",
4141
]
42-
43-
[lints]
44-
workspace = true

compiler/rustc_errors/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#![feature(trait_alias)]
2626
#![feature(try_blocks)]
2727
#![feature(yeet_expr)]
28+
#![warn(unreachable_pub)]
2829
// tidy-alphabetical-end
2930

3031
extern crate self as rustc_errors;

0 commit comments

Comments
 (0)