You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
profile.rustflags precedence with [lints] was unspecified. We have put made it a higher precedence.
rustflags derived from [lints] table are not included in rustc -C metadata hash.
[lints] should only apply to doctests as much as a diagnostic attributes (#[warn(...)]) in an .rs file applies to doctests
Per-target or per-target-kind (bin vs lib) [lints] tables is deferred (not in original RFC)
Workaround: using diagnostic attributes (e.g. #[warn] in the target)
This is helpful when production code (a subset of [lib], [bin]s in a workspace) want to be held to a higher standard than development code (especially tests)
e.g. clippy has an unwrap_used lint but people might want that in tests. clippy works around it today by having a allow-unwrap-in-tests setting
Since workspaces can have non-production libs and bins, it almost seems like this is more of user-defined lint settings groups and inheriting specific groups. Or put another way, more design work is needed.
Explicit inheritance doesn't work well when you want to catch lints for example packages but want the example package to standalone from the workspace (comment)
Future Extensions
No response
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Summary
RFC: #3389Area: [lints] table
Implementation: #12148, #12168, #12174, #12174
Documentation: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#lints
Issues: A-lints-table
This feature adds a
[lints]table toCargo.tomlto configure reporting levels for rustc and other tool lints.See also #3591, #5034
Testing instructions
Requires
betastableSteps:
[lints]table per the unstable reference-Dwarningsshould likely still be passed in explicitly so local experimentation doesn't get blocked on perfection-Adeprecationslikely should still do so since users should see deprecation warnings locally to decide whether to address them-ZlintsflagDebugging
--verboseto see what order[lints]and otherRUSTFLAGSare being passed to the underlying toolExample: #12178
Updates Since RFC
cargo newwill automatically inherit the lints table (Automatically inherit workspace lints when running cargo new/init #12174)profile.rustflagsprecedence with[lints]was unspecified. We have put made it a higher precedence.[lints]table are not included inrustc -C metadatahash.[lints]should only apply to doctests as much as a diagnostic attributes (#[warn(...)]) in an.rsfile applies to doctests[lints]tables is deferred (not in original RFC)#[warn]in the target)[lib],[bin]s in a workspace) want to be held to a higher standard than development code (especially tests)allow-unwrap-in-testssetting[lints]table RFC 3389 #12115 (comment) for ideas[lints]table toCargo.tomlrfcs#3389 (comment)Unresolved Issues
[lints]table toCargo.tomlrfcs#3389 (comment)[lints]table toCargo.tomlrfcs#3389 (comment)Feedback
Cases that don't work well:
missing_docsandmissing_debug_implementationsfor[lib]s (comment)disallowed_methodsin chore: dogfood Cargo-Zlintstable feature #12178Future Extensions
No response
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.