Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Jun 26, 2020
1 parent c035299 commit a560a95
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/librustc_infer/infer/combine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,22 +652,23 @@ impl TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
debug!("generalize: consts c={:?}", c);
match c.val {
ty::ConstKind::Infer(InferConst::Var(vid)) => {
let mut inner = self.infcx.inner.borrow_mut();
let variable_table = &mut inner.const_unification_table();
let var_value = variable_table.probe_value(vid);
let var_value =
self.infcx.inner.borrow_mut().const_unification_table().probe_value(vid);
match var_value.val {
ConstVariableValue::Known { value: u } => {
drop(inner);
self.relate(&u, &u)
}
ConstVariableValue::Known { value: u } => self.relate(&u, &u),
ConstVariableValue::Unknown { universe } => {
if self.for_universe.can_name(universe) {
Ok(c)
} else {
let new_var_id = variable_table.new_key(ConstVarValue {
origin: var_value.origin,
val: ConstVariableValue::Unknown { universe: self.for_universe },
});
let new_var_id =
self.infcx.inner.borrow_mut().const_unification_table().new_key(
ConstVarValue {
origin: var_value.origin,
val: ConstVariableValue::Unknown {
universe: self.for_universe,
},
},
);
Ok(self.tcx().mk_const_var(new_var_id, c.ty))
}
}
Expand Down

0 comments on commit a560a95

Please sign in to comment.