Add rationale for `rustc_lint` behind allowing rustc::potential-query-instability lint
Open
Nobody has claimed this yet.
C-cleanup
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Context: https://github.com/rust-lang/rust/issues/84447
Motivation:
- This lint asks to do so. An example:
error: using `values` can result in unstable query results --> compiler/rustc_query_system/src/dep_graph/serialized.rs:654:50 | 654 | let mut stats: Vec<_> = record_stats.values().collect(); | ^^^^^^ | = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale - This would prevent further fix attempts so wastes of time as well.
- Nearly all of those allowances has a comment which explains the rationale.
To do: Add a comment explaning the rationale behind allowing rustc::potential-query-instability lint for this occurrence in the file compiler/rustc_lint/src/context/diagnostics/check_cfg.rs:
pub(super) fn unexpected_cfg_name(
sess: &Session,
(name, name_span): (Symbol, Span),
value: Option<(Symbol, Span)>,
) -> lints::UnexpectedCfgName {
#[allow(rustc::potential_query_instability)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
let possibilities: Vec<Symbol> = sess.psess.check_config.expecteds.keys().copied().collect();
let mut names_possibilities: Vec<_> = if value.is_none() {
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open compiler/rustc_lint/src/context/diagnostics/check_cfg.rs and inspect unexpected_cfg_name, especially the allow(rustc::potential_query_instability) attribute. Compare nearby allowances and the linked context issue to understand the rationale style. Done means the allowance has an explanatory comment without changing the lint behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100