Skip to content

Always exhaustively match on typing mode#155047

Open
jdonszelmann wants to merge 5 commits intorust-lang:mainfrom
jdonszelmann:lint-against-eq-typing-mode
Open

Always exhaustively match on typing mode#155047
jdonszelmann wants to merge 5 commits intorust-lang:mainfrom
jdonszelmann:lint-against-eq-typing-mode

Conversation

@jdonszelmann
Copy link
Copy Markdown
Contributor

@jdonszelmann jdonszelmann commented Apr 9, 2026

r? @lcnr

Unimplements Eq/PartialEq for TypingMode, adds TypingModeEq for the few cases where we need it (mainly in the query system), and adds a new rustc internal lint to detect cases where we non-exhaustively match on typing mode.

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 9, 2026

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @JonathanBrouwer

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

Some changes occurred in compiler/rustc_attr_parsing

cc @JonathanBrouwer

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred in compiler/rustc_hir/src/attrs

cc @JonathanBrouwer

Some changes occurred to constck

cc @fee1-dead

changes to the core type system

cc @lcnr

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Apr 9, 2026
@jdonszelmann jdonszelmann force-pushed the lint-against-eq-typing-mode branch from 63485a1 to ef0684a Compare April 9, 2026 15:08
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 9, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rust-log-analyzer

This comment has been minimized.

@jdonszelmann jdonszelmann force-pushed the lint-against-eq-typing-mode branch from fcb4cae to 62dbaab Compare April 9, 2026 15:25
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 9, 2026

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@rustbot rustbot added the T-clippy Relevant to the Clippy team. label Apr 9, 2026
@rust-log-analyzer

This comment has been minimized.

@jdonszelmann jdonszelmann force-pushed the lint-against-eq-typing-mode branch from 62dbaab to 791b38b Compare April 9, 2026 18:59
@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

The job pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking flate2 v1.1.9
error: you are deriving `Hash` but have implemented `PartialEq` explicitly
   --> compiler/rustc_type_ir/src/infer_ctxt.rs:98:1
    |
 98 | #[derive_where(Clone, Copy, Hash, Debug; I: Interner)]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this derive macro expansion
    |
   ::: /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/derive-where-1.6.1/src/lib.rs:567:1
    |
567 | pub fn derive_where_actual(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    | ------------------------------------------------------------------------------------- in this expansion of `#[derive(::derive_where::DeriveWhere)]`
    |
note: `PartialEq` implemented here
   --> compiler/rustc_type_ir/src/infer_ctxt.rs:105:1
    |
105 | impl<I: Interner> PartialEq for EqTypingMode<I> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derived_hash_with_manual_eq
    = note: `-D clippy::derived-hash-with-manual-eq` implied by `-D clippy::correctness`
    = help: to override `-D clippy::correctness` add `#[allow(clippy::derived_hash_with_manual_eq)]`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants