-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
match lowering: Hide Candidate
from outside the lowering algorithm
#127159
Conversation
This comment has been minimized.
This comment has been minimized.
This comment was marked as resolved.
This comment was marked as resolved.
// the failure block. | ||
previous_candidate.as_mut().unwrap().next_candidate_start_block = Some(otherwise_block) | ||
} else { | ||
if !refutable { |
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.
Side note: refutable: bool
seems like another good candidate for a dedicated enum in the future.
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.
Possibly yes. I have hopes to remove the need for it, we'll see
So if I understand this correctly:
|
Yep, all correct. I don't feel the need to assert the number of arms, it's just a |
This comment was marked as resolved.
This comment was marked as resolved.
f44350d
to
d4c09a6
Compare
This comment has been minimized.
This comment has been minimized.
d4c09a6
to
8172e31
Compare
This comment was marked as resolved.
This comment was marked as resolved.
8172e31
to
62c2c6e
Compare
I was playing around with this, and one thing I found was that it's fairly easy to change Obviously both ways are possible (since the candidates aren't used afterwards), but the by-reference version feels a bit nicer to me, because there's no need to worry about being able to move things at the right time. Similarly, it's possible to have (Not a blocking concern; I'm happy to propose this change as a follow-up PR.) |
I made them take
I'm guessing you mean |
Ah, I didn't have a specific use case (beyond trying to get rid of the slightly ugly length check and |
Various notes on match lowering This is an assortment of comments for things that I found unclear or confusing when I was learning how match lowering works. This PR only adds/modifies comments, so there are no functional changes. I have tried to avoid touching code that would conflict with rust-lang#127159. r? `@Nadrieril`
Rollup merge of rust-lang#128085 - Zalathar:notes, r=Nadrieril Various notes on match lowering This is an assortment of comments for things that I found unclear or confusing when I was learning how match lowering works. This PR only adds/modifies comments, so there are no functional changes. I have tried to avoid touching code that would conflict with rust-lang#127159. r? `@Nadrieril`
This comment was marked as outdated.
This comment was marked as outdated.
62c2c6e
to
cd91954
Compare
…wjasper match lowering: Hide `Candidate` from outside the lowering algorithm The internals of `Candidate` are tricky and a source of confusion. This PR makes it so we don't expose `Candidate`s outside the lowering algorithm. Now: - false edges are handled in `lower_match_tree`; - `lower_match_tree` takes a list of patterns as input; - `lower_match_tree` returns a flat datastructure that contains only the necessary information. r? `@matthewjasper`
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#123813 (Add `REDUNDANT_IMPORTS` lint for new redundant import detection) - rust-lang#127159 (match lowering: Hide `Candidate` from outside the lowering algorithm) - rust-lang#128162 (Cleanup sys module to match house style) - rust-lang#128296 (Update target-spec metadata for loongarch64 targets) - rust-lang#128417 (Add `f16` and `f128` math functions) - rust-lang#128431 (Add myself as VxWorks target maintainer for reference) - rust-lang#128437 (improve bootstrap to allow selecting llvm tools individually) r? `@ghost` `@rustbot` modify labels: rollup
…wjasper match lowering: Hide `Candidate` from outside the lowering algorithm The internals of `Candidate` are tricky and a source of confusion. This PR makes it so we don't expose `Candidate`s outside the lowering algorithm. Now: - false edges are handled in `lower_match_tree`; - `lower_match_tree` takes a list of patterns as input; - `lower_match_tree` returns a flat datastructure that contains only the necessary information. r? ``@matthewjasper``
Rollup of 7 pull requests Successful merges: - rust-lang#117468 (Stabilize Wasm relaxed SIMD) - rust-lang#123813 (Add `REDUNDANT_IMPORTS` lint for new redundant import detection) - rust-lang#127060 (Migrate `symbol-visibility` `run-make` test to rmake) - rust-lang#127159 (match lowering: Hide `Candidate` from outside the lowering algorithm) - rust-lang#128296 (Update target-spec metadata for loongarch64 targets) - rust-lang#128416 (android: Remove libstd hacks for unsupported Android APIs) - rust-lang#128431 (Add myself as VxWorks target maintainer for reference) r? `@ghost` `@rustbot` modify labels: rollup
I think this may have somehow failed the rollup at #128454 (comment). I am not entirely sure how but this seems like the only PR in the rollup that affects codegen. I'll start a try job to confirm. The RFL job failed but I assume that was just the first CI job to complete and others would have failed too. Also going to ask on Zulip. @bors r- |
@bors try |
match lowering: Hide `Candidate` from outside the lowering algorithm The internals of `Candidate` are tricky and a source of confusion. This PR makes it so we don't expose `Candidate`s outside the lowering algorithm. Now: - false edges are handled in `lower_match_tree`; - `lower_match_tree` takes a list of patterns as input; - `lower_match_tree` returns a flat datastructure that contains only the necessary information. r? `@matthewjasper` try-job: x86_64-rust-for-linux
I am totally wrong, the wasm PR updated stdarch. Sorry about that, please re-r+ after the try job completes. |
☀️ Try build successful - checks-actions |
@bors r=matthewjasper |
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#123813 (Add `REDUNDANT_IMPORTS` lint for new redundant import detection) - rust-lang#126697 ([RFC] mbe: consider the `_` in 2024 an expression) - rust-lang#127159 (match lowering: Hide `Candidate` from outside the lowering algorithm) - rust-lang#128244 (Peel off explicit (or implicit) deref before suggesting clone on move error in borrowck, remove some hacks) - rust-lang#128431 (Add myself as VxWorks target maintainer for reference) - rust-lang#128438 (Add special-case for [T, 0] in dropck_outlives) - rust-lang#128457 (Fix docs for OnceLock::get_mut_or_init) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#123813 (Add `REDUNDANT_IMPORTS` lint for new redundant import detection) - rust-lang#126697 ([RFC] mbe: consider the `_` in 2024 an expression) - rust-lang#127159 (match lowering: Hide `Candidate` from outside the lowering algorithm) - rust-lang#128244 (Peel off explicit (or implicit) deref before suggesting clone on move error in borrowck, remove some hacks) - rust-lang#128431 (Add myself as VxWorks target maintainer for reference) - rust-lang#128438 (Add special-case for [T, 0] in dropck_outlives) - rust-lang#128457 (Fix docs for OnceLock::get_mut_or_init) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#127159 - Nadrieril:hide-candidate, r=matthewjasper match lowering: Hide `Candidate` from outside the lowering algorithm The internals of `Candidate` are tricky and a source of confusion. This PR makes it so we don't expose `Candidate`s outside the lowering algorithm. Now: - false edges are handled in `lower_match_tree`; - `lower_match_tree` takes a list of patterns as input; - `lower_match_tree` returns a flat datastructure that contains only the necessary information. r? ```@matthewjasper```
The internals of
Candidate
are tricky and a source of confusion. This PR makes it so we don't exposeCandidate
s outside the lowering algorithm. Now:lower_match_tree
;lower_match_tree
takes a list of patterns as input;lower_match_tree
returns a flat datastructure that contains only the necessary information.r? @matthewjasper
try-job: x86_64-rust-for-linux