Fix relations
This commit is contained in:
parent
8d90f442ca
commit
0b5ce54bc2
9 changed files with 25 additions and 25 deletions
|
@ -1930,7 +1930,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
struct SameTypeModuloInfer<'a, 'tcx>(&'a InferCtxt<'tcx>);
|
||||
|
||||
impl<'tcx> TypeRelation<TyCtxt<'tcx>> for SameTypeModuloInfer<'_, 'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'tcx> {
|
||||
fn cx(&self) -> TyCtxt<'tcx> {
|
||||
self.0.tcx
|
||||
}
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for MatchAgainstHigherRankedOutlives<'tcx>
|
|||
"MatchAgainstHigherRankedOutlives"
|
||||
}
|
||||
|
||||
fn tcx(&self) -> TyCtxt<'tcx> {
|
||||
fn cx(&self) -> TyCtxt<'tcx> {
|
||||
self.tcx
|
||||
}
|
||||
|
||||
|
|
|
@ -372,7 +372,7 @@ impl<'tcx> Generalizer<'_, 'tcx> {
|
|||
|
||||
let is_nested_alias = mem::replace(&mut self.in_alias, true);
|
||||
let result = match self.relate(alias, alias) {
|
||||
Ok(alias) => Ok(alias.to_ty(self.tcx())),
|
||||
Ok(alias) => Ok(alias.to_ty(self.cx())),
|
||||
Err(e) => {
|
||||
if is_nested_alias {
|
||||
return Err(e);
|
||||
|
@ -397,7 +397,7 @@ impl<'tcx> Generalizer<'_, 'tcx> {
|
|||
}
|
||||
|
||||
impl<'tcx> TypeRelation<TyCtxt<'tcx>> for Generalizer<'_, 'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'tcx> {
|
||||
fn cx(&self) -> TyCtxt<'tcx> {
|
||||
self.infcx.tcx
|
||||
}
|
||||
|
||||
|
@ -417,7 +417,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for Generalizer<'_, 'tcx> {
|
|||
// (e.g., #41849).
|
||||
relate::relate_args_invariantly(self, a_arg, b_arg)
|
||||
} else {
|
||||
let tcx = self.tcx();
|
||||
let tcx = self.cx();
|
||||
let opt_variances = tcx.variances_of(item_def_id);
|
||||
relate::relate_args_with_variances(
|
||||
self,
|
||||
|
@ -525,7 +525,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for Generalizer<'_, 'tcx> {
|
|||
}
|
||||
|
||||
debug!("replacing original vid={:?} with new={:?}", vid, new_var_id);
|
||||
Ok(Ty::new_var(self.tcx(), new_var_id))
|
||||
Ok(Ty::new_var(self.cx(), new_var_id))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -654,7 +654,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for Generalizer<'_, 'tcx> {
|
|||
{
|
||||
variable_table.union(vid, new_var_id);
|
||||
}
|
||||
Ok(ty::Const::new_var(self.tcx(), new_var_id))
|
||||
Ok(ty::Const::new_var(self.cx(), new_var_id))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -672,7 +672,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for Generalizer<'_, 'tcx> {
|
|||
args,
|
||||
args,
|
||||
)?;
|
||||
Ok(ty::Const::new_unevaluated(self.tcx(), ty::UnevaluatedConst { def, args }))
|
||||
Ok(ty::Const::new_unevaluated(self.cx(), ty::UnevaluatedConst { def, args }))
|
||||
}
|
||||
ty::ConstKind::Placeholder(placeholder) => {
|
||||
if self.for_universe.can_name(placeholder.universe) {
|
||||
|
|
|
@ -27,7 +27,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for Glb<'_, '_, 'tcx> {
|
|||
"Glb"
|
||||
}
|
||||
|
||||
fn tcx(&self) -> TyCtxt<'tcx> {
|
||||
fn cx(&self) -> TyCtxt<'tcx> {
|
||||
self.fields.tcx()
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for Glb<'_, '_, 'tcx> {
|
|||
let origin = SubregionOrigin::Subtype(Box::new(self.fields.trace.clone()));
|
||||
// GLB(&'static u8, &'a u8) == &RegionLUB('static, 'a) u8 == &'static u8
|
||||
Ok(self.fields.infcx.inner.borrow_mut().unwrap_region_constraints().lub_regions(
|
||||
self.tcx(),
|
||||
self.cx(),
|
||||
origin,
|
||||
a,
|
||||
b,
|
||||
|
|
|
@ -27,7 +27,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for Lub<'_, '_, 'tcx> {
|
|||
"Lub"
|
||||
}
|
||||
|
||||
fn tcx(&self) -> TyCtxt<'tcx> {
|
||||
fn cx(&self) -> TyCtxt<'tcx> {
|
||||
self.fields.tcx()
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for Lub<'_, '_, 'tcx> {
|
|||
let origin = SubregionOrigin::Subtype(Box::new(self.fields.trace.clone()));
|
||||
// LUB(&'static u8, &'a u8) == &RegionGLB('static, 'a) u8 == &'a u8
|
||||
Ok(self.fields.infcx.inner.borrow_mut().unwrap_region_constraints().glb_regions(
|
||||
self.tcx(),
|
||||
self.cx(),
|
||||
origin,
|
||||
a,
|
||||
b,
|
||||
|
|
|
@ -32,7 +32,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for TypeRelating<'_, '_, 'tcx> {
|
|||
"TypeRelating"
|
||||
}
|
||||
|
||||
fn tcx(&self) -> TyCtxt<'tcx> {
|
||||
fn cx(&self) -> TyCtxt<'tcx> {
|
||||
self.fields.infcx.tcx
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for TypeRelating<'_, '_, 'tcx> {
|
|||
// (e.g., #41849).
|
||||
relate_args_invariantly(self, a_arg, b_arg)
|
||||
} else {
|
||||
let tcx = self.tcx();
|
||||
let tcx = self.cx();
|
||||
let opt_variances = tcx.variances_of(item_def_id);
|
||||
relate_args_with_variances(self, item_def_id, opt_variances, a_arg, b_arg, false)
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for TypeRelating<'_, '_, 'tcx> {
|
|||
// can't make progress on `A <: B` if both A and B are
|
||||
// type variables, so record an obligation.
|
||||
self.fields.goals.push(Goal::new(
|
||||
self.tcx(),
|
||||
self.cx(),
|
||||
self.fields.param_env,
|
||||
ty::Binder::dummy(ty::PredicateKind::Subtype(ty::SubtypePredicate {
|
||||
a_is_expected: true,
|
||||
|
@ -101,7 +101,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for TypeRelating<'_, '_, 'tcx> {
|
|||
// can't make progress on `B <: A` if both A and B are
|
||||
// type variables, so record an obligation.
|
||||
self.fields.goals.push(Goal::new(
|
||||
self.tcx(),
|
||||
self.cx(),
|
||||
self.fields.param_env,
|
||||
ty::Binder::dummy(ty::PredicateKind::Subtype(ty::SubtypePredicate {
|
||||
a_is_expected: false,
|
||||
|
@ -134,7 +134,7 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for TypeRelating<'_, '_, 'tcx> {
|
|||
|
||||
(&ty::Error(e), _) | (_, &ty::Error(e)) => {
|
||||
infcx.set_tainted_by_errors(e);
|
||||
return Ok(Ty::new_error(self.tcx(), e));
|
||||
return Ok(Ty::new_error(self.cx(), e));
|
||||
}
|
||||
|
||||
(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue