Skip to content

Commit c6d0b5b

Browse files
committed
address review comments
1 parent 24c1a07 commit c6d0b5b

File tree

4 files changed

+138
-127
lines changed

4 files changed

+138
-127
lines changed

src/librustc/ty/util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
585585
})
586586
}
587587

588-
pub fn const_usize(&self, val: usize) -> ConstInt {
588+
pub fn const_usize(&self, val: u16) -> ConstInt {
589589
match self.sess.target.uint_type {
590590
ast::UintTy::U16 => ConstInt::Usize(ConstUsize::Us16(val as u16)),
591591
ast::UintTy::U32 => ConstInt::Usize(ConstUsize::Us32(val as u32)),

src/librustc_borrowck/borrowck/mir/elaborate_drops.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use rustc::util::nodemap::FxHashMap;
2222
use rustc_data_structures::indexed_set::IdxSetBuf;
2323
use rustc_data_structures::indexed_vec::Idx;
2424
use rustc_mir::util::patch::MirPatch;
25-
use rustc_mir::util::elaborate_drops::{DropFlagState, elaborate_drop};
25+
use rustc_mir::util::elaborate_drops::{DropFlagState, Unwind, elaborate_drop};
2626
use rustc_mir::util::elaborate_drops::{DropElaborator, DropStyle, DropFlagMode};
2727
use syntax::ast;
2828
use syntax_pos::Span;
@@ -399,14 +399,13 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
399399
ctxt: self
400400
},
401401
terminator.source_info,
402-
data.is_cleanup,
403402
location,
404403
path,
405404
target,
406405
if data.is_cleanup {
407-
None
406+
Unwind::InCleanup
408407
} else {
409-
Some(Option::unwrap_or(unwind, resume_block))
408+
Unwind::To(Option::unwrap_or(unwind, resume_block))
410409
},
411410
bb)
412411
}
@@ -455,6 +454,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
455454
let bb = loc.block;
456455
let data = &self.mir[bb];
457456
let terminator = data.terminator();
457+
assert!(!data.is_cleanup, "DropAndReplace in unwind path not supported");
458458

459459
let assign = Statement {
460460
kind: StatementKind::Assign(location.clone(), Rvalue::Use(value.clone())),
@@ -477,7 +477,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
477477
kind: TerminatorKind::Goto { target: target },
478478
..*terminator
479479
}),
480-
is_cleanup: data.is_cleanup,
480+
is_cleanup: false,
481481
});
482482

483483
match self.move_data().rev_lookup.find(location) {
@@ -491,11 +491,10 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
491491
ctxt: self
492492
},
493493
terminator.source_info,
494-
data.is_cleanup,
495494
location,
496495
path,
497496
target,
498-
Some(unwind),
497+
Unwind::To(unwind),
499498
bb);
500499
on_all_children_bits(self.tcx, self.mir, self.move_data(), path, |child| {
501500
self.set_drop_flag(Location { block: target, statement_index: 0 },

src/librustc_mir/shim.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,10 @@ fn build_drop_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
198198
elaborate_drops::elaborate_drop(
199199
&mut elaborator,
200200
source_info,
201-
false,
202201
&dropee,
203202
(),
204203
return_block,
205-
Some(resume_block),
204+
elaborate_drops::Unwind::To(resume_block),
206205
START_BLOCK
207206
);
208207
elaborator.patch

0 commit comments

Comments
 (0)