-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Document TRACK_DIAGNOSTIC
calls.
#120699
Document TRACK_DIAGNOSTIC
calls.
#120699
Conversation
☔ The latest upstream changes (presumably #120715) made this pull request unmergeable. Please resolve the merge conflicts. |
e8fcc8e
to
091091b
Compare
It's a tiny change, but I still managed to make this conflict with one of my own PRs :) Anyway, I rebased. |
091091b
to
fd40d67
Compare
I added a small follow-up refactoring. |
☔ The latest upstream changes (presumably #120980) made this pull request unmergeable. Please resolve the merge conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a bit of time before getting to this. I think the reasoning is correct: we only need to track actual side effects, not potential side effects. However, I have a doubt about the Expect
case.
fd40d67
to
4d9ce73
Compare
TRACK_DIAGNOSTIC
calls.TRACK_DIAGNOSTIC
calls.
I have redone this PR. There's a bunch of refactoring, plus some addition of comments. Quite different from the original version, but I think it adds some welcome clarity to |
compiler/rustc_errors/src/lib.rs
Outdated
// Is saving the diagnostic in `delayed_bugs` a notable | ||
// side-effect? Should `TRACK_DIAGNOSTIC` be called? | ||
// Unclear. Currently we err on the side of "no" to avoid | ||
// having to clone the diagnostic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not need to call TRACK_DIAGNOSTIC
: if there is a delayed bug, the incremental session is deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I have updated the comment.
4d9ce73
to
c2b6e91
Compare
☔ The latest upstream changes (presumably #121415) made this pull request unmergeable. Please resolve the merge conflicts. |
This means `DiagCtxtInner::emit_diagnostic` can return its result directly, rather than having to modify a local variable.
It has a single call site, and this will enable subsequent refactorings.
It results in a tiny bit of duplication (another `self.treat_next_err_as_bug()` condition) but I think it's worth it to get more code into the main `match`.
This will enable additional refactorings.
Note that `self.suppressed_expected_diag` is no longer set for `ForceWarning`, which is good. Nor is `TRACK_DIAGNOSTIC` called for `Allow`, which is also good.
Also add an assertion for the levels allowed with `has_future_breakage`.
This match is complex enough that it's a good idea to enumerate every variant. This also means `can_be_top_or_sub` can just be `can_be_subdiag`.
c2b6e91
to
7ef605b
Compare
I rebased and added one new commit, to make the |
…OSTIC-calls, r=oli-obk Document `TRACK_DIAGNOSTIC` calls. r? `@cjgillot`
…iaskrgr Rollup of 12 pull requests Successful merges: - rust-lang#104353 (Add CStr::bytes iterator) - rust-lang#120699 (Document `TRACK_DIAGNOSTIC` calls.) - rust-lang#121207 (Add `-Z external-clangrt`) - rust-lang#122397 (Various cleanups around the const eval query providers) - rust-lang#122416 (Various style improvements to `rustc_lint::levels`) - rust-lang#122422 (compiletest: Allow `only-unix` in test headers) - rust-lang#122424 (fix: typos) - rust-lang#122425 (Increase timeout for new bors bot) - rust-lang#122426 (Fix StableMIR `WrappingRange::is_full` computation) - rust-lang#122430 (Generate link to `Local` in `hir::Let` documentation) - rust-lang#122434 (pattern analysis: rename a few types) - rust-lang#122437 (pattern analysis: remove `MaybeInfiniteInt::JustAfterMax`) r? `@ghost` `@rustbot` modify labels: rollup
…OSTIC-calls, r=oli-obk Document `TRACK_DIAGNOSTIC` calls. r? ``@cjgillot``
…OSTIC-calls, r=oli-obk Document `TRACK_DIAGNOSTIC` calls. r? ```@cjgillot```
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#104353 (Add CStr::bytes iterator) - rust-lang#120699 (Document `TRACK_DIAGNOSTIC` calls.) - rust-lang#120943 (Create some minimal HIR for associated opaque types) - rust-lang#121764 (Make incremental sessions identity no longer depend on the crate names provided by source code) - rust-lang#122375 (CFI: Break tests into smaller files) - rust-lang#122397 (Various cleanups around the const eval query providers) - rust-lang#122405 (Add methods to create StableMIR constant) - rust-lang#122416 (Various style improvements to `rustc_lint::levels`) - rust-lang#122440 (const-eval: organize and extend tests for required-consts) r? `@ghost` `@rustbot` modify labels: rollup
…OSTIC-calls, r=oli-obk Document `TRACK_DIAGNOSTIC` calls. r? ````@cjgillot````
…iaskrgr Rollup of 11 pull requests Successful merges: - rust-lang#104353 (Add CStr::bytes iterator) - rust-lang#114038 (unix time module now return result) - rust-lang#119676 (rustdoc-search: search types by higher-order functions) - rust-lang#120699 (Document `TRACK_DIAGNOSTIC` calls.) - rust-lang#121899 (Document how removing a type's field can be bad and what to do instead) - rust-lang#121940 (Mention Register Size in `#[warn(asm_sub_register)]`) - rust-lang#122397 (Various cleanups around the const eval query providers) - rust-lang#122405 (Add methods to create StableMIR constant) - rust-lang#122416 (Various style improvements to `rustc_lint::levels`) - rust-lang#122440 (const-eval: organize and extend tests for required-consts) - rust-lang#122461 (fix unsoundness in Step::forward_unchecked for signed integers) r? `@ghost` `@rustbot` modify labels: rollup
…OSTIC-calls, r=oli-obk Document `TRACK_DIAGNOSTIC` calls. r? `````@cjgillot`````
…OSTIC-calls, r=oli-obk Document `TRACK_DIAGNOSTIC` calls. r? ``````@cjgillot``````
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#104353 (Add CStr::bytes iterator) - rust-lang#119676 (rustdoc-search: search types by higher-order functions) - rust-lang#120699 (Document `TRACK_DIAGNOSTIC` calls.) - rust-lang#121899 (Document how removing a type's field can be bad and what to do instead) - rust-lang#122405 (Add methods to create StableMIR constant) - rust-lang#122416 (Various style improvements to `rustc_lint::levels`) - rust-lang#122421 (Improve `Step` docs) - rust-lang#122440 (const-eval: organize and extend tests for required-consts) - rust-lang#122461 (fix unsoundness in Step::forward_unchecked for signed integers) Failed merges: - rust-lang#122397 (Various cleanups around the const eval query providers) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#120699 - nnethercote:rm-useless-TRACK_DIAGNOSTIC-calls, r=oli-obk Document `TRACK_DIAGNOSTIC` calls. r? ```````@cjgillot```````
In rust-lang#120699 I moved some code dealing with `has_future_breakage` earlier in `emit_diagnostic`. Issue rust-lang#126521 identified a case where that reordering was invalid (leading to an assertion failure) for some `Expect` diagnostics. This commit partially undoes the change, by moving the handling of unstable `Expect` diagnostics earlier again. This makes `emit_diagnostic` a bit uglier, but is necessary to fix the problem. Fixes rust-lang#126521.
Fix assertion failure for some `Expect` diagnostics. In rust-lang#120699 I moved some code dealing with `has_future_breakage` earlier in `emit_diagnostic`. Issue rust-lang#126521 identified a case where that reordering was invalid (leading to an assertion failure) for some `Expect` diagnostics. This commit partially undoes the change, by moving the handling of unstable `Expect` diagnostics earlier again. This makes `emit_diagnostic` a bit uglier, but is necessary to fix the problem. Fixes rust-lang#126521. r? `@oli-obk`
Fix assertion failure for some `Expect` diagnostics. In rust-lang#120699 I moved some code dealing with `has_future_breakage` earlier in `emit_diagnostic`. Issue rust-lang#126521 identified a case where that reordering was invalid (leading to an assertion failure) for some `Expect` diagnostics. This commit partially undoes the change, by moving the handling of unstable `Expect` diagnostics earlier again. This makes `emit_diagnostic` a bit uglier, but is necessary to fix the problem. Fixes rust-lang#126521. r? ``@oli-obk``
Rollup merge of rust-lang#126719 - nnethercote:fix-126521, r=oli-obk Fix assertion failure for some `Expect` diagnostics. In rust-lang#120699 I moved some code dealing with `has_future_breakage` earlier in `emit_diagnostic`. Issue rust-lang#126521 identified a case where that reordering was invalid (leading to an assertion failure) for some `Expect` diagnostics. This commit partially undoes the change, by moving the handling of unstable `Expect` diagnostics earlier again. This makes `emit_diagnostic` a bit uglier, but is necessary to fix the problem. Fixes rust-lang#126521. r? ``@oli-obk``
r? @cjgillot