Simplify thir::PatKind::ExpandedConstant#139108
Merged
bors merged 5 commits intorust-lang:masterfrom Apr 7, 2025
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
e3f6e6a to
0a75955
Compare
Member
Author
|
@oli-obk I assigned you for the last two commits, I'm not confident what I'm doing is correct. Also wondering if there's a cleaner way to write this. |
Zalathar
reviewed
Mar 30, 2025
Comment on lines
621
to
677
| hir::PatExprKind::Lit { lit, negated } => { | ||
| let ct_ty = self.typeck_results.node_type(expr.hir_id); | ||
| let lit_input = LitToConstInput { lit: &lit.node, ty: ct_ty, neg: *negated }; | ||
| let constant = self.tcx.at(expr.span).lit_to_const(lit_input); | ||
| self.const_to_pat(constant, ct_ty, expr.hir_id, lit.span).kind | ||
| } |
Member
There was a problem hiding this comment.
I've been meaning to do this tweak for a while, so I'm glad to see it happen here. 👍
Member
|
I assume that any changes to inline-const patterns specifically will become mostly irrelevant (and untestable) if/when #138492 removes |
Contributor
Collaborator
|
☔ The latest upstream changes (presumably #139269) made this pull request unmergeable. Please resolve the merge conflicts. |
0a75955 to
d912c03
Compare
Member
Author
|
I'm getting mixed signals about how fully we're removing inline_const_pats. In the meantime, this PR is up for review. |
Contributor
|
@bors r+ |
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 7, 2025
Rollup of 9 pull requests Successful merges: - rust-lang#139035 (Add new `PatKind::Missing` variants) - rust-lang#139108 (Simplify `thir::PatKind::ExpandedConstant`) - rust-lang#139112 (Implement `super let`) - rust-lang#139365 (Default auto traits: fix perf) - rust-lang#139397 (coverage: Build the CGU's global file table as late as possible) - rust-lang#139455 ( Remove support for `extern "rust-intrinsic"` blocks) - rust-lang#139461 (Stop calling `source_span` query in significant drop order code) - rust-lang#139465 (add sret handling for scalar autodiff) - rust-lang#139466 (Trivial tweaks to stop tracking source span directly) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 7, 2025
Rollup merge of rust-lang#139108 - Nadrieril:simplify-expandedconstant, r=oli-obk Simplify `thir::PatKind::ExpandedConstant` I made it a bit less ad-hoc. In particular, I removed `is_inline: bool` that was just caching the output of `tcx.def_kind(def_id)`. This makes inline consts a tiny bit less special in patterns. r? `@oli-obk` cc `@Zalathar`
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 free
to 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.
I made it a bit less ad-hoc. In particular, I removed
is_inline: boolthat was just caching the output oftcx.def_kind(def_id). This makes inline consts a tiny bit less special in patterns.r? @oli-obk
cc @Zalathar