1 //! Propagates constants for early reporting of statically known
6 use rustc::hir::def::DefKind;
8 AggregateKind, Constant, Location, Place, PlaceBase, Body, Operand, Rvalue,
9 Local, NullOp, UnOp, StatementKind, Statement, LocalKind, Static, StaticKind,
10 TerminatorKind, Terminator, ClearCrossCrate, SourceInfo, BinOp, ProjectionElem,
11 SourceScope, SourceScopeLocalData, LocalDecl, Promoted,
13 use rustc::mir::visit::{
14 Visitor, PlaceContext, MutatingUseContext, MutVisitor, NonMutatingUseContext,
16 use rustc::mir::interpret::{InterpError::Panic, Scalar, GlobalId, InterpResult, PanicMessage};
17 use rustc::ty::{self, Instance, ParamEnv, Ty, TyCtxt};
18 use syntax_pos::{Span, DUMMY_SP};
19 use rustc::ty::subst::InternalSubsts;
20 use rustc_data_structures::indexed_vec::IndexVec;
21 use rustc::ty::layout::{
22 LayoutOf, TyLayout, LayoutError, HasTyCtxt, TargetDataLayout, HasDataLayout, Size,
25 use crate::interpret::{
26 self, InterpCx, ScalarMaybeUndef, Immediate, OpTy,
27 ImmTy, MemoryKind, StackPopCleanup, LocalValue, LocalState,
29 use crate::const_eval::{
30 CompileTimeInterpreter, error_to_const_error, eval_promoted, mk_eval_cx,
32 use crate::transform::{MirPass, MirSource};
36 impl MirPass for ConstProp {
37 fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx>, source: MirSource<'tcx>, body: &mut Body<'tcx>) {
38 // will be evaluated by miri and produce its errors there
39 if source.promoted.is_some() {
43 use rustc::hir::map::blocks::FnLikeNode;
44 let hir_id = tcx.hir().as_local_hir_id(source.def_id())
45 .expect("Non-local call to local provider is_const_fn");
47 let is_fn_like = FnLikeNode::from_node(tcx.hir().get(hir_id)).is_some();
48 let is_assoc_const = match tcx.def_kind(source.def_id()) {
49 Some(DefKind::AssocConst) => true,
53 // Only run const prop on functions, methods, closures and associated constants
54 if !is_fn_like && !is_assoc_const {
55 // skip anon_const/statics/consts because they'll be evaluated by miri anyway
56 trace!("ConstProp skipped for {:?}", source.def_id());
60 trace!("ConstProp starting for {:?}", source.def_id());
62 // Steal some data we need from `body`.
63 let source_scope_local_data = std::mem::replace(
64 &mut body.source_scope_local_data,
65 ClearCrossCrate::Clear
67 let promoted = std::mem::replace(
74 body.basic_blocks().clone(),
76 ClearCrossCrate::Clear,
79 body.local_decls.clone(),
83 tcx.def_span(source.def_id()),
87 // FIXME(oli-obk, eddyb) Optimize locals (or even local paths) to hold
88 // constants, instead of just checking for const-folding succeeding.
89 // That would require an uniform one-def no-mutation analysis
90 // and RPO (or recursing when needing the value of a local).
91 let mut optimization_finder = ConstPropagator::new(
94 source_scope_local_data,
99 optimization_finder.visit_body(body);
101 // put back the data we stole from `mir`
102 let (source_scope_local_data, promoted) = optimization_finder.release_stolen_data();
104 &mut body.source_scope_local_data,
105 source_scope_local_data
112 trace!("ConstProp done for {:?}", source.def_id());
116 type Const<'tcx> = OpTy<'tcx>;
118 /// Finds optimization opportunities on the MIR.
119 struct ConstPropagator<'mir, 'tcx> {
120 ecx: InterpCx<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>>,
122 source: MirSource<'tcx>,
123 can_const_prop: IndexVec<Local, bool>,
124 param_env: ParamEnv<'tcx>,
125 source_scope_local_data: ClearCrossCrate<IndexVec<SourceScope, SourceScopeLocalData>>,
126 local_decls: IndexVec<Local, LocalDecl<'tcx>>,
127 promoted: IndexVec<Promoted, Body<'tcx>>,
130 impl<'mir, 'tcx> LayoutOf for ConstPropagator<'mir, 'tcx> {
132 type TyLayout = Result<TyLayout<'tcx>, LayoutError<'tcx>>;
134 fn layout_of(&self, ty: Ty<'tcx>) -> Self::TyLayout {
135 self.tcx.layout_of(self.param_env.and(ty))
139 impl<'mir, 'tcx> HasDataLayout for ConstPropagator<'mir, 'tcx> {
141 fn data_layout(&self) -> &TargetDataLayout {
142 &self.tcx.data_layout
146 impl<'mir, 'tcx> HasTyCtxt<'tcx> for ConstPropagator<'mir, 'tcx> {
148 fn tcx(&self) -> TyCtxt<'tcx> {
153 impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
156 dummy_body: &'mir Body<'tcx>,
157 source_scope_local_data: ClearCrossCrate<IndexVec<SourceScope, SourceScopeLocalData>>,
158 promoted: IndexVec<Promoted, Body<'tcx>>,
160 source: MirSource<'tcx>,
161 ) -> ConstPropagator<'mir, 'tcx> {
162 let def_id = source.def_id();
163 let param_env = tcx.param_env(def_id);
164 let span = tcx.def_span(def_id);
165 let mut ecx = mk_eval_cx(tcx, span, param_env);
166 let can_const_prop = CanConstProp::check(body);
168 ecx.push_stack_frame(
169 Instance::new(def_id, &InternalSubsts::identity_for_item(tcx, def_id)),
173 StackPopCleanup::None {
176 ).expect("failed to push initial stack frame");
184 source_scope_local_data,
185 //FIXME(wesleywiser) we can't steal this because `Visitor::super_visit_body()` needs it
186 local_decls: body.local_decls.clone(),
191 fn release_stolen_data(
194 ClearCrossCrate<IndexVec<SourceScope, SourceScopeLocalData>>,
195 IndexVec<Promoted, Body<'tcx>>,
197 (self.source_scope_local_data, self.promoted)
200 fn get_const(&self, local: Local) -> Option<Const<'tcx>> {
201 let l = &self.ecx.frame().locals[local];
203 // If the local is `Unitialized` or `Dead` then we haven't propagated a value into it.
205 // `InterpCx::access_local()` mostly takes care of this for us however, for ZSTs,
206 // it will synthesize a value for us. In doing so, that will cause the
207 // `get_const(l).is_empty()` assert right before we call `set_const()` in `visit_statement`
209 if let LocalValue::Uninitialized | LocalValue::Dead = l.value {
213 self.ecx.access_local(self.ecx.frame(), local, None).ok()
216 fn set_const(&mut self, local: Local, c: Const<'tcx>) {
217 let frame = self.ecx.frame_mut();
219 if let Some(layout) = frame.locals[local].layout.get() {
220 debug_assert_eq!(c.layout, layout);
223 frame.locals[local] = LocalState {
224 value: LocalValue::Live(*c),
225 layout: Cell::new(Some(c.layout)),
229 fn remove_const(&mut self, local: Local) {
230 self.ecx.frame_mut().locals[local] = LocalState {
231 value: LocalValue::Uninitialized,
232 layout: Cell::new(None),
238 source_info: SourceInfo,
242 F: FnOnce(&mut Self) -> InterpResult<'tcx, T>,
244 self.ecx.tcx.span = source_info.span;
245 let lint_root = match self.source_scope_local_data {
246 ClearCrossCrate::Set(ref ivs) => {
247 //FIXME(#51314): remove this check
248 if source_info.scope.index() >= ivs.len() {
251 ivs[source_info.scope].lint_root
253 ClearCrossCrate::Clear => return None,
255 let r = match f(self) {
256 Ok(val) => Some(val),
258 let diagnostic = error_to_const_error(&self.ecx, error);
259 use rustc::mir::interpret::InterpError::*;
260 match diagnostic.error {
261 // don't report these, they make no sense in a const prop context
264 // at runtime these transformations might make sense
265 // FIXME: figure out the rules and start linting
266 | FunctionAbiMismatch(..)
267 | FunctionArgMismatch(..)
268 | FunctionRetMismatch(..)
269 | FunctionArgCountMismatch
270 // fine at runtime, might be a register address or sth
275 // don't report const evaluator limits
276 | StackFrameLimitReached
281 | InvalidMemoryAccess
282 | DanglingPointerDeref
284 | InvalidFunctionPointer
286 | InvalidDiscriminant(..)
287 | PointerOutOfBounds { .. }
288 | InvalidNullPointerUsage
289 | ValidationFailure(..)
294 | DerefFunctionPointer
299 | AlignmentCheckFailed{..}
300 | CalledClosureAsFunction
301 | VtableForArgumentlessMethod
302 | ModifiedConstantMemory
305 // FIXME: should probably be removed and turned into a bug! call
306 | TypeNotPrimitive(_)
307 | ReallocatedWrongMemoryKind(_, _)
308 | DeallocatedWrongMemoryKind(_, _)
309 | ReallocateNonBasePtr
310 | DeallocateNonBasePtr
311 | IncorrectAllocationInformation(..)
312 | UnterminatedCString(_)
314 | HeapAllocNonPowerOfTwoAlignment(_)
316 | ReadFromReturnPointer
317 | GeneratorResumedAfterReturn
318 | GeneratorResumedAfterPanic
322 // FIXME: report UB here
328 => bug!("these should not be in rustc, but in miri's machine errors"),
331 | UnimplementedTraitSelection
334 // these are just noise
344 diagnostic.report_as_lint(
346 "this expression will panic at runtime",
355 self.ecx.tcx.span = DUMMY_SP;
362 ) -> Option<Const<'tcx>> {
363 self.ecx.tcx.span = c.span;
364 match self.ecx.eval_const_to_op(c.literal, None) {
369 let err = error_to_const_error(&self.ecx, error);
370 err.report_as_error(self.ecx.tcx, "erroneous constant used");
376 fn eval_place(&mut self, place: &Place<'tcx>, source_info: SourceInfo) -> Option<Const<'tcx>> {
377 trace!("eval_place(place={:?})", place);
378 place.iterate(|place_base, place_projection| {
379 let mut eval = match place_base {
380 PlaceBase::Local(loc) => self.get_const(*loc).clone()?,
381 PlaceBase::Static(box Static {kind: StaticKind::Promoted(promoted), ..}) => {
382 let generics = self.tcx.generics_of(self.source.def_id());
383 if generics.requires_monomorphization(self.tcx) {
384 // FIXME: can't handle code with generics
387 let substs = InternalSubsts::identity_for_item(self.tcx, self.source.def_id());
388 let instance = Instance::new(self.source.def_id(), substs);
391 promoted: Some(*promoted),
393 // cannot use `const_eval` here, because that would require having the MIR
394 // for the current function available, but we're producing said MIR right now
395 let res = self.use_ecx(source_info, |this| {
396 let body = &this.promoted[*promoted];
397 eval_promoted(this.tcx, cid, body, this.param_env)
399 trace!("evaluated promoted {:?} to {:?}", promoted, res);
405 for proj in place_projection {
407 ProjectionElem::Field(field, _) => {
408 trace!("field proj on {:?}", proj.base);
409 eval = self.use_ecx(source_info, |this| {
410 this.ecx.operand_field(eval, field.index() as u64)
413 ProjectionElem::Deref => {
414 trace!("processing deref");
415 eval = self.use_ecx(source_info, |this| {
416 this.ecx.deref_operand(eval)
419 // We could get more projections by using e.g., `operand_projection`,
420 // but we do not even have the stack frame set up properly so
421 // an `Index` projection would throw us off-track.
430 fn eval_operand(&mut self, op: &Operand<'tcx>, source_info: SourceInfo) -> Option<Const<'tcx>> {
432 Operand::Constant(ref c) => self.eval_constant(c),
433 | Operand::Move(ref place)
434 | Operand::Copy(ref place) => self.eval_place(place, source_info),
440 rvalue: &Rvalue<'tcx>,
441 place_layout: TyLayout<'tcx>,
442 source_info: SourceInfo,
443 ) -> Option<Const<'tcx>> {
444 let span = source_info.span;
446 Rvalue::Use(ref op) => {
447 self.eval_operand(op, source_info)
449 Rvalue::Ref(_, _, ref place) => {
450 let src = self.eval_place(place, source_info)?;
451 let mplace = src.try_as_mplace().ok()?;
452 Some(ImmTy::from_scalar(mplace.ptr.into(), place_layout).into())
455 Rvalue::Aggregate(..) |
456 Rvalue::NullaryOp(NullOp::Box, _) |
457 Rvalue::Discriminant(..) => None,
459 Rvalue::Cast(kind, ref operand, _) => {
460 let op = self.eval_operand(operand, source_info)?;
461 self.use_ecx(source_info, |this| {
462 let dest = this.ecx.allocate(place_layout, MemoryKind::Stack);
463 this.ecx.cast(op, kind, dest.into())?;
467 Rvalue::Len(ref place) => {
468 let place = self.eval_place(&place, source_info)?;
469 let mplace = place.try_as_mplace().ok()?;
471 if let ty::Slice(_) = mplace.layout.ty.sty {
472 let len = mplace.meta.unwrap().to_usize(&self.ecx).unwrap();
475 imm: Immediate::Scalar(
479 self.tcx.sess.target.usize_ty.bit_width().unwrap() as u64
483 layout: self.tcx.layout_of(self.param_env.and(self.tcx.types.usize)).ok()?,
486 trace!("not slice: {:?}", mplace.layout.ty.sty);
490 Rvalue::NullaryOp(NullOp::SizeOf, ty) => {
491 type_size_of(self.tcx, self.param_env, ty).and_then(|n| Some(
493 imm: Immediate::Scalar(
494 Scalar::from_uint(n, self.tcx.data_layout.pointer_size).into()
496 layout: self.tcx.layout_of(self.param_env.and(self.tcx.types.usize)).ok()?,
500 Rvalue::UnaryOp(op, ref arg) => {
501 let def_id = if self.tcx.is_closure(self.source.def_id()) {
502 self.tcx.closure_base_def_id(self.source.def_id())
506 let generics = self.tcx.generics_of(def_id);
507 if generics.requires_monomorphization(self.tcx) {
508 // FIXME: can't handle code with generics
512 let arg = self.eval_operand(arg, source_info)?;
513 let val = self.use_ecx(source_info, |this| {
514 let prim = this.ecx.read_immediate(arg)?;
517 // Need to do overflow check here: For actual CTFE, MIR
518 // generation emits code that does this before calling the op.
519 if prim.to_bits()? == (1 << (prim.layout.size.bits() - 1)) {
520 return err!(Panic(PanicMessage::OverflowNeg));
527 // Now run the actual operation.
528 this.ecx.unary_op(op, prim)
531 imm: Immediate::Scalar(val.into()),
532 layout: place_layout,
536 Rvalue::CheckedBinaryOp(op, ref left, ref right) |
537 Rvalue::BinaryOp(op, ref left, ref right) => {
538 trace!("rvalue binop {:?} for {:?} and {:?}", op, left, right);
539 let right = self.eval_operand(right, source_info)?;
540 let def_id = if self.tcx.is_closure(self.source.def_id()) {
541 self.tcx.closure_base_def_id(self.source.def_id())
545 let generics = self.tcx.generics_of(def_id);
546 if generics.requires_monomorphization(self.tcx) {
547 // FIXME: can't handle code with generics
551 let r = self.use_ecx(source_info, |this| {
552 this.ecx.read_immediate(right)
554 if op == BinOp::Shr || op == BinOp::Shl {
555 let left_ty = left.ty(&self.local_decls, self.tcx);
558 .layout_of(self.param_env.and(left_ty))
562 let right_size = right.layout.size;
563 let r_bits = r.to_scalar().and_then(|r| r.to_bits(right_size));
564 if r_bits.ok().map_or(false, |b| b >= left_bits as u128) {
565 let source_scope_local_data = match self.source_scope_local_data {
566 ClearCrossCrate::Set(ref data) => data,
567 ClearCrossCrate::Clear => return None,
569 let dir = if op == BinOp::Shr {
574 let hir_id = source_scope_local_data[source_info.scope].lint_root;
576 ::rustc::lint::builtin::EXCEEDING_BITSHIFTS,
579 &format!("attempt to shift {} with overflow", dir));
583 let left = self.eval_operand(left, source_info)?;
584 let l = self.use_ecx(source_info, |this| {
585 this.ecx.read_immediate(left)
587 trace!("const evaluating {:?} for {:?} and {:?}", op, left, right);
588 let (val, overflow) = self.use_ecx(source_info, |this| {
589 this.ecx.binary_op(op, l, r)
591 let val = if let Rvalue::CheckedBinaryOp(..) = *rvalue {
592 Immediate::ScalarPair(
594 Scalar::from_bool(overflow).into(),
598 let err = Panic(PanicMessage::Overflow(op)).into();
599 let _: Option<()> = self.use_ecx(source_info, |_| Err(err));
602 Immediate::Scalar(val.into())
606 layout: place_layout,
613 fn operand_from_scalar(&self, scalar: Scalar, ty: Ty<'tcx>, span: Span) -> Operand<'tcx> {
614 Operand::Constant(Box::new(
619 literal: self.tcx.mk_const(*ty::Const::from_scalar(
628 fn replace_with_const(
630 rval: &mut Rvalue<'tcx>,
632 source_info: SourceInfo,
634 trace!("attepting to replace {:?} with {:?}", rval, value);
635 if let Err(e) = self.ecx.validate_operand(
638 // FIXME: is ref tracking too expensive?
639 Some(&mut interpret::RefTracking::empty()),
641 trace!("validation error, attempt failed: {:?}", e);
645 // FIXME> figure out what tho do when try_read_immediate fails
646 let imm = self.use_ecx(source_info, |this| {
647 this.ecx.try_read_immediate(value)
650 if let Some(Ok(imm)) = imm {
652 interpret::Immediate::Scalar(ScalarMaybeUndef::Scalar(scalar)) => {
654 self.operand_from_scalar(scalar, value.layout.ty, source_info.span));
656 Immediate::ScalarPair(
657 ScalarMaybeUndef::Scalar(one),
658 ScalarMaybeUndef::Scalar(two)
660 let ty = &value.layout.ty.sty;
661 if let ty::Tuple(substs) = ty {
662 *rval = Rvalue::Aggregate(
663 Box::new(AggregateKind::Tuple),
665 self.operand_from_scalar(
666 one, substs[0].expect_ty(), source_info.span
668 self.operand_from_scalar(
669 two, substs[1].expect_ty(), source_info.span
680 fn should_const_prop(&self) -> bool {
681 self.tcx.sess.opts.debugging_opts.mir_opt_level >= 2
685 fn type_size_of<'tcx>(
687 param_env: ty::ParamEnv<'tcx>,
690 tcx.layout_of(param_env.and(ty)).ok().map(|layout| layout.size.bytes())
693 struct CanConstProp {
694 can_const_prop: IndexVec<Local, bool>,
695 // false at the beginning, once set, there are not allowed to be any more assignments
696 found_assignment: IndexVec<Local, bool>,
700 /// returns true if `local` can be propagated
701 fn check(body: &Body<'_>) -> IndexVec<Local, bool> {
702 let mut cpv = CanConstProp {
703 can_const_prop: IndexVec::from_elem(true, &body.local_decls),
704 found_assignment: IndexVec::from_elem(false, &body.local_decls),
706 for (local, val) in cpv.can_const_prop.iter_enumerated_mut() {
707 // cannot use args at all
708 // cannot use locals because if x < y { y - x } else { x - y } would
710 // FIXME(oli-obk): lint variables until they are used in a condition
711 // FIXME(oli-obk): lint if return value is constant
712 *val = body.local_kind(local) == LocalKind::Temp;
715 trace!("local {:?} can't be propagated because it's not a temporary", local);
718 cpv.visit_body(body);
723 impl<'tcx> Visitor<'tcx> for CanConstProp {
727 context: PlaceContext,
730 use rustc::mir::visit::PlaceContext::*;
732 // Constants must have at most one write
733 // FIXME(oli-obk): we could be more powerful here, if the multiple writes
734 // only occur in independent execution paths
735 MutatingUse(MutatingUseContext::Store) => if self.found_assignment[local] {
736 trace!("local {:?} can't be propagated because of multiple assignments", local);
737 self.can_const_prop[local] = false;
739 self.found_assignment[local] = true
741 // Reading constants is allowed an arbitrary number of times
742 NonMutatingUse(NonMutatingUseContext::Copy) |
743 NonMutatingUse(NonMutatingUseContext::Move) |
744 NonMutatingUse(NonMutatingUseContext::Inspect) |
745 NonMutatingUse(NonMutatingUseContext::Projection) |
746 MutatingUse(MutatingUseContext::Projection) |
749 trace!("local {:?} can't be propagaged because it's used: {:?}", local, context);
750 self.can_const_prop[local] = false;
756 impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx> {
759 constant: &mut Constant<'tcx>,
762 trace!("visit_constant: {:?}", constant);
763 self.super_constant(constant, location);
764 self.eval_constant(constant);
769 statement: &mut Statement<'tcx>,
772 trace!("visit_statement: {:?}", statement);
773 if let StatementKind::Assign(ref place, ref mut rval) = statement.kind {
774 let place_ty: Ty<'tcx> = place
775 .ty(&self.local_decls, self.tcx)
777 if let Ok(place_layout) = self.tcx.layout_of(self.param_env.and(place_ty)) {
778 if let Some(value) = self.const_prop(rval, place_layout, statement.source_info) {
780 base: PlaceBase::Local(local),
783 trace!("checking whether {:?} can be stored to {:?}", value, local);
784 if self.can_const_prop[local] {
785 trace!("storing {:?} to {:?}", value, local);
786 assert!(self.get_const(local).is_none());
787 self.set_const(local, value);
789 if self.should_const_prop() {
790 self.replace_with_const(
793 statement.source_info,
801 self.super_statement(statement, location);
806 terminator: &mut Terminator<'tcx>,
809 self.super_terminator(terminator, location);
810 let source_info = terminator.source_info;
811 match &mut terminator.kind {
812 TerminatorKind::Assert { expected, ref msg, ref mut cond, .. } => {
813 if let Some(value) = self.eval_operand(&cond, source_info) {
814 trace!("assertion on {:?} should be {:?}", value, expected);
815 let expected = ScalarMaybeUndef::from(Scalar::from_bool(*expected));
816 let value_const = self.ecx.read_scalar(value).unwrap();
817 if expected != value_const {
818 // poison all places this operand references so that further code
819 // doesn't use the invalid value
821 Operand::Move(ref place) | Operand::Copy(ref place) => {
822 if let PlaceBase::Local(local) = place.base {
823 self.remove_const(local);
826 Operand::Constant(_) => {}
828 let span = terminator.source_info.span;
832 .as_local_hir_id(self.source.def_id())
833 .expect("some part of a failing const eval must be local");
834 use rustc::mir::interpret::InterpError::*;
835 let msg = match msg {
836 Panic(PanicMessage::Overflow(_)) |
837 Panic(PanicMessage::OverflowNeg) |
838 Panic(PanicMessage::DivisionByZero) |
839 Panic(PanicMessage::RemainderByZero) =>
840 format!("{:?}", msg),
841 Panic(PanicMessage::BoundsCheck { ref len, ref index }) => {
843 .eval_operand(len, source_info)
844 .expect("len must be const");
845 let len = match self.ecx.read_scalar(len) {
846 Ok(ScalarMaybeUndef::Scalar(Scalar::Raw {
849 other => bug!("const len not primitive: {:?}", other),
852 .eval_operand(index, source_info)
853 .expect("index must be const");
854 let index = match self.ecx.read_scalar(index) {
855 Ok(ScalarMaybeUndef::Scalar(Scalar::Raw {
858 other => bug!("const index not primitive: {:?}", other),
861 "index out of bounds: \
862 the len is {} but the index is {}",
867 // Need proper const propagator for these
871 ::rustc::lint::builtin::CONST_ERR,
877 if self.should_const_prop() {
878 if let ScalarMaybeUndef::Scalar(scalar) = value_const {
879 *cond = self.operand_from_scalar(
889 TerminatorKind::SwitchInt { ref mut discr, switch_ty, .. } => {
890 if self.should_const_prop() {
891 if let Some(value) = self.eval_operand(&discr, source_info) {
892 if let ScalarMaybeUndef::Scalar(scalar) =
893 self.ecx.read_scalar(value).unwrap() {
894 *discr = self.operand_from_scalar(scalar, switch_ty, source_info.span);
899 //none of these have Operands to const-propagate
900 TerminatorKind::Goto { .. } |
901 TerminatorKind::Resume |
902 TerminatorKind::Abort |
903 TerminatorKind::Return |
904 TerminatorKind::Unreachable |
905 TerminatorKind::Drop { .. } |
906 TerminatorKind::DropAndReplace { .. } |
907 TerminatorKind::Yield { .. } |
908 TerminatorKind::GeneratorDrop |
909 TerminatorKind::FalseEdges { .. } |
910 TerminatorKind::FalseUnwind { .. } => { }
911 //FIXME(wesleywiser) Call does have Operands that could be const-propagated
912 TerminatorKind::Call { .. } => { }