-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Some cleanups around diagnostic levels. #120520
Conversation
cc @davidtwco, @compiler-errors, @TaKO8Ki Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri |
This comment has been minimized.
This comment has been minimized.
56cd3d2
to
32803e1
Compare
I find "weak bug" to still be quite confusing as a name. This is after all called in places where there is no bug - just some expensive computation that we should only do when the user actually sees the result.
I would suggest a name that involves "require diagnostic" or "assert diagnostic" or so. That more directly expresses what is actually being checked.
|
I used "weak" because it's a weaker form of Also, I really want to eliminate |
Yeah I saw that argument in your commit message. I don't agree though, this does not at all feel like a "weak version of "good_path_bug" is nothing at all like that, so making the name similar is misleading IMO. |
I interpret the |
For For good-path-bug, I don't think it makes sense to think of this as "if this line is ever reached, there was a bug". So the naming in this PR creates a false analogy. If we look at how these two are used, I don't think they are as similar as you claim. They are just similar if you look at their implementation, but the API should be designed to cater its users, not its implementers. |
Are you using "bug" the same way I am, as in "bug in rustc"? If you are, then "if this line is ever reached, there was a bug" is wrong, because If the statement is instead "if this line is ever reached, the program being compiled is erroneous" then that makes more sense. |
r=me on everything but the last commit.
let's just work on that without renaming it first |
I didn't do a good job of separating out distinct changes, and the last commit has a couple of different things happening. I will revert the parts of it that change "good path" to "weak". |
Maybe we should have a t-compiler MCP for the name, to get input from more people. |
32803e1
to
23510b2
Compare
No thanks. I won't invite 15 people to weigh in via a process with a 10 day final comment period, just to get permission to rename something that has only ~30 occurrences in the compiler and that I want to remove anyway. @oli-obk: I have updated the final commit to remove the "good path"-to-"weak" renaming parts. Should be good to go now, I think. |
@bors r+ |
🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened. |
…i-obk Some cleanups around diagnostic levels. Plus some refactoring in and around diagnostic levels and emission. Details in the individual commit logs. r? `@oli-obk`
…i-obk Some cleanups around diagnostic levels. Plus some refactoring in and around diagnostic levels and emission. Details in the individual commit logs. r? ``@oli-obk``
The two kinds of delayed bug have quite different semantics so a stronger conceptual separation is nice. (`is_error` is a good example, because the two kinds have different behaviour.) The commit also moves the `DelayedBug` variant after `Error` in `Level`, to reflect the fact that it's weaker than `Error` -- it might trigger an error but also might not. (The pre-existing `downgrade_to_delayed_bug` function also reflects the notion that delayed bugs are lower/after normal errors.) Plus it condenses some of the comments on `Level` into a table, for easier reading, and introduces `can_be_top_or_sub` to indicate which levels can be used in top-level diagnostics vs. subdiagnostics. Finally, it renames `DiagCtxtInner::span_delayed_bugs` as `DiagCtxtInner::delayed_bugs`. The `span_` prefix is unnecessary because some delayed bugs don't have a span.
23510b2
to
59e0bc2
Compare
The commit involving @bors r=oli-obk |
…i-obk Some cleanups around diagnostic levels. Plus some refactoring in and around diagnostic levels and emission. Details in the individual commit logs. r? `@oli-obk`
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#120396 (Account for unbounded type param receiver in suggestions) - rust-lang#120423 (update indirect structural match lints to match RFC and to show up for dependencies) - rust-lang#120435 (Suggest name value cfg when only value is used for check-cfg) - rust-lang#120507 (Account for non-overlapping unmet trait bounds in suggestion) - rust-lang#120520 (Some cleanups around diagnostic levels.) - rust-lang#120521 (Make `NonZero` constructors generic.) - rust-lang#120527 (Switch OwnedStore handle count to AtomicU32) - rust-lang#120550 (Continue to borrowck even if there were previous errors) - rust-lang#120575 (Simplify codegen diagnostic handling) r? `@ghost` `@rustbot` modify labels: rollup
@bors r- may need rebase |
looks like this was not the problem 🎉 |
…i-obk Some cleanups around diagnostic levels. Plus some refactoring in and around diagnostic levels and emission. Details in the individual commit logs. r? `@oli-obk`
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#120023 (tidy: reduce allocs) - rust-lang#120396 (Account for unbounded type param receiver in suggestions) - rust-lang#120435 (Suggest name value cfg when only value is used for check-cfg) - rust-lang#120507 (Account for non-overlapping unmet trait bounds in suggestion) - rust-lang#120520 (Some cleanups around diagnostic levels.) - rust-lang#120575 (Simplify codegen diagnostic handling) - rust-lang#120670 (cleanup effect var handling) Failed merges: - rust-lang#120423 (update indirect structural match lints to match RFC and to show up for dependencies) r? `@ghost` `@rustbot` modify labels: rollup
…i-obk Some cleanups around diagnostic levels. Plus some refactoring in and around diagnostic levels and emission. Details in the individual commit logs. r? ``@oli-obk``
…i-obk Some cleanups around diagnostic levels. Plus some refactoring in and around diagnostic levels and emission. Details in the individual commit logs. r? ```@oli-obk```
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#120302 (various const interning cleanups) - rust-lang#120520 (Some cleanups around diagnostic levels.) - rust-lang#120521 (Make `NonZero` constructors generic.) - rust-lang#120527 (Switch OwnedStore handle count to AtomicU32) - rust-lang#120564 (coverage: Split out counter increment sites from BCB node/edge counters) - rust-lang#120575 (Simplify codegen diagnostic handling) - rust-lang#120597 (Suggest `[tail @ ..]` on `[..tail]` and `[...tail]` where `tail` is unresolved) - rust-lang#120609 (hir: Stop keeping prefixes for most of `use` list stems) - rust-lang#120633 (pattern_analysis: gather up place-relevant info) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 12 pull requests Successful merges: - rust-lang#120520 (Some cleanups around diagnostic levels.) - rust-lang#120575 (Simplify codegen diagnostic handling) - rust-lang#120597 (Suggest `[tail @ ..]` on `[..tail]` and `[...tail]` where `tail` is unresolved) - rust-lang#120602 (rustc_monomorphize: fix outdated comment in partition) - rust-lang#120609 (hir: Stop keeping prefixes for most of `use` list stems) - rust-lang#120631 (Emit a diagnostic for invalid target options) - rust-lang#120632 (For E0223, suggest associated functions that are similar to the path) - rust-lang#120670 (cleanup effect var handling) - rust-lang#120673 (rustc_metadata: fix typo) - rust-lang#120683 (miri: fix ICE with symbolic alignment check on extern static) - rust-lang#120690 (Remove b-naber from the compiler review rotation) - rust-lang#120713 (Make async closures test use async bound modifier) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#120520 - nnethercote:rename-good-path, r=oli-obk Some cleanups around diagnostic levels. Plus some refactoring in and around diagnostic levels and emission. Details in the individual commit logs. r? ````@oli-obk````
Plus some refactoring in and around diagnostic levels and emission. Details in the individual commit logs.
r? @oli-obk