Ignore terminators explicitly
This commit is contained in:
parent
469fb197d0
commit
16dedba1c8
@ -146,10 +146,7 @@ fn super_rvalue(
|
||||
Rvalue::CopyForDeref(place) => {
|
||||
self.handle_operand(&Operand::Copy(*place), state).into()
|
||||
}
|
||||
_ => {
|
||||
// FIXME: Check that other Rvalues really have no side-effect.
|
||||
ValueOrPlaceOrRef::Unknown
|
||||
}
|
||||
_ => ValueOrPlaceOrRef::Unknown,
|
||||
}
|
||||
}
|
||||
|
||||
@ -200,7 +197,20 @@ fn handle_terminator(&self, terminator: &Terminator<'tcx>, state: &mut State<Sel
|
||||
self.super_terminator(terminator, state)
|
||||
}
|
||||
|
||||
fn super_terminator(&self, _terminator: &Terminator<'tcx>, _state: &mut State<Self::Value>) {}
|
||||
fn super_terminator(&self, terminator: &Terminator<'tcx>, _state: &mut State<Self::Value>) {
|
||||
match &terminator.kind {
|
||||
TerminatorKind::Call { .. } | TerminatorKind::InlineAsm { .. } => {
|
||||
// Effect is applied by `handle_call_return`.
|
||||
}
|
||||
TerminatorKind::DropAndReplace { .. } | TerminatorKind::Yield { .. } => {
|
||||
// They would have an effect, but are not allowed in this phase.
|
||||
bug!("encountered disallowed terminator");
|
||||
}
|
||||
_ => {
|
||||
// The other terminators can be ignored.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_call_return(
|
||||
&self,
|
||||
|
@ -35,7 +35,6 @@ fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: Consider support for discriminants, mutable references, arrays and slices.
|
||||
struct ConstAnalysis<'tcx> {
|
||||
map: Map,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
|
Loading…
Reference in New Issue
Block a user