yeet ya fixme into the void

This commit is contained in:
Ellen 2021-02-13 18:11:43 +00:00
parent 68405fdc2e
commit b6144e7a20
4 changed files with 19 additions and 6 deletions

View File

@ -639,6 +639,10 @@ struct QueryTypeRelatingDelegate<'a, 'tcx> {
}
impl<'tcx> TypeRelatingDelegate<'tcx> for QueryTypeRelatingDelegate<'_, 'tcx> {
fn param_env(&self) -> ty::ParamEnv<'tcx> {
self.param_env
}
fn create_next_universe(&mut self) -> ty::UniverseIndex {
self.infcx.create_next_universe()
}

View File

@ -72,6 +72,8 @@ where
}
pub trait TypeRelatingDelegate<'tcx> {
fn param_env(&self) -> ty::ParamEnv<'tcx>;
/// Push a constraint `sup: sub` -- this constraint must be
/// satisfied for the two types to be related. `sub` and `sup` may
/// be regions from the type or new variables created through the
@ -473,9 +475,8 @@ where
self.infcx.tcx
}
// FIXME(oli-obk): not sure how to get the correct ParamEnv
fn param_env(&self) -> ty::ParamEnv<'tcx> {
ty::ParamEnv::empty()
self.delegate.param_env()
}
fn tag(&self) -> &'static str {
@ -819,9 +820,8 @@ where
self.infcx.tcx
}
// FIXME(oli-obk): not sure how to get the correct ParamEnv
fn param_env(&self) -> ty::ParamEnv<'tcx> {
ty::ParamEnv::empty()
self.delegate.param_env()
}
fn tag(&self) -> &'static str {

View File

@ -1098,6 +1098,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
) -> Fallible<()> {
relate_tys::relate_types(
self.infcx,
self.param_env,
a,
v,
b,

View File

@ -18,6 +18,7 @@ use crate::borrow_check::type_check::{BorrowCheckContext, Locations};
/// variables, but not the type `b`.
pub(super) fn relate_types<'tcx>(
infcx: &InferCtxt<'_, 'tcx>,
param_env: ty::ParamEnv<'tcx>,
a: Ty<'tcx>,
v: ty::Variance,
b: Ty<'tcx>,
@ -28,7 +29,7 @@ pub(super) fn relate_types<'tcx>(
debug!("relate_types(a={:?}, v={:?}, b={:?}, locations={:?})", a, v, b, locations);
TypeRelating::new(
infcx,
NllTypeRelatingDelegate::new(infcx, borrowck_context, locations, category),
NllTypeRelatingDelegate::new(infcx, borrowck_context, param_env, locations, category),
v,
)
.relate(a, b)?;
@ -39,6 +40,8 @@ struct NllTypeRelatingDelegate<'me, 'bccx, 'tcx> {
infcx: &'me InferCtxt<'me, 'tcx>,
borrowck_context: Option<&'me mut BorrowCheckContext<'bccx, 'tcx>>,
param_env: ty::ParamEnv<'tcx>,
/// Where (and why) is this relation taking place?
locations: Locations,
@ -50,14 +53,19 @@ impl NllTypeRelatingDelegate<'me, 'bccx, 'tcx> {
fn new(
infcx: &'me InferCtxt<'me, 'tcx>,
borrowck_context: Option<&'me mut BorrowCheckContext<'bccx, 'tcx>>,
param_env: ty::ParamEnv<'tcx>,
locations: Locations,
category: ConstraintCategory,
) -> Self {
Self { infcx, borrowck_context, locations, category }
Self { infcx, borrowck_context, param_env, locations, category }
}
}
impl TypeRelatingDelegate<'tcx> for NllTypeRelatingDelegate<'_, '_, 'tcx> {
fn param_env(&self) -> ty::ParamEnv<'tcx> {
self.param_env
}
fn create_next_universe(&mut self) -> ty::UniverseIndex {
self.infcx.create_next_universe()
}