Specify rust lints for compiler/
crates via Cargo.
By naming them in `[workspace.lints.rust]` in the top-level `Cargo.toml`, and then making all `compiler/` crates inherit them with `[lints] workspace = true`. (I omitted `rustc_codegen_{cranelift,gcc}`, because they're a bit different.) The advantages of this over the current approach: - It uses a standard Cargo feature, rather than special handling in bootstrap. So, easier to understand, and less likely to get accidentally broken in the future. - It works for proc macro crates. It's a shame it doesn't work for rustc-specific lints, as the comments explain.
This commit is contained in:
parent
a8eeb4b53b
commit
beba32cebb
74 changed files with 237 additions and 4 deletions
13
Cargo.toml
13
Cargo.toml
|
@ -63,6 +63,19 @@ exclude = [
|
|||
"src/tools/x",
|
||||
]
|
||||
|
||||
# These lints are applied to many crates in the workspace. In practice, this is
|
||||
# all crates under `compiler/`.
|
||||
#
|
||||
# NOTE: rustc-specific lints (e.g. `rustc::internal`) aren't supported by
|
||||
# Cargo. (Support for them is possibly blocked by #44690 (attributes for
|
||||
# tools).) Those lints are instead specified for `compiler/` crates in
|
||||
# `src/bootstrap/src/core/builder/cargo.rs`.
|
||||
[workspace.lints.rust]
|
||||
# FIXME(edition_2024): Change this to `-Wrust_2024_idioms` when all of the
|
||||
# individual lints are satisfied.
|
||||
keyword_idents_2024 = "warn"
|
||||
unsafe_op_in_unsafe_fn = "warn"
|
||||
|
||||
[profile.release.package.rustc-rayon-core]
|
||||
# The rustc fork of Rayon has deadlock detection code which intermittently
|
||||
# causes overflows in the CI (see https://github.com/rust-lang/rust/issues/90227)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue