@@ -95,7 +95,7 @@ use syntax::codemap::{self, Pos, Span};
95
95
use syntax:: parse:: token;
96
96
use syntax:: ptr:: P ;
97
97
98
- impl < ' a , ' tcx > TyCtxt < ' a , ' tcx , ' tcx > {
98
+ impl < ' a , ' gcx , ' tcx > TyCtxt < ' a , ' gcx , ' tcx > {
99
99
pub fn note_and_explain_region ( self ,
100
100
err : & mut DiagnosticBuilder ,
101
101
prefix : & str ,
@@ -112,9 +112,9 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
112
112
}
113
113
}
114
114
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 > ) {
118
118
let lo = tcx. sess . codemap ( ) . lookup_char_pos_adj ( span. lo ) ;
119
119
( format ! ( "the {} at {}:{}" , heading, lo. line, lo. col. to_usize( ) ) ,
120
120
Some ( span) )
@@ -228,83 +228,9 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
228
228
}
229
229
}
230
230
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 > > ) {
308
234
debug ! ( "report_region_errors(): {} errors to start" , errors. len( ) ) ;
309
235
310
236
// 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> {
475
401
}
476
402
}
477
403
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 > {
482
408
debug ! ( "free_regions_from_same_fn(sub={:?}, sup={:?})" , sub, sup) ;
483
409
let ( scope_id, fr1, fr2) = match ( sub, sup) {
484
410
( ReFree ( fr1) , ReFree ( fr2) ) => {
@@ -620,10 +546,10 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx, 'tcx> {
620
546
}
621
547
}
622
548
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 > {
627
553
let span = trace. origin . span ( ) ;
628
554
let mut err = self . report_type_error ( trace, terr) ;
629
555
self . tcx . note_and_explain_type_err ( & mut err, terr, span) ;
@@ -1109,8 +1035,8 @@ struct RebuildPathInfo<'a> {
1109
1035
region_names : & ' a HashSet < ast:: Name >
1110
1036
}
1111
1037
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 > ,
1114
1040
fn_decl : & ' a hir:: FnDecl ,
1115
1041
expl_self_opt : Option < & ' a hir:: ExplicitSelf_ > ,
1116
1042
generics : & ' a hir:: Generics ,
@@ -1125,14 +1051,14 @@ enum FreshOrKept {
1125
1051
Kept
1126
1052
}
1127
1053
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 > ,
1130
1056
fn_decl : & ' a hir:: FnDecl ,
1131
1057
expl_self_opt : Option < & ' a hir:: ExplicitSelf_ > ,
1132
1058
generics : & ' a hir:: Generics ,
1133
1059
same_regions : & ' a [ SameRegions ] ,
1134
1060
life_giver : & ' a LifeGiver )
1135
- -> Rebuilder < ' a , ' tcx > {
1061
+ -> Rebuilder < ' a , ' gcx , ' tcx > {
1136
1062
Rebuilder {
1137
1063
tcx : tcx,
1138
1064
fn_decl : fn_decl,
@@ -1642,7 +1568,7 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> {
1642
1568
}
1643
1569
}
1644
1570
1645
- impl < ' a , ' tcx > ErrorReportingHelpers < ' tcx > for InferCtxt < ' a , ' tcx , ' tcx > {
1571
+ impl < ' a , ' gcx , ' tcx > InferCtxt < ' a , ' gcx , ' tcx > {
1646
1572
fn give_expl_lifetime_param ( & self ,
1647
1573
err : & mut DiagnosticBuilder ,
1648
1574
decl : & hir:: FnDecl ,
@@ -1905,34 +1831,34 @@ impl<'a, 'tcx> ErrorReportingHelpers<'tcx> for InferCtxt<'a, 'tcx, 'tcx> {
1905
1831
}
1906
1832
1907
1833
pub 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 ;
1909
1835
}
1910
1836
1911
1837
impl < ' 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 > {
1913
1839
infcx. resolve_type_vars_if_possible ( self )
1914
1840
}
1915
1841
}
1916
1842
1917
1843
impl < ' 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 > {
1920
1846
infcx. resolve_type_vars_if_possible ( self )
1921
1847
}
1922
1848
}
1923
1849
1924
1850
impl < ' 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 >
1928
1854
{
1929
1855
infcx. resolve_type_vars_if_possible ( self )
1930
1856
}
1931
1857
}
1932
1858
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 > {
1936
1862
let mut taken = Vec :: new ( ) ;
1937
1863
let parent = tcx. map . get_parent ( scope_id) ;
1938
1864
let method_id_opt = match tcx. map . find ( parent) {
0 commit comments