@@ -2,7 +2,6 @@ use reexport::*;
22use rustc:: hir:: * ;
33use rustc:: hir:: def_id:: DefId ;
44use rustc:: hir:: map:: Node ;
5- use rustc:: infer;
65use rustc:: lint:: { LintContext , LateContext , Level , Lint } ;
76use rustc:: middle:: cstore;
87use rustc:: session:: Session ;
@@ -274,15 +273,15 @@ pub fn implements_trait<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: ty::Ty<'tcx>,
274273 cx. tcx . populate_implementations_for_trait_if_necessary ( trait_id) ;
275274
276275 let ty = cx. tcx . erase_regions ( & ty) ;
277- let infcx = infer :: new_infer_ctxt ( cx. tcx , & cx . tcx . tables , None , ProjectionMode :: Any ) ;
278- let obligation = traits:: predicate_for_trait_def ( cx . tcx ,
279- traits :: ObligationCause :: dummy ( ) ,
280- trait_id ,
281- 0 ,
282- ty ,
283- ty_params ) ;
284-
285- traits :: SelectionContext :: new ( & infcx ) . evaluate_obligation_conservatively ( & obligation )
276+ cx. tcx . infer_ctxt ( None , None , ProjectionMode :: Any ) . enter ( |infcx| {
277+ let obligation = cx . tcx . predicate_for_trait_def ( traits:: ObligationCause :: dummy ( ) ,
278+ trait_id ,
279+ 0 ,
280+ ty ,
281+ ty_params ) ;
282+
283+ traits :: SelectionContext :: new ( & infcx ) . evaluate_obligation_conservatively ( & obligation )
284+ } )
286285}
287286
288287/// Match an `Expr` against a chain of methods, and return the matched `Expr`s.
@@ -809,10 +808,11 @@ pub fn return_ty<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, fn_item: NodeId) -> Optio
809808// not for type parameters.
810809pub fn same_tys < ' a , ' tcx > ( cx : & LateContext < ' a , ' tcx > , a : ty:: Ty < ' tcx > , b : ty:: Ty < ' tcx > , parameter_item : NodeId ) -> bool {
811810 let parameter_env = ty:: ParameterEnvironment :: for_item ( cx. tcx , parameter_item) ;
812- let infcx = infer:: new_infer_ctxt ( cx. tcx , & cx. tcx . tables , Some ( parameter_env) , ProjectionMode :: Any ) ;
813- let new_a = a. subst ( infcx. tcx , & infcx. parameter_environment . free_substs ) ;
814- let new_b = b. subst ( infcx. tcx , & infcx. parameter_environment . free_substs ) ;
815- infcx. can_equate ( & new_a, & new_b) . is_ok ( )
811+ cx. tcx . infer_ctxt ( None , Some ( parameter_env) , ProjectionMode :: Any ) . enter ( |infcx| {
812+ let new_a = a. subst ( infcx. tcx , & infcx. parameter_environment . free_substs ) ;
813+ let new_b = b. subst ( infcx. tcx , & infcx. parameter_environment . free_substs ) ;
814+ infcx. can_equate ( & new_a, & new_b) . is_ok ( )
815+ } )
816816}
817817
818818/// Recover the essential nodes of a desugared for loop:
0 commit comments