-
Couldn't load subscription status.
- Fork 2.7k
Open
Labels
A-lints-tableArea: [lints] tableArea: [lints] tableA-rustflagsArea: rustflagsArea: rustflagsC-bugCategory: bugCategory: bugS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Description
Problem
The current implementation of -Zlints is just a transform from [lints] table to a series of rustc lint flags. When a lint error/warning is emitted, rustc report as if the lint rule were requested on the command line:
Compiling bad-zlints-error v0.1.0 (/users/weihanglo/bad-zlints-error)
error: unknown lint: `new_lint`
--> src/lib.rs:1:9
|
1 | #[allow(new_lint)]
| ^^^^^^^^
|
= note: requested on the command line with `-D unknown-lints`
error: could not compile `bad-zlints-error` (lib) due to previous errorSteps
# Cargo.toml
[package]
name = "bad-zlints-error"
version = "0.1.0"
edition = "2021"
[lints.rust]
unknown_lints = "deny"// src/lib.rs
#[allow(new_lint)]And run cargo +nightly c -Zlints
Possible Solution(s)
Cargo hints rustc that these lint args are from [lints] table. However, this solution has some difficulties:
- Rustc should know nothing about Cargo.
- Even within Cargo, lint args may come from a variety of sources, for example,
build.rustflagsconfig,RUSTFLAGS, orcargo rustc -- <args>.
Notes
This is a known issue around rustflags in Cargo and shouldn't be a blocker for stabilization.
Version
cargo 1.73.0-nightly (7c3904d6c 2023-08-14)
release: 1.73.0-nightly
commit-hash: 7c3904d6c3ed54e8a413023519b55a536ad44d5b
commit-date: 2023-08-14
kornelski
Metadata
Metadata
Assignees
Labels
A-lints-tableArea: [lints] tableArea: [lints] tableA-rustflagsArea: rustflagsArea: rustflagsC-bugCategory: bugCategory: bugS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.