Uh oh!
There was an error while loading. Please reload this page.
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.
Side note: refutable: bool seems like another good candidate for a dedicated enum in the future.
There was a problem hiding this comment.
Possibly yes. I have hopes to remove the need for it, we'll see
Uh oh!
There was an error while loading. Please reload this page.
Zalathar
commented
Jul 10, 2024
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.
This comment has been minimized.
This comment has been minimized.
This comment was marked as resolved.
This comment was marked as resolved.
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.) |
Nadrieril
commented
Jul 22, 2024
I made them take
I'm guessing you mean |
Zalathar
commented
Jul 22, 2024
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.
bors
commented
Jul 31, 2024
…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
tgross35
commented
Jul 31, 2024
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- |
tgross35
commented
Jul 31, 2024
@bors try |
bors
commented
Jul 31, 2024
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
tgross35
commented
Jul 31, 2024
I am totally wrong, the wasm PR updated stdarch. Sorry about that, please re-r+ after the try job completes. |
bors
commented
Jul 31, 2024
☀️ Try build successful - checks-actions |
tgross35
commented
Jul 31, 2024
@bors r=matthewjasper |
bors
commented
Jul 31, 2024
…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
Candidateare tricky and a source of confusion. This PR makes it so we don't exposeCandidates outside the lowering algorithm. Now:lower_match_tree;lower_match_treetakes a list of patterns as input;lower_match_treereturns a flat datastructure that contains only the necessary information.r? @matthewjasper
try-job: x86_64-rust-for-linux