Clean up patch

This commit is contained in:
Jared Roesch 2015-06-30 02:39:47 -07:00
parent 9faae6a5ca
commit 7a8f83a6e5
6 changed files with 14 additions and 33 deletions

View file

@ -1386,16 +1386,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
.subst(self.tcx, substs);
if self.normalize {
// NOTE: this flag is currently *always* set to false, we are slowly folding
// normalization into this trait and will come back to remove this in the near
// future.
// code from NormalizingClosureTyper:
// the substitutions in `substs` are already monomorphized,
// but we still must normalize associated types
// normalize_associated_type(self.param_env.tcx, &closure_ty)
normalize_associated_type(&self.tcx, &closure_ty)
// panic!("see issue 26597: fufillment context refactor must occur")
} else {
closure_ty
}
@ -1409,15 +1400,6 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
let result = ty::ctxt::closure_upvars(self, def_id, substs);
if self.normalize {
// NOTE: this flag is currently *always* set to false, we are slowly folding
// normalization into this trait and will come back to remove this in the near
// future.
// code from NormalizingClosureTyper:
// the substitutions in `substs` are already monomorphized,
// but we still must normalize associated types
// monomorphize::normalize_associated_type(self.param_env.tcx, &result)
// panic!("see issue 26597: fufillment context refactor must occur")
normalize_associated_type(&self.tcx, &result)
} else {
result

View file

@ -257,7 +257,6 @@ impl ast_node for ast::Pat {
#[derive(Copy, Clone)]
pub struct MemCategorizationContext<'t, 'a: 't, 'tcx : 'a> {
pub typer: &'t infer::InferCtxt<'a, 'tcx>,
// pub monomorphize: bool,
}
pub type McResult<T> = Result<T, ()>;

View file

@ -436,17 +436,20 @@ pub fn fully_normalize<'a,'tcx,T>(infcx: &InferCtxt<'a,'tcx>,
debug!("normalize_param_env(value={:?})", value);
let mut selcx = &mut SelectionContext::new(infcx);
// FIXME (@jroesch): I'm not sure if this is a bug or not, needs
// further investigation. It appears that by reusing the fulfillment_cx
// here we incur more obligations and later trip an asssertion on
// regionck.rs line 337. The two possibilities I see is that
// normalization is not actually fully happening and we
// have a bug else where or that we are adding a duplicate
// bound into the list causing its size to change. I think
// we should probably land this refactor and then come
// FIXME (@jroesch):
// I'm not sure if this is a bug or not, needs further investigation.
// It appears that by reusing the fulfillment_cx here we incur more
// obligations and later trip an asssertion on regionck.rs line 337.
//
// The two possibilities I see is:
// - normalization is not actually fully happening and we
// have a bug else where
// - we are adding a duplicate bound into the list causing
// its size to change.
//
// I think we should probably land this refactor and then come
// back to this is a follow-up patch.
let mut fulfill_cx = FulfillmentContext::new(false);
// let mut fulfill_cx = infcx.fulfillment_cx.borrow_mut();
let Normalized { value: normalized_value, obligations } =
project::normalize(selcx, cause, value);
@ -456,6 +459,7 @@ pub fn fully_normalize<'a,'tcx,T>(infcx: &InferCtxt<'a,'tcx>,
for obligation in obligations {
fulfill_cx.register_predicate_obligation(selcx.infcx(), obligation);
}
try!(fulfill_cx.select_all_or_error(infcx));
let resolved_value = infcx.resolve_type_vars_if_possible(&normalized_value);
debug!("normalize_param_env: resolved_value={:?}", resolved_value);