mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 18:23:49 +00:00
Add adt_def into Switch, since it's convenient to have in trans
This commit is contained in:
parent
b5d3580843
commit
3ab29d3378
@ -92,6 +92,7 @@ impl<'a,'tcx> Builder<'a,'tcx> {
|
||||
.collect();
|
||||
self.cfg.terminate(block, Terminator::Switch {
|
||||
discr: lvalue.clone(),
|
||||
adt_def: adt_def,
|
||||
targets: target_blocks.clone()
|
||||
});
|
||||
target_blocks
|
||||
|
@ -247,6 +247,7 @@ pub enum Terminator<'tcx> {
|
||||
/// lvalue evaluates to some enum; jump depending on the branch
|
||||
Switch {
|
||||
discr: Lvalue<'tcx>,
|
||||
adt_def: AdtDef<'tcx>,
|
||||
targets: Vec<BasicBlock>,
|
||||
},
|
||||
|
||||
@ -279,7 +280,7 @@ impl<'tcx> Terminator<'tcx> {
|
||||
Goto { target: ref b } => slice::ref_slice(b),
|
||||
Panic { target: ref b } => slice::ref_slice(b),
|
||||
If { cond: _, targets: ref b } => b,
|
||||
Switch { discr: _, targets: ref b } => b,
|
||||
Switch { discr: _, adt_def: _, targets: ref b } => b,
|
||||
Diverge => &[],
|
||||
Return => &[],
|
||||
Call { data: _, targets: ref b } => b,
|
||||
@ -318,7 +319,7 @@ impl<'tcx> Debug for Terminator<'tcx> {
|
||||
write!(fmt, "panic -> {:?}", target),
|
||||
If { cond: ref lv, ref targets } =>
|
||||
write!(fmt, "if({:?}) -> {:?}", lv, targets),
|
||||
Switch { discr: ref lv, ref targets } =>
|
||||
Switch { discr: ref lv, adt_def: _, ref targets } =>
|
||||
write!(fmt, "switch({:?}) -> {:?}", lv, targets),
|
||||
Diverge =>
|
||||
write!(fmt, "diverge"),
|
||||
|
Loading…
Reference in New Issue
Block a user