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:
Nicholas Nethercote 2025-03-06 11:53:30 +11:00
parent a8eeb4b53b
commit beba32cebb
74 changed files with 237 additions and 4 deletions

View file

@ -63,3 +63,6 @@ features = ["read_core", "elf", "macho", "pe", "xcoff", "unaligned", "archive",
[target.'cfg(windows)'.dependencies.windows]
version = "0.59.0"
features = ["Win32_Globalization"]
[lints]
workspace = true