Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rationale for rustc_type_ir behind allowing rustc::potential-query-instability lint #131318

Open
ismailarilik opened this issue Oct 6, 2024 · 4 comments
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@ismailarilik
Copy link
Contributor

ismailarilik commented Oct 6, 2024

Context: #84447

Motivation:

  1. 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
  2. This would prevent further fix attempts so wastes of time as well.
  3. 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 all occurrences in the file compiler/rustc_type_ir/src/search_graph/mod.rs. You can find the places where this lint is triggered by searching with #[allow(rustc::potential_query_instability)] in this file.

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 6, 2024
@ismailarilik
Copy link
Contributor Author

@rustbot label C-cleanup T-compiler

@rustbot rustbot added C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 6, 2024
@compiler-errors
Copy link
Member

It would be nice if you actually linked the specific callsites where this lint is triggering in the crate.

@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 19, 2024
@ismailarilik
Copy link
Contributor Author

I was just thinking that how that kind of allow statement looks like:

#[allow(rustc::potential_query_instability, "Order does not matter here.")]

I wished it to exist when I searched for these allow statements again and saw that a new statement is added without any reasoning. Of course, I've just ignored it because it is obvious that someone put it there for a reason.

But no one can ensure that this person didn't miss anything. So a reasoning would always be helpful. So this proposition may be a way to enforce to put a reasoning before allowing a lint.

For now, I am just putting this here. If you don't think I am crazy, I will open an issue and propose this.

@ismailarilik
Copy link
Contributor Author

I was just thinking that how that kind of allow statement looks like:

#[allow(rustc::potential_query_instability, "Order does not matter here.")]

Oh, I wasn't the one who thinks this first: https://rust-lang.github.io/rfcs/2383-lint-reasons.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants