remove implicator

it is pre-RFC1214 junk
This commit is contained in:
Ariel Ben-Yehuda 2016-01-25 15:17:31 +02:00
parent 0486e12ad0
commit e0fd9c3b00
3 changed files with 1 additions and 503 deletions

View file

@ -86,7 +86,6 @@ use astconv::AstConv;
use check::dropck;
use check::FnCtxt;
use middle::free_region::FreeRegionMap;
use middle::implicator::{self, Implication};
use middle::mem_categorization as mc;
use middle::mem_categorization::Categorization;
use middle::region::{self, CodeExtent};
@ -365,12 +364,7 @@ impl<'a, 'tcx> Rcx<'a, 'tcx> {
r_o, r_o.cause);
let sup_type = self.resolve_type(r_o.sup_type);
let origin = self.code_to_origin(r_o.cause.span, sup_type, &r_o.cause.code);
if r_o.sub_region != ty::ReEmpty {
type_must_outlive(self, origin, sup_type, r_o.sub_region);
} else {
self.visit_old_school_wf(node_id, sup_type, origin);
}
type_must_outlive(self, origin, sup_type, r_o.sub_region);
}
// Processing the region obligations should not cause the list to grow further:
@ -378,47 +372,6 @@ impl<'a, 'tcx> Rcx<'a, 'tcx> {
self.fcx.inh.infcx.fulfillment_cx.borrow().region_obligations(node_id).len());
}
fn visit_old_school_wf(&mut self,
body_id: ast::NodeId,
ty: Ty<'tcx>,
origin: infer::SubregionOrigin<'tcx>) {
// As a weird kind of hack, we use a region of empty as a signal
// to mean "old-school WF rules". The only reason the old-school
// WF rules are not encoded using WF is that this leads to errors,
// and we want to phase those in gradually.
// FIXME(#27579) remove this weird special case once we phase in new WF rules completely
let implications = implicator::implications(self.infcx(),
body_id,
ty,
ty::ReEmpty,
origin.span());
let origin_for_ty = |ty: Option<Ty<'tcx>>| match ty {
None => origin.clone(),
Some(ty) => infer::ReferenceOutlivesReferent(ty, origin.span()),
};
for implication in implications {
match implication {
Implication::RegionSubRegion(ty, r1, r2) => {
self.fcx.mk_subr(origin_for_ty(ty), r1, r2);
}
Implication::RegionSubGeneric(ty, r1, GenericKind::Param(param_ty)) => {
param_ty_must_outlive(self, origin_for_ty(ty), r1, param_ty);
}
Implication::RegionSubGeneric(ty, r1, GenericKind::Projection(proj_ty)) => {
projection_must_outlive(self, origin_for_ty(ty), r1, proj_ty);
}
Implication::Predicate(def_id, predicate) => {
let cause = traits::ObligationCause::new(origin.span(),
body_id,
traits::ItemObligation(def_id));
let obligation = traits::Obligation::new(cause, predicate);
self.fcx.register_predicate(obligation);
}
}
}
}
fn code_to_origin(&self,
span: Span,
sup_type: Ty<'tcx>,