Skip to content

Always exhaustively match on typing mode#155047

Merged
rust-bors[bot] merged 5 commits intorust-lang:mainfrom
jdonszelmann:lint-against-eq-typing-mode
Apr 10, 2026
Merged

Always exhaustively match on typing mode#155047
rust-bors[bot] merged 5 commits intorust-lang:mainfrom
jdonszelmann:lint-against-eq-typing-mode

Conversation

@jdonszelmann
Copy link
Copy Markdown
Contributor

@jdonszelmann jdonszelmann commented Apr 9, 2026

View all comments

r? @lcnr

Unimplements Eq/PartialEq for TypingMode, adds TypingModeEqWrapper 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

This comment has been minimized.

@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

This comment has been minimized.

@rust-bors

This comment has been minimized.

Copy link
Copy Markdown
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +106 to +109
let typing_env = ty::TypingEnv::new(
cx.typing_env.param_env,
ty::TypingMode::analysis_in_body(cx.tcx, cx.body.source.def_id().expect_local()),
);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, this should use ty::TyingEnv::Borrowck or even PostBorrowckAnalysis with the new solver

@jdonszelmann jdonszelmann force-pushed the lint-against-eq-typing-mode branch from 791b38b to 6b67e10 Compare April 10, 2026 09:26
@jdonszelmann jdonszelmann force-pushed the lint-against-eq-typing-mode branch from 6b67e10 to 19fd231 Compare April 10, 2026 09:44
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 10, 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.

Copy link
Copy Markdown
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jdonszelmann jdonszelmann force-pushed the lint-against-eq-typing-mode branch from 7760367 to 679d16b Compare April 10, 2026 13:02
@jdonszelmann
Copy link
Copy Markdown
Contributor Author

@bors r=lcnr

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 10, 2026

📌 Commit 679d16b has been approved by lcnr

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 10, 2026
@rust-log-analyzer

This comment has been minimized.

@jdonszelmann jdonszelmann force-pushed the lint-against-eq-typing-mode branch from 679d16b to 18d118a Compare April 10, 2026 13:11
@rust-bors rust-bors bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 10, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 10, 2026

⚠️ A new commit 18d118a7b7a82cc43267d11ed6a64a9afb02f482 was pushed.

This pull request was unapproved.

@jdonszelmann
Copy link
Copy Markdown
Contributor Author

@bors r=lcnr

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 10, 2026

📌 Commit 18d118a has been approved by lcnr

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 10, 2026
rust-bors bot pushed a commit that referenced this pull request Apr 10, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #155047 (Always exhaustively match on typing mode)
 - #155080 (Simplify `try_load_from_disk_fn`.)
 - #152384 (Restrict EII declarations to functions at lowering time)
 - #153796 (Fix ICE when combining #[eii] with #[core::contracts::ensures])
 - #154369 (Fix `pattern_from_macro_note` for bit-or expr)
 - #155027 ( Rename some more of our internal `#[rustc_*]` TEST attributes)
 - #155031 (delegation: fix unelided lifetime ICE, refactoring of GenericArgPosition)
 - #155040 (Fix code block whitespace handling in Markdown)
@rust-bors rust-bors bot merged commit 610eaec into rust-lang:main Apr 10, 2026
11 checks passed
@rustbot rustbot added this to the 1.96.0 milestone Apr 10, 2026
rust-timer added a commit that referenced this pull request Apr 10, 2026
Rollup merge of #155047 - jdonszelmann:lint-against-eq-typing-mode, r=lcnr

Always exhaustively match on typing mode

r? @lcnr

Unimplements Eq/PartialEq for TypingMode, adds TypingModeEqWrapper 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.
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Apr 13, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#155047 (Always exhaustively match on typing mode)
 - rust-lang/rust#155080 (Simplify `try_load_from_disk_fn`.)
 - rust-lang/rust#152384 (Restrict EII declarations to functions at lowering time)
 - rust-lang/rust#153796 (Fix ICE when combining #[eii] with #[core::contracts::ensures])
 - rust-lang/rust#154369 (Fix `pattern_from_macro_note` for bit-or expr)
 - rust-lang/rust#155027 ( Rename some more of our internal `#[rustc_*]` TEST attributes)
 - rust-lang/rust#155031 (delegation: fix unelided lifetime ICE, refactoring of GenericArgPosition)
 - rust-lang/rust#155040 (Fix code block whitespace handling in Markdown)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 14, 2026
…ly-let-else, r=JonathanBrouwer

`#[rustc_must_match_exhaustively]` detect let else

Extension of rust-lang#155047, I forgor to lint on let-else :3
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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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