diff options
| author | bors <bors@rust-lang.org> | 2022-12-10 16:37:36 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-12-10 16:37:36 +0000 |
| commit | 32da2305880765a4c76180086959a2d5da131565 (patch) | |
| tree | e7e308e24979d511dcff466951bcfa6acec44348 /compiler/rustc_const_eval | |
| parent | a161a7b654083a881b22908a475988bcc3221a79 (diff) | |
| parent | ab505298ea4cf338403eeaa94c4458b5ad9530db (diff) | |
| download | rust-32da2305880765a4c76180086959a2d5da131565.tar.gz rust-32da2305880765a4c76180086959a2d5da131565.zip | |
Auto merge of #105531 - matthiaskrgr:rollup-7y7zbgl, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #104460 (Migrate parts of `rustc_expand` to session diagnostics) - #105192 (Point at LHS on binop type err if relevant) - #105234 (Remove unneeded field from `SwitchTargets`) - #105239 (Avoid heap allocation when truncating thread names) - #105410 (Consider `parent_count` for const param defaults) - #105482 (Fix invalid codegen during debuginfo lowering) Failed merges: - #105411 (Introduce `with_forced_trimmed_paths`) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_const_eval')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/terminator.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_const_eval/src/transform/validate.rs | 13 |
2 files changed, 3 insertions, 13 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/terminator.rs b/compiler/rustc_const_eval/src/interpret/terminator.rs index 57e40e168fa..0e7ffcdffc9 100644 --- a/compiler/rustc_const_eval/src/interpret/terminator.rs +++ b/compiler/rustc_const_eval/src/interpret/terminator.rs @@ -29,10 +29,9 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { Goto { target } => self.go_to_block(target), - SwitchInt { ref discr, ref targets, switch_ty } => { + SwitchInt { ref discr, ref targets } => { let discr = self.read_immediate(&self.eval_operand(discr, None)?)?; trace!("SwitchInt({:?})", *discr); - assert_eq!(discr.layout.ty, switch_ty); // Branch to the `otherwise` case by default, if no match is found. let mut target_block = targets.otherwise(); diff --git a/compiler/rustc_const_eval/src/transform/validate.rs b/compiler/rustc_const_eval/src/transform/validate.rs index 5c9263dc5e3..64318f5f54d 100644 --- a/compiler/rustc_const_eval/src/transform/validate.rs +++ b/compiler/rustc_const_eval/src/transform/validate.rs @@ -686,17 +686,8 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> { TerminatorKind::Goto { target } => { self.check_edge(location, *target, EdgeKind::Normal); } - TerminatorKind::SwitchInt { targets, switch_ty, discr } => { - let ty = discr.ty(&self.body.local_decls, self.tcx); - if ty != *switch_ty { - self.fail( - location, - format!( - "encountered `SwitchInt` terminator with type mismatch: {:?} != {:?}", - ty, switch_ty, - ), - ); - } + TerminatorKind::SwitchInt { targets, discr } => { + let switch_ty = discr.ty(&self.body.local_decls, self.tcx); let target_width = self.tcx.sess.target.pointer_width; |
