Skip to content

Rollup of 7 pull requests #128454

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

Closed
wants to merge 21 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
b4e1a53
Update target-spec metadata for loongarch64 targets
heiher Jul 28, 2024
9e05fb6
Small simplification
Nadrieril Jun 23, 2024
e2fd9aa
Set up false edges in `lower_match_tree`
Nadrieril Jun 23, 2024
cbdacec
Abstract out the candidate manipulation not in the main algorithm
Nadrieril Jun 23, 2024
c747166
Visiting bindings is straightforward now
Nadrieril Jun 23, 2024
08bcc01
Entirely hide `Candidate`s from outside `lower_match_tree`
Nadrieril Jun 30, 2024
689bb11
rewrite symbol-visibility to rmake
Oneirical Jun 27, 2024
dcaa17a
invalid stdout_utf8 handling in run_make_support
Oneirical Jul 15, 2024
7d7ad7b
android: Remove libstd hacks for unsupported Android APIs
maurer Jul 30, 2024
f6f587e
Introduce REDUNDANT_IMPORTS lint
compiler-errors Apr 11, 2024
eb0a444
Stabilize Wasm relaxed SIMD
daxpedda Feb 21, 2024
62d4998
Add VxWorks platfrom support documents
Jul 31, 2024
ea04b0a
use llvm-nm in symbol-visibility rmake test
Oneirical Jul 30, 2024
61d95e2
Implement a implicit target feature mechanism
daxpedda Jul 12, 2024
4ffdd2a
Rollup merge of #117468 - daxpedda:wasm-relaxed-simd, r=alexcrichton
tgross35 Jul 31, 2024
13cfcb2
Rollup merge of #123813 - compiler-errors:redundant-lint, r=petrochenkov
tgross35 Jul 31, 2024
f562771
Rollup merge of #127060 - Oneirical:testificate, r=jieyouxu
tgross35 Jul 31, 2024
8b050c1
Rollup merge of #127159 - Nadrieril:hide-candidate, r=matthewjasper
tgross35 Jul 31, 2024
8840f88
Rollup merge of #128296 - heiher:update-metadata, r=Urgau
tgross35 Jul 31, 2024
157d040
Rollup merge of #128416 - maurer:remove-android-hack, r=tgross35
tgross35 Jul 31, 2024
8fb0c91
Rollup merge of #128431 - biabbas:master, r=Urgau
tgross35 Jul 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Small simplification
  • Loading branch information
Nadrieril committed Jul 29, 2024
commit 9e05fb67a3360b9faf49b3484e2ac5cec27a6e78
34 changes: 20 additions & 14 deletions compiler/rustc_mir_build/src/build/matches/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1199,6 +1199,17 @@ impl<'tcx, 'pat> Candidate<'pat, 'tcx> {
|_| {},
);
}

/// Visit the leaf candidates in reverse order.
fn visit_leaves_rev<'a>(&'a mut self, mut visit_leaf: impl FnMut(&'a mut Self)) {
traverse_candidate(
self,
&mut (),
&mut move |c, _| visit_leaf(c),
move |c, _| c.subcandidates.iter_mut().rev(),
|_| {},
);
}
}

/// A depth-first traversal of the `Candidate` and all of its recursive
Expand Down Expand Up @@ -1433,23 +1444,18 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
let otherwise_block =
self.match_candidates(match_start_span, scrutinee_span, block, candidates);

// Link each leaf candidate to the `false_edge_start_block` of the next one.
let mut previous_candidate: Option<&mut Candidate<'_, '_>> = None;
for candidate in candidates {
candidate.visit_leaves(|leaf_candidate| {
if let Some(ref mut prev) = previous_candidate {
assert!(leaf_candidate.false_edge_start_block.is_some());
prev.next_candidate_start_block = leaf_candidate.false_edge_start_block;
}
previous_candidate = Some(leaf_candidate);
// Link each leaf candidate to the `false_edge_start_block` of the next one. In the
// refutable case we also want a false edge to the failure block.
let mut next_candidate_start_block = if refutable { Some(otherwise_block) } else { None };
for candidate in candidates.iter_mut().rev() {
candidate.visit_leaves_rev(|leaf_candidate| {
leaf_candidate.next_candidate_start_block = next_candidate_start_block;
assert!(leaf_candidate.false_edge_start_block.is_some());
next_candidate_start_block = leaf_candidate.false_edge_start_block;
});
}

if refutable {
// In refutable cases there's always at least one candidate, and we want a false edge to
// the failure block.
previous_candidate.as_mut().unwrap().next_candidate_start_block = Some(otherwise_block)
} else {
if !refutable {
// Match checking ensures `otherwise_block` is actually unreachable in irrefutable
// cases.
let source_info = self.source_info(scrutinee_span);
Expand Down