1010
1111// #![warn(deprecated_mode)]
1212
13- pub use self :: WfConstraint :: * ;
14-
1513use astconv:: object_region_bounds;
1614use middle:: infer:: GenericKind ;
1715use middle:: subst:: { ParamSpace , Subst , Substs } ;
@@ -24,37 +22,37 @@ use util::ppaux::Repr;
2422
2523// Helper functions related to manipulating region types.
2624
27- pub enum WfConstraint < ' tcx > {
28- RegionSubRegionConstraint ( Option < Ty < ' tcx > > , ty:: Region , ty:: Region ) ,
29- RegionSubGenericConstraint ( Option < Ty < ' tcx > > , ty:: Region , GenericKind < ' tcx > ) ,
25+ pub enum Implication < ' tcx > {
26+ RegionSubRegion ( Option < Ty < ' tcx > > , ty:: Region , ty:: Region ) ,
27+ RegionSubGeneric ( Option < Ty < ' tcx > > , ty:: Region , GenericKind < ' tcx > ) ,
3028}
3129
32- struct Wf < ' a , ' tcx : ' a > {
30+ struct Implicator < ' a , ' tcx : ' a > {
3331 tcx : & ' a ty:: ctxt < ' tcx > ,
3432 stack : Vec < ( ty:: Region , Option < Ty < ' tcx > > ) > ,
35- out : Vec < WfConstraint < ' tcx > > ,
33+ out : Vec < Implication < ' tcx > > ,
3634}
3735
3836/// This routine computes the well-formedness constraints that must hold for the type `ty` to
3937/// appear in a context with lifetime `outer_region`
40- pub fn region_wf_constraints < ' tcx > (
38+ pub fn implications < ' tcx > (
4139 tcx : & ty:: ctxt < ' tcx > ,
4240 ty : Ty < ' tcx > ,
4341 outer_region : ty:: Region )
44- -> Vec < WfConstraint < ' tcx > >
42+ -> Vec < Implication < ' tcx > >
4543{
4644 let mut stack = Vec :: new ( ) ;
4745 stack. push ( ( outer_region, None ) ) ;
48- let mut wf = Wf { tcx : tcx,
46+ let mut wf = Implicator { tcx : tcx,
4947 stack : stack,
5048 out : Vec :: new ( ) } ;
5149 wf. accumulate_from_ty ( ty) ;
5250 wf. out
5351}
5452
55- impl < ' a , ' tcx > Wf < ' a , ' tcx > {
53+ impl < ' a , ' tcx > Implicator < ' a , ' tcx > {
5654 fn accumulate_from_ty ( & mut self , ty : Ty < ' tcx > ) {
57- debug ! ( "Wf:: accumulate_from_ty(ty={})" ,
55+ debug ! ( "accumulate_from_ty(ty={})" ,
5856 ty. repr( self . tcx) ) ;
5957
6058 match ty. sty {
@@ -197,7 +195,7 @@ impl<'a, 'tcx> Wf<'a, 'tcx> {
197195 opt_ty : Option < Ty < ' tcx > > ,
198196 r_a : ty:: Region ,
199197 r_b : ty:: Region ) {
200- self . out . push ( RegionSubRegionConstraint ( opt_ty, r_a, r_b) ) ;
198+ self . out . push ( Implication :: RegionSubRegion ( opt_ty, r_a, r_b) ) ;
201199 }
202200
203201 /// Pushes a constraint that `param_ty` must outlive the top region on the stack.
@@ -211,7 +209,7 @@ impl<'a, 'tcx> Wf<'a, 'tcx> {
211209 fn push_projection_constraint_from_top ( & mut self ,
212210 projection_ty : & ty:: ProjectionTy < ' tcx > ) {
213211 let & ( region, opt_ty) = self . stack . last ( ) . unwrap ( ) ;
214- self . out . push ( RegionSubGenericConstraint (
212+ self . out . push ( Implication :: RegionSubGeneric (
215213 opt_ty, region, GenericKind :: Projection ( projection_ty. clone ( ) ) ) ) ;
216214 }
217215
@@ -220,7 +218,7 @@ impl<'a, 'tcx> Wf<'a, 'tcx> {
220218 region : ty:: Region ,
221219 opt_ty : Option < Ty < ' tcx > > ,
222220 param_ty : ty:: ParamTy ) {
223- self . out . push ( RegionSubGenericConstraint (
221+ self . out . push ( Implication :: RegionSubGeneric (
224222 opt_ty, region, GenericKind :: Param ( param_ty) ) ) ;
225223 }
226224
@@ -372,22 +370,22 @@ impl<'a, 'tcx> Wf<'a, 'tcx> {
372370 for & r_d in & required_region_bounds {
373371 // Each of these is an instance of the `'c <= 'b`
374372 // constraint above
375- self . out . push ( RegionSubRegionConstraint ( Some ( ty) , r_d, r_c) ) ;
373+ self . out . push ( Implication :: RegionSubRegion ( Some ( ty) , r_d, r_c) ) ;
376374 }
377375 }
378376}
379377
380- impl < ' tcx > Repr < ' tcx > for WfConstraint < ' tcx > {
378+ impl < ' tcx > Repr < ' tcx > for Implication < ' tcx > {
381379 fn repr ( & self , tcx : & ty:: ctxt < ' tcx > ) -> String {
382380 match * self {
383- RegionSubRegionConstraint ( _, ref r_a, ref r_b) => {
384- format ! ( "RegionSubRegionConstraint ({}, {})" ,
381+ Implication :: RegionSubRegion ( _, ref r_a, ref r_b) => {
382+ format ! ( "RegionSubRegion ({}, {})" ,
385383 r_a. repr( tcx) ,
386384 r_b. repr( tcx) )
387385 }
388386
389- RegionSubGenericConstraint ( _, ref r, ref p) => {
390- format ! ( "RegionSubGenericConstraint ({}, {})" ,
387+ Implication :: RegionSubGeneric ( _, ref r, ref p) => {
388+ format ! ( "RegionSubGeneric ({}, {})" ,
391389 r. repr( tcx) ,
392390 p. repr( tcx) )
393391 }
0 commit comments