MIR visitor: constant -> const_operand
This commit is contained in:
parent
921645c737
commit
ed1618dedc
11 changed files with 28 additions and 24 deletions
|
@ -706,9 +706,9 @@ impl<'tcx> Visitor<'tcx> for ConstPropagator<'_, 'tcx> {
|
|||
self.super_operand(operand, location);
|
||||
}
|
||||
|
||||
fn visit_constant(&mut self, constant: &ConstOperand<'tcx>, location: Location) {
|
||||
trace!("visit_constant: {:?}", constant);
|
||||
self.super_constant(constant, location);
|
||||
fn visit_const_operand(&mut self, constant: &ConstOperand<'tcx>, location: Location) {
|
||||
trace!("visit_const_operand: {:?}", constant);
|
||||
self.super_const_operand(constant, location);
|
||||
self.eval_constant(constant);
|
||||
}
|
||||
|
||||
|
|
|
@ -956,7 +956,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Promoter<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
fn visit_constant(&mut self, constant: &mut ConstOperand<'tcx>, _location: Location) {
|
||||
fn visit_const_operand(&mut self, constant: &mut ConstOperand<'tcx>, _location: Location) {
|
||||
if constant.const_.is_required_const() {
|
||||
self.promoted.required_consts.push(*constant);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ impl<'a, 'tcx> RequiredConstsVisitor<'a, 'tcx> {
|
|||
}
|
||||
|
||||
impl<'tcx> Visitor<'tcx> for RequiredConstsVisitor<'_, 'tcx> {
|
||||
fn visit_constant(&mut self, constant: &ConstOperand<'tcx>, _: Location) {
|
||||
fn visit_const_operand(&mut self, constant: &ConstOperand<'tcx>, _: Location) {
|
||||
if constant.const_.is_required_const() {
|
||||
self.required_consts.push(*constant);
|
||||
}
|
||||
|
|
|
@ -49,14 +49,14 @@ impl<'tcx> MutVisitor<'tcx> for RevealAllVisitor<'tcx> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn visit_constant(&mut self, constant: &mut ConstOperand<'tcx>, location: Location) {
|
||||
fn visit_const_operand(&mut self, constant: &mut ConstOperand<'tcx>, location: Location) {
|
||||
// We have to use `try_normalize_erasing_regions` here, since it's
|
||||
// possible that we visit impossible-to-satisfy where clauses here,
|
||||
// see #91745
|
||||
if let Ok(c) = self.tcx.try_normalize_erasing_regions(self.param_env, constant.const_) {
|
||||
constant.const_ = c;
|
||||
}
|
||||
self.super_constant(constant, location);
|
||||
self.super_const_operand(constant, location);
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue