Skip to content

Commit 3ab29d3

Browse files
committed
Add adt_def into Switch, since it's convenient to have in trans
1 parent b5d3580 commit 3ab29d3

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/librustc_mir/build/matches/test.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ impl<'a,'tcx> Builder<'a,'tcx> {
9292
.collect();
9393
self.cfg.terminate(block, Terminator::Switch {
9494
discr: lvalue.clone(),
95+
adt_def: adt_def,
9596
targets: target_blocks.clone()
9697
});
9798
target_blocks

src/librustc_mir/repr.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ pub enum Terminator<'tcx> {
247247
/// lvalue evaluates to some enum; jump depending on the branch
248248
Switch {
249249
discr: Lvalue<'tcx>,
250+
adt_def: AdtDef<'tcx>,
250251
targets: Vec<BasicBlock>,
251252
},
252253

@@ -279,7 +280,7 @@ impl<'tcx> Terminator<'tcx> {
279280
Goto { target: ref b } => slice::ref_slice(b),
280281
Panic { target: ref b } => slice::ref_slice(b),
281282
If { cond: _, targets: ref b } => b,
282-
Switch { discr: _, targets: ref b } => b,
283+
Switch { discr: _, adt_def: _, targets: ref b } => b,
283284
Diverge => &[],
284285
Return => &[],
285286
Call { data: _, targets: ref b } => b,
@@ -318,7 +319,7 @@ impl<'tcx> Debug for Terminator<'tcx> {
318319
write!(fmt, "panic -> {:?}", target),
319320
If { cond: ref lv, ref targets } =>
320321
write!(fmt, "if({:?}) -> {:?}", lv, targets),
321-
Switch { discr: ref lv, ref targets } =>
322+
Switch { discr: ref lv, adt_def: _, ref targets } =>
322323
write!(fmt, "switch({:?}) -> {:?}", lv, targets),
323324
Diverge =>
324325
write!(fmt, "diverge"),

0 commit comments

Comments
 (0)