-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify thir::PatKind::ExpandedConstant
#139108
Conversation
This comment has been minimized.
This comment has been minimized.
e3f6e6a
to
0a75955
Compare
@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. |
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 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been meaning to do this tweak for a while, so I'm glad to see it happen here. 👍
I assume that any changes to inline-const patterns specifically will become mostly irrelevant (and untestable) if/when #138492 removes |
☔ The latest upstream changes (presumably #139269) made this pull request unmergeable. Please resolve the merge conflicts. |
0a75955
to
d912c03
Compare
I'm getting mixed signals about how fully we're removing inline_const_pats. In the meantime, this PR is up for review. |
@bors r+ |
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
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`
I made it a bit less ad-hoc. In particular, I removed
is_inline: bool
that 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