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

Report all lints, even if other errors already occurred. #633

Closed
1 of 3 tasks
oli-obk opened this issue May 11, 2023 · 7 comments
Closed
1 of 3 tasks

Report all lints, even if other errors already occurred. #633

oli-obk opened this issue May 11, 2023 · 7 comments
Labels
major-change A proposal to make a major change to rustc T-compiler Add this label so rfcbot knows to poll the compiler team

Comments

@oli-obk
Copy link
Contributor

oli-obk commented May 11, 2023

Proposal

Right now, if errors have occurred, we do not run our lints. This means that the user will see some errors, fix them, and once all of them are fixed, they will get new warnings and errors (the latter from deny lints).

If we always run lints, this reduces surprises of the "I fixed all the errors, now I'm getting new ones"-kind

This is already implemented: rust-lang/rust#108813

Mentors or Reviewers

Reviewable by any compiler team member or compiler contributor.

Process

The main points of the Major Change Process are as follows:

  • File an issue describing the proposal.
  • A compiler team member or contributor who is knowledgeable in the area can second by writing @rustbot second.
    • Finding a "second" suffices for internal changes. If however, you are proposing a new public-facing feature, such as a -C flag, then full team check-off is required.
    • Compiler team members can initiate a check-off via @rfcbot fcp merge on either the MCP or the PR.
  • Once an MCP is seconded, the Final Comment Period begins. If no objections are raised after 10 days, the MCP is considered approved.

You can read more about Major Change Proposals on forge.

Comments

This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.

@oli-obk oli-obk added T-compiler Add this label so rfcbot knows to poll the compiler team major-change A proposal to make a major change to rustc labels May 11, 2023
@rustbot
Copy link
Collaborator

rustbot commented May 11, 2023

This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.

cc @rust-lang/compiler @rust-lang/compiler-contributors

@rustbot rustbot added the to-announce Announce this issue on triage meeting label May 11, 2023
@tmiasko
Copy link

tmiasko commented May 11, 2023

@rustbot second

@rustbot rustbot added the final-comment-period The FCP has started, most (if not all) team members are in agreement label May 11, 2023
@pnkfelix
Copy link
Member

pnkfelix commented May 12, 2023

@rustbot concern errors-inherently-higher-prioirty

I'm worried about this change. Getting a wall of diagnostics can make it hard for users to tease out which things that they have to address to get their code to compile.

At the very least, are we going to offer a flag that lets someone opt back into the old behavior, for those of us who prefer it? (or is your thinking "if you want the old behavior, you can first compile with --cap-lints allow?)

@oli-obk
Copy link
Contributor Author

oli-obk commented May 16, 2023

(or is your thinking "if you want the old behavior, you can first compile with --cap-lints allow?)

well... -Awarnings, but yes.

I think we should improve diagnostics in other ways than having this hard and very arbitrary limit. Not all our lints are run in the generic lint machinery, but reported throughout the compilation. Those are already reported before the lints I enable here, so this PR just treats all lints equally.

I would expect we'll figure out how to

  • make most lints incremental (per item) instead of running all of them over the entire crate
  • avoid emitting lints for items that have errors (instead of what this PR does, avoid emitting lints if there were any errors (even other denied lints))

@jdahlstrom
Copy link

jdahlstrom commented Oct 27, 2023

For what it's worth, I strongly prefer only seeing errors as long as there are errors (but yes, denied lints should count as errors). There's time to fix warnings once the code compiles (first priority) and the program runs/tests pass (second priority).

@nikomatsakis
Copy link
Contributor

nikomatsakis commented Oct 28, 2023

I find it really depends on the lint. Unused imports? I (almost certainly, but not necessarily) don't want to see them. But lints that are (more frequently) tied to bugs? I often do. It's hard to predict. Often times I am editing one part of the code and deliberately ignoring errors in other parts.

I think anything that assumes people are going down the list of errors 1 by 1 is probably suspect, I tend to prefer a free-form approach, especially when I'm in an IDE.

@estebank
Copy link

We already have one-off logic in diagnostics to silence redundant errors. We would have to extend those kind of checks to lints as well. Because that kind of silencing requires hand checking we can indeed take these kind of considerations when doing that.

@oli-obk oli-obk closed this as completed Jan 3, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 16, 2024
… r=compiler-errors

Gracefully handle missing typeck information if typeck errored

fixes rust-lang#116893

I created some logs and the typeck of `fn main` is exactly the same, no matter whether the constant's body is what it is, or if it is replaced with `panic!()`. The latter will cause the ICE not to be emitted though. The reason for that is that we abort compilation if *errors* were emitted, but not if *lint errors* were emitted. This took me way too long to debug, and is another reason why I would have liked rust-lang/compiler-team#633
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 16, 2024
… r=compiler-errors

Gracefully handle missing typeck information if typeck errored

fixes rust-lang#116893

I created some logs and the typeck of `fn main` is exactly the same, no matter whether the constant's body is what it is, or if it is replaced with `panic!()`. The latter will cause the ICE not to be emitted though. The reason for that is that we abort compilation if *errors* were emitted, but not if *lint errors* were emitted. This took me way too long to debug, and is another reason why I would have liked rust-lang/compiler-team#633
compiler-errors added a commit to compiler-errors/rust that referenced this issue Jan 17, 2024
… r=compiler-errors

Gracefully handle missing typeck information if typeck errored

fixes rust-lang#116893

I created some logs and the typeck of `fn main` is exactly the same, no matter whether the constant's body is what it is, or if it is replaced with `panic!()`. The latter will cause the ICE not to be emitted though. The reason for that is that we abort compilation if *errors* were emitted, but not if *lint errors* were emitted. This took me way too long to debug, and is another reason why I would have liked rust-lang/compiler-team#633
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 17, 2024
… r=compiler-errors

Gracefully handle missing typeck information if typeck errored

fixes rust-lang#116893

I created some logs and the typeck of `fn main` is exactly the same, no matter whether the constant's body is what it is, or if it is replaced with `panic!()`. The latter will cause the ICE not to be emitted though. The reason for that is that we abort compilation if *errors* were emitted, but not if *lint errors* were emitted. This took me way too long to debug, and is another reason why I would have liked rust-lang/compiler-team#633
compiler-errors added a commit to compiler-errors/rust that referenced this issue Jan 17, 2024
… r=compiler-errors

Gracefully handle missing typeck information if typeck errored

fixes rust-lang#116893

I created some logs and the typeck of `fn main` is exactly the same, no matter whether the constant's body is what it is, or if it is replaced with `panic!()`. The latter will cause the ICE not to be emitted though. The reason for that is that we abort compilation if *errors* were emitted, but not if *lint errors* were emitted. This took me way too long to debug, and is another reason why I would have liked rust-lang/compiler-team#633
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 17, 2024
… r=compiler-errors

Gracefully handle missing typeck information if typeck errored

fixes rust-lang#116893

I created some logs and the typeck of `fn main` is exactly the same, no matter whether the constant's body is what it is, or if it is replaced with `panic!()`. The latter will cause the ICE not to be emitted though. The reason for that is that we abort compilation if *errors* were emitted, but not if *lint errors* were emitted. This took me way too long to debug, and is another reason why I would have liked rust-lang/compiler-team#633
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jan 18, 2024
Rollup merge of rust-lang#120020 - oli-obk:long_const_eval_err_taint, r=compiler-errors

Gracefully handle missing typeck information if typeck errored

fixes rust-lang#116893

I created some logs and the typeck of `fn main` is exactly the same, no matter whether the constant's body is what it is, or if it is replaced with `panic!()`. The latter will cause the ICE not to be emitted though. The reason for that is that we abort compilation if *errors* were emitted, but not if *lint errors* were emitted. This took me way too long to debug, and is another reason why I would have liked rust-lang/compiler-team#633
@apiraino apiraino removed the final-comment-period The FCP has started, most (if not all) team members are in agreement label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major-change A proposal to make a major change to rustc T-compiler Add this label so rfcbot knows to poll the compiler team
Projects
None yet
Development

No branches or pull requests

8 participants