Skip to content

Commit 9c6bfe4

Browse files
committed
mir: Truncate bool to i1 for SwitchInt.
1 parent 38638d3 commit 9c6bfe4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/librustc_trans/trans/mir/block.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
104104
mir::Terminator::SwitchInt { ref discr, switch_ty, ref values, ref targets } => {
105105
let (otherwise, targets) = targets.split_last().unwrap();
106106
let discr = bcx.load(self.trans_lvalue(&bcx, discr).llval);
107+
let discr = bcx.with_block(|bcx| base::to_immediate(bcx, discr, switch_ty));
107108
let switch = bcx.switch(discr, self.llblock(*otherwise), values.len());
108109
for (value, target) in values.iter().zip(targets) {
109110
let llval = self.trans_constval(&bcx, value, switch_ty).immediate();

0 commit comments

Comments
 (0)