@@ -95,7 +95,7 @@ use syntax::codemap::{self, Pos, Span};
9595use syntax:: parse:: token;
9696use syntax:: ptr:: P ;
9797
98- impl < ' a , ' tcx > TyCtxt < ' a , ' tcx , ' tcx > {
98+ impl < ' a , ' gcx , ' tcx > TyCtxt < ' a , ' gcx , ' tcx > {
9999 pub fn note_and_explain_region ( self ,
100100 err : & mut DiagnosticBuilder ,
101101 prefix : & str ,
@@ -112,9 +112,9 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
112112 }
113113 }
114114
115- fn explain_span < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
116- heading : & str , span : Span )
117- -> ( String , Option < Span > ) {
115+ fn explain_span < ' a , ' gcx , ' tcx > ( tcx : TyCtxt < ' a , ' gcx , ' tcx > ,
116+ heading : & str , span : Span )
117+ -> ( String , Option < Span > ) {
118118 let lo = tcx. sess . codemap ( ) . lookup_char_pos_adj ( span. lo ) ;
119119 ( format ! ( "the {} at {}:{}" , heading, lo. line, lo. col. to_usize( ) ) ,
120120 Some ( span) )
@@ -228,83 +228,9 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
228228 }
229229}
230230
231- pub trait ErrorReporting < ' tcx > {
232- fn report_region_errors ( & self ,
233- errors : & Vec < RegionResolutionError < ' tcx > > ) ;
234-
235- fn process_errors ( & self , errors : & Vec < RegionResolutionError < ' tcx > > )
236- -> Option < Vec < RegionResolutionError < ' tcx > > > ;
237-
238- fn report_type_error ( & self ,
239- trace : TypeTrace < ' tcx > ,
240- terr : & TypeError < ' tcx > )
241- -> DiagnosticBuilder < ' tcx > ;
242-
243- fn check_and_note_conflicting_crates ( & self ,
244- err : & mut DiagnosticBuilder ,
245- terr : & TypeError < ' tcx > ,
246- sp : Span ) ;
247-
248- fn report_and_explain_type_error ( & self ,
249- trace : TypeTrace < ' tcx > ,
250- terr : & TypeError < ' tcx > )
251- -> DiagnosticBuilder < ' tcx > ;
252-
253- fn values_str ( & self , values : & ValuePairs < ' tcx > ) -> Option < ( String , String ) > ;
254-
255- fn expected_found_str < T : fmt:: Display + Resolvable < ' tcx > + TypeFoldable < ' tcx > > (
256- & self ,
257- exp_found : & ty:: error:: ExpectedFound < T > )
258- -> Option < ( String , String ) > ;
259-
260- fn report_concrete_failure ( & self ,
261- origin : SubregionOrigin < ' tcx > ,
262- sub : Region ,
263- sup : Region )
264- -> DiagnosticBuilder < ' tcx > ;
265-
266- fn report_generic_bound_failure ( & self ,
267- origin : SubregionOrigin < ' tcx > ,
268- kind : GenericKind < ' tcx > ,
269- sub : Region ) ;
270-
271- fn report_sub_sup_conflict ( & self ,
272- var_origin : RegionVariableOrigin ,
273- sub_origin : SubregionOrigin < ' tcx > ,
274- sub_region : Region ,
275- sup_origin : SubregionOrigin < ' tcx > ,
276- sup_region : Region ) ;
277-
278- fn report_processed_errors ( & self ,
279- origins : & [ ProcessedErrorOrigin < ' tcx > ] ,
280- same_regions : & [ SameRegions ] ) ;
281-
282- fn give_suggestion ( & self , err : & mut DiagnosticBuilder , same_regions : & [ SameRegions ] ) ;
283- }
284-
285- trait ErrorReportingHelpers < ' tcx > {
286- fn report_inference_failure ( & self ,
287- var_origin : RegionVariableOrigin )
288- -> DiagnosticBuilder < ' tcx > ;
289-
290- fn note_region_origin ( & self ,
291- err : & mut DiagnosticBuilder ,
292- origin : & SubregionOrigin < ' tcx > ) ;
293-
294- fn give_expl_lifetime_param ( & self ,
295- err : & mut DiagnosticBuilder ,
296- decl : & hir:: FnDecl ,
297- unsafety : hir:: Unsafety ,
298- constness : hir:: Constness ,
299- name : ast:: Name ,
300- opt_explicit_self : Option < & hir:: ExplicitSelf_ > ,
301- generics : & hir:: Generics ,
302- span : Span ) ;
303- }
304-
305- impl < ' a , ' tcx > ErrorReporting < ' tcx > for InferCtxt < ' a , ' tcx , ' tcx > {
306- fn report_region_errors ( & self ,
307- errors : & Vec < RegionResolutionError < ' tcx > > ) {
231+ impl < ' a , ' gcx , ' tcx > InferCtxt < ' a , ' gcx , ' tcx > {
232+ pub fn report_region_errors ( & self ,
233+ errors : & Vec < RegionResolutionError < ' tcx > > ) {
308234 debug ! ( "report_region_errors(): {} errors to start" , errors. len( ) ) ;
309235
310236 // try to pre-process the errors, which will group some of them
@@ -475,10 +401,10 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx, 'tcx> {
475401 }
476402 }
477403
478- fn free_regions_from_same_fn < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
479- sub : Region ,
480- sup : Region )
481- -> Option < FreeRegionsFromSameFn > {
404+ fn free_regions_from_same_fn < ' a , ' gcx , ' tcx > ( tcx : TyCtxt < ' a , ' gcx , ' tcx > ,
405+ sub : Region ,
406+ sup : Region )
407+ -> Option < FreeRegionsFromSameFn > {
482408 debug ! ( "free_regions_from_same_fn(sub={:?}, sup={:?})" , sub, sup) ;
483409 let ( scope_id, fr1, fr2) = match ( sub, sup) {
484410 ( ReFree ( fr1) , ReFree ( fr2) ) => {
@@ -620,10 +546,10 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx, 'tcx> {
620546 }
621547 }
622548
623- fn report_and_explain_type_error ( & self ,
624- trace : TypeTrace < ' tcx > ,
625- terr : & TypeError < ' tcx > )
626- -> DiagnosticBuilder < ' tcx > {
549+ pub fn report_and_explain_type_error ( & self ,
550+ trace : TypeTrace < ' tcx > ,
551+ terr : & TypeError < ' tcx > )
552+ -> DiagnosticBuilder < ' tcx > {
627553 let span = trace. origin . span ( ) ;
628554 let mut err = self . report_type_error ( trace, terr) ;
629555 self . tcx . note_and_explain_type_err ( & mut err, terr, span) ;
@@ -1109,8 +1035,8 @@ struct RebuildPathInfo<'a> {
11091035 region_names : & ' a HashSet < ast:: Name >
11101036}
11111037
1112- struct Rebuilder < ' a , ' tcx : ' a > {
1113- tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
1038+ struct Rebuilder < ' a , ' gcx : ' a + ' tcx , ' tcx : ' a > {
1039+ tcx : TyCtxt < ' a , ' gcx , ' tcx > ,
11141040 fn_decl : & ' a hir:: FnDecl ,
11151041 expl_self_opt : Option < & ' a hir:: ExplicitSelf_ > ,
11161042 generics : & ' a hir:: Generics ,
@@ -1125,14 +1051,14 @@ enum FreshOrKept {
11251051 Kept
11261052}
11271053
1128- impl < ' a , ' tcx > Rebuilder < ' a , ' tcx > {
1129- fn new ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
1054+ impl < ' a , ' gcx , ' tcx > Rebuilder < ' a , ' gcx , ' tcx > {
1055+ fn new ( tcx : TyCtxt < ' a , ' gcx , ' tcx > ,
11301056 fn_decl : & ' a hir:: FnDecl ,
11311057 expl_self_opt : Option < & ' a hir:: ExplicitSelf_ > ,
11321058 generics : & ' a hir:: Generics ,
11331059 same_regions : & ' a [ SameRegions ] ,
11341060 life_giver : & ' a LifeGiver )
1135- -> Rebuilder < ' a , ' tcx > {
1061+ -> Rebuilder < ' a , ' gcx , ' tcx > {
11361062 Rebuilder {
11371063 tcx : tcx,
11381064 fn_decl : fn_decl,
@@ -1642,7 +1568,7 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> {
16421568 }
16431569}
16441570
1645- impl < ' a , ' tcx > ErrorReportingHelpers < ' tcx > for InferCtxt < ' a , ' tcx , ' tcx > {
1571+ impl < ' a , ' gcx , ' tcx > InferCtxt < ' a , ' gcx , ' tcx > {
16461572 fn give_expl_lifetime_param ( & self ,
16471573 err : & mut DiagnosticBuilder ,
16481574 decl : & hir:: FnDecl ,
@@ -1905,34 +1831,34 @@ impl<'a, 'tcx> ErrorReportingHelpers<'tcx> for InferCtxt<'a, 'tcx, 'tcx> {
19051831}
19061832
19071833pub trait Resolvable < ' tcx > {
1908- fn resolve < ' a > ( & self , infcx : & InferCtxt < ' a , ' tcx , ' tcx > ) -> Self ;
1834+ fn resolve < ' a , ' gcx > ( & self , infcx : & InferCtxt < ' a , ' gcx , ' tcx > ) -> Self ;
19091835}
19101836
19111837impl < ' tcx > Resolvable < ' tcx > for Ty < ' tcx > {
1912- fn resolve < ' a > ( & self , infcx : & InferCtxt < ' a , ' tcx , ' tcx > ) -> Ty < ' tcx > {
1838+ fn resolve < ' a , ' gcx > ( & self , infcx : & InferCtxt < ' a , ' gcx , ' tcx > ) -> Ty < ' tcx > {
19131839 infcx. resolve_type_vars_if_possible ( self )
19141840 }
19151841}
19161842
19171843impl < ' tcx > Resolvable < ' tcx > for ty:: TraitRef < ' tcx > {
1918- fn resolve < ' a > ( & self , infcx : & InferCtxt < ' a , ' tcx , ' tcx > )
1919- -> ty:: TraitRef < ' tcx > {
1844+ fn resolve < ' a , ' gcx > ( & self , infcx : & InferCtxt < ' a , ' gcx , ' tcx > )
1845+ -> ty:: TraitRef < ' tcx > {
19201846 infcx. resolve_type_vars_if_possible ( self )
19211847 }
19221848}
19231849
19241850impl < ' tcx > Resolvable < ' tcx > for ty:: PolyTraitRef < ' tcx > {
1925- fn resolve < ' a > ( & self ,
1926- infcx : & InferCtxt < ' a , ' tcx , ' tcx > )
1927- -> ty:: PolyTraitRef < ' tcx >
1851+ fn resolve < ' a , ' gcx > ( & self ,
1852+ infcx : & InferCtxt < ' a , ' gcx , ' tcx > )
1853+ -> ty:: PolyTraitRef < ' tcx >
19281854 {
19291855 infcx. resolve_type_vars_if_possible ( self )
19301856 }
19311857}
19321858
1933- fn lifetimes_in_scope < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
1934- scope_id : ast:: NodeId )
1935- -> Vec < hir:: LifetimeDef > {
1859+ fn lifetimes_in_scope < ' a , ' gcx , ' tcx > ( tcx : TyCtxt < ' a , ' gcx , ' tcx > ,
1860+ scope_id : ast:: NodeId )
1861+ -> Vec < hir:: LifetimeDef > {
19361862 let mut taken = Vec :: new ( ) ;
19371863 let parent = tcx. map . get_parent ( scope_id) ;
19381864 let method_id_opt = match tcx. map . find ( parent) {
0 commit comments