Merge ForceWarning/Allow/Expect into Warning - #163290
Conversation
There is one match arm handling some `ForceWarning` cases and another arm handling the remaining `ForceWarning` case and also `Expect`. They can be rearranged into one arm handling `ForceWarning` and one arm handling `Expect`. Also fix some comments: - `ForceWarning` no longer has a field. - Clarify the `LintExpectationId` location. - The one about deduplication was inverted.
I think the ship has sailed on the "every error should have an error code" idea and it's not worth pretending otherwise.
|
cc @rust-lang/miri
cc @Muscraft
cc @rust-lang/rustfmt |
|
@oli-obk: this undoes the first commit from #138610, which removed fields from I've always found the lint/expectation stuff confusing and I feel like this new structure finally lets things be clear in my head. See what you think. |
This comment has been minimized.
This comment has been minimized.
6211286 to
2ac3d64
Compare
| } | ||
| Ok(SharedEmitterMessage::InlineAsmError(inner)) => { | ||
| assert_matches!(inner.level, Level::Error | Level::Warning | Level::Note); | ||
| assert_matches!(inner.level, Level::Error | Level::Warning(_) | Level::Note); |
There was a problem hiding this comment.
to preserve the previous assertion this should be Level::Warning(None), right?
There was a problem hiding this comment.
Good catch. I checked all the other occurrences of Warning(_), I think all the others are ok.
|
Reminder, once the PR becomes ready for a review, use |
Because they're all just special cases of warnings. This requires introducing a new `Option<EmissionOverride>` field to `Warning` that describes the special case behaviour; the `DiagInner::lint_id` field also gets merged in. Specific nice things about this: - Removes some unreachable match arms for `Allow`/`Expect`. - Removes the hacky upgrading of `Allow`/`Expect` to `Warning` in `emit_future_breakage_report`. - The types now have structure that used to be maintained by comments and assertions. E.g. it's now impossible to not have a `lint_id` for an `expect` lint. (I always found the `DiagInner::lint_id` field confusing; it's clearer now.) - There's a nice comment on `EmissionOverride` summarizing all the different cases. - A little less code overall.
2ac3d64 to
fcf74ea
Compare
|
I fixed the nit. @bors r=oli-obk |
Rollup of 13 pull requests Successful merges: - #160695 (Detect bad number of generics caused by bad derive) - #162883 (No longer auto-inline `f16` and `f128` on well-supported platforms) - #163133 ([rustdoc] Fix invalid jump to def link when `#[rustc_allow_incoherent_impl]` is involved) - #163215 (Fix suggestion for Option to bool with proper precedence handling) - #163266 (More deferred liveness cleanups) - #163274 (Support -Z merge-functions with gcc and add stack-protector asm tests) - #163290 (Merge `ForceWarning`/`Allow`/`Expect` into `Warning`) - #163298 (Don't emit sugg for pub-reexport extern std) - #163312 (Add rustdoc regression test for glob import of a crate that re-exports) - #163357 (Borrowck cleanups part trois) - #161710 (Stabilize `mem::conjure_zst`) - #163332 (Add some docs to `Global`) - #163362 (simplify ndk compiler test)
Because they're all just special cases of warnings. Details in individual commits.
r? @oli-obk