Uh oh!
There was an error while loading. Please reload this page.
Fix types being marked as dead when they are inferred generic arguments - #148262
Merged
Conversation
rustbot
commented
Oct 29, 2025
Collaborator
r? @nnethercote rustbot has assigned @nnethercote. Use |
JonathanBrouwerforce-pushed
the
dead-code-inference
branch
from
October 29, 2025 21:37
6d0e333 to
5af2270Comparennethercote
approved these changes
Oct 30, 2025
Uh oh!
There was an error while loading. Please reload this page.
Contributor
r=me with the nit addressed, thanks! @bors delegate=JonathanBrouwer |
bors
commented
Oct 30, 2025
Collaborator
✌️ @JonathanBrouwer, you can now approve this pull request! If @nnethercote told you to " |
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
JonathanBrouwerforce-pushed
the
dead-code-inference
branch
from
October 30, 2025 07:31
5af2270 to
a09c4fcCompareJonathanBrouwer
commented
Oct 30, 2025
MemberAuthor
@bors r=nnethercote rollup |
bors
commented
Oct 30, 2025
Collaborator
GuillaumeGomez added a commit
to GuillaumeGomez/rust
that referenced
this pull request
Oct 30, 2025
…e, r=nnethercote Fix types being marked as dead when they are inferred generic arguments Previously usages of a type in a pattern were ignored. This is incorrect, since if the type is in a pattern we're clearly producing it in the expression we're matching against. I think this `in_pat` check was meant to be only for variants, which we should indeed ignore since we can just remove the match arm that matches the pattern. Please double check my logic here since this is my first time touching the dead-code pass and I'm not 100% sure this is what the `self.in_pat` check was for. Fixesrust-lang#148144
bors added a commit
that referenced
this pull request
Oct 30, 2025
Rollup of 4 pull requests Successful merges: - #139751 (Implement pin-project in pattern matching for `&pin mut|const T`) - #147633 (Add new `--bypass-ignore-backends` option) - #148262 (Fix types being marked as dead when they are inferred generic arguments) - #148268 (rustdoc: fix `--emit=dep-info` on scraped examples) r? `@ghost` `@rustbot` modify labels: rollup
GuillaumeGomez added a commit
to GuillaumeGomez/rust
that referenced
this pull request
Oct 30, 2025
…e, r=nnethercote Fix types being marked as dead when they are inferred generic arguments Previously usages of a type in a pattern were ignored. This is incorrect, since if the type is in a pattern we're clearly producing it in the expression we're matching against. I think this `in_pat` check was meant to be only for variants, which we should indeed ignore since we can just remove the match arm that matches the pattern. Please double check my logic here since this is my first time touching the dead-code pass and I'm not 100% sure this is what the `self.in_pat` check was for. Fixesrust-lang#148144
bors added a commit
that referenced
this pull request
Oct 30, 2025
Rollup of 4 pull requests Successful merges: - #144291 (Constify trait aliases) - #147633 (Add new `--bypass-ignore-backends` option) - #148262 (Fix types being marked as dead when they are inferred generic arguments) - #148268 (rustdoc: fix `--emit=dep-info` on scraped examples) r? `@ghost` `@rustbot` modify labels: rollup
bors added a commit
that referenced
this pull request
Oct 31, 2025
Rollup of 4 pull requests Successful merges: - #144291 (Constify trait aliases) - #147633 (Add new `--bypass-ignore-backends` option) - #148252 (Improve diagnose for unconditional panic when resource limit) - #148262 (Fix types being marked as dead when they are inferred generic arguments) r? `@ghost` `@rustbot` modify labels: rollup
Uh oh!
There was an error while loading. Please reload this page.
rust-timer added a commit
that referenced
this pull request
Oct 31, 2025
Rollup merge of #148262 - JonathanBrouwer:dead-code-inference, r=nnethercote Fix types being marked as dead when they are inferred generic arguments Previously usages of a type in a pattern were ignored. This is incorrect, since if the type is in a pattern we're clearly producing it in the expression we're matching against. I think this `in_pat` check was meant to be only for variants, which we should indeed ignore since we can just remove the match arm that matches the pattern. Please double check my logic here since this is my first time touching the dead-code pass and I'm not 100% sure this is what the `self.in_pat` check was for. Fixes#148144
github-actionsBot
pushed a commit
to rust-lang/rustc-dev-guide
that referenced
this pull request
Nov 3, 2025
Rollup of 4 pull requests Successful merges: - rust-lang/rust#144291 (Constify trait aliases) - rust-lang/rust#147633 (Add new `--bypass-ignore-backends` option) - rust-lang/rust#148252 (Improve diagnose for unconditional panic when resource limit) - rust-lang/rust#148262 (Fix types being marked as dead when they are inferred generic arguments) r? `@ghost` `@rustbot` modify labels: rollup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously usages of a type in a pattern were ignored. This is incorrect, since if the type is in a pattern we're clearly producing it in the expression we're matching against.
I think this
in_patcheck was meant to be only for variants, which we should indeed ignore since we can just remove the match arm that matches the pattern. Please double check my logic here since this is my first time touching the dead-code pass and I'm not 100% sure this is what theself.in_patcheck was for.Fixes#148144