Skip to content

[beta] backport #73326

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

Merged
merged 19 commits into from
Jun 15, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Revert "Add some more comments"
This reverts commit 1a19c1d.
  • Loading branch information
pnkfelix authored and Mark-Simulacrum committed Jun 13, 2020
commit 52f2c6f34d76f6c906603cd0c9e38f7be03989c5
2 changes: 1 addition & 1 deletion src/librustc_mir_build/build/matches/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
literal: method,
}),
args: vec![val, expect],
destination: Some((eq_result, eq_block)),
destination: Some((eq_result.clone(), eq_block)),
cleanup: None,
from_hir_call: false,
},
Expand Down
23 changes: 5 additions & 18 deletions src/librustc_mir_build/build/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,6 @@ trait DropTreeBuilder<'tcx> {

impl DropTree {
fn new() -> Self {
// The root node of the tree doesn't represent a drop, but instead
// represents the block in the tree that should be jumped to once all
// of the required drops have been performed.
let fake_source_info = SourceInfo::outermost(DUMMY_SP);
let fake_data =
DropData { source_info: fake_source_info, local: Local::MAX, kind: DropKind::Storage };
Expand All @@ -261,10 +258,6 @@ impl DropTree {
self.entry_points.push((to, from));
}

/// Builds the MIR for a given drop tree.
///
/// `blocks` should have the same length as `self.drops`, and may have its
/// first value set to some already existing block.
fn build_mir<'tcx, T: DropTreeBuilder<'tcx>>(
&mut self,
cfg: &mut CFG<'tcx>,
Expand Down Expand Up @@ -1351,16 +1344,10 @@ impl<'tcx> DropTreeBuilder<'tcx> for GeneratorDrop {
cfg.start_new_block()
}
fn add_entry(cfg: &mut CFG<'tcx>, from: BasicBlock, to: BasicBlock) {
let term = cfg.block_data_mut(from).terminator_mut();
if let TerminatorKind::Yield { ref mut drop, .. } = term.kind {
let kind = &mut cfg.block_data_mut(from).terminator_mut().kind;
if let TerminatorKind::Yield { drop, .. } = kind {
*drop = Some(to);
} else {
span_bug!(
term.source_info.span,
"cannot enter generator drop tree from {:?}",
term.kind
)
}
};
}
}

Expand All @@ -1371,8 +1358,8 @@ impl<'tcx> DropTreeBuilder<'tcx> for Unwind {
cfg.start_new_cleanup_block()
}
fn add_entry(cfg: &mut CFG<'tcx>, from: BasicBlock, to: BasicBlock) {
let term = &mut cfg.block_data_mut(from).terminator_mut();
match &mut term.kind {
let term = &mut cfg.block_data_mut(from).terminator_mut().kind;
match term {
TerminatorKind::Drop { unwind, .. }
| TerminatorKind::DropAndReplace { unwind, .. }
| TerminatorKind::FalseUnwind { unwind, .. }
Expand Down