]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_mir/transform/simplify_branches.rs
Rollup merge of #61157 - czipperz:BufReader-Seek-remove-extra-discard_buffer, r=nikom...
[rust.git] / src / librustc_mir / transform / simplify_branches.rs
index 3c4d1227a691c4fa7bf2dd67af95f5e2797bbe4d..53949bcfcd707737340477b2943aba88c9915a52 100644 (file)
@@ -22,7 +22,7 @@ fn name<'a>(&'a self) -> Cow<'a, str> {
     fn run_pass<'a, 'tcx>(&self,
                           tcx: TyCtxt<'a, 'tcx, 'tcx>,
                           _src: MirSource<'tcx>,
-                          mir: &mut Mir<'tcx>) {
+                          mir: &mut Body<'tcx>) {
         for block in mir.basic_blocks_mut() {
             let terminator = block.terminator_mut();
             terminator.kind = match terminator.kind {
@@ -30,7 +30,7 @@ fn run_pass<'a, 'tcx>(&self,
                     discr: Operand::Constant(ref c), switch_ty, ref values, ref targets, ..
                 } => {
                     let switch_ty = ParamEnv::empty().and(switch_ty);
-                    let constant = c.literal.map_evaluated(|c| c.assert_bits(tcx, switch_ty));
+                    let constant = c.literal.assert_bits(tcx, switch_ty);
                     if let Some(constant) = constant {
                         let (otherwise, targets) = targets.split_last().unwrap();
                         let mut ret = TerminatorKind::Goto { target: *otherwise };
@@ -47,7 +47,7 @@ fn run_pass<'a, 'tcx>(&self,
                 },
                 TerminatorKind::Assert {
                     target, cond: Operand::Constant(ref c), expected, ..
-                } if (c.literal.map_evaluated(|e| e.assert_bool(tcx)) == Some(true)) == expected =>
+                } if (c.literal.assert_bool(tcx) == Some(true)) == expected =>
                     TerminatorKind::Goto { target },
                 TerminatorKind::FalseEdges { real_target, .. } => {
                     TerminatorKind::Goto { target: real_target }