@@ -25,18 +25,18 @@ use ty::fold::TypeFolder;
25
25
26
26
// TODO(twk): this is obviously not nice to duplicate like that
27
27
#[ derive( Eq , PartialEq , Hash , Copy , Clone , Debug ) ]
28
- enum RegionTarget < ' tcx > {
28
+ pub enum RegionTarget < ' tcx > {
29
29
Region ( Region < ' tcx > ) ,
30
30
RegionVid ( RegionVid )
31
31
}
32
32
33
33
#[ derive( Default , Debug , Clone ) ]
34
- struct RegionDeps < ' tcx > {
34
+ pub struct RegionDeps < ' tcx > {
35
35
larger : FxHashSet < RegionTarget < ' tcx > > ,
36
36
smaller : FxHashSet < RegionTarget < ' tcx > >
37
37
}
38
38
39
- enum AutoTraitResult {
39
+ pub enum AutoTraitResult {
40
40
ExplicitImpl ,
41
41
PositiveImpl , /*(ty::Generics), TODO(twk)*/
42
42
NegativeImpl ,
@@ -56,7 +56,7 @@ pub struct AutoTraitFinder<'a, 'tcx: 'a> {
56
56
}
57
57
58
58
impl < ' a , ' tcx > AutoTraitFinder < ' a , ' tcx > {
59
- fn find_auto_trait_generics (
59
+ pub fn find_auto_trait_generics (
60
60
& self ,
61
61
did : DefId ,
62
62
trait_did : DefId ,
@@ -277,9 +277,9 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
277
277
// the final synthesized generics: we don't want our generated docs page to contain something
278
278
// like 'T: Copy + Clone', as that's redundant. Therefore, we keep track of a separate
279
279
// 'user_env', which only holds the predicates that will actually be displayed to the user.
280
- fn evaluate_predicates < ' b , ' gcx , ' c > (
280
+ pub fn evaluate_predicates < ' b , ' gcx , ' c > (
281
281
& self ,
282
- infcx : & mut InferCtxt < ' b , ' tcx , ' c > ,
282
+ infcx : & InferCtxt < ' b , ' tcx , ' c > ,
283
283
ty_did : DefId ,
284
284
trait_did : DefId ,
285
285
ty : ty:: Ty < ' c > ,
@@ -387,7 +387,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
387
387
// starting conditions (e.g. user-provided code). For this reason, it's easier
388
388
// to perform the calculations we need on our own, rather than trying to make
389
389
// existing inference/solver code do what we want.
390
- fn handle_lifetimes < ' cx > (
390
+ pub fn handle_lifetimes < ' cx > (
391
391
& self ,
392
392
regions : & RegionConstraintData < ' cx > ,
393
393
names_map : & FxHashMap < String , String > , // TODO(twk): lifetime branding
@@ -533,15 +533,15 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
533
533
lifetime_predicates
534
534
}
535
535
536
- fn region_name ( & self , region : Region ) -> Option < String > {
536
+ pub fn region_name ( & self , region : Region ) -> Option < String > {
537
537
match region {
538
538
& ty:: ReEarlyBound ( r) => Some ( r. name . as_str ( ) . to_string ( ) ) ,
539
539
_ => None ,
540
540
}
541
541
}
542
542
543
543
// TODO(twk): lifetime branding
544
- fn get_lifetime ( & self , region : Region , names_map : & FxHashMap < String , String > ) -> String {
544
+ pub fn get_lifetime ( & self , region : Region , names_map : & FxHashMap < String , String > ) -> String {
545
545
self . region_name ( region)
546
546
. map ( |name| {
547
547
names_map. get ( & name) . unwrap_or_else ( || {
@@ -555,7 +555,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
555
555
556
556
// This is very similar to handle_lifetimes. However, instead of matching ty::Region's
557
557
// to each other, we match ty::RegionVid's to ty::Region's
558
- fn map_vid_to_region < ' cx > (
558
+ pub fn map_vid_to_region < ' cx > (
559
559
& self ,
560
560
regions : & RegionConstraintData < ' cx > ,
561
561
) -> FxHashMap < ty:: RegionVid , ty:: Region < ' cx > > {
@@ -655,7 +655,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
655
655
finished_map
656
656
}
657
657
658
- fn is_of_param ( & self , substs : & Substs ) -> bool {
658
+ pub fn is_of_param ( & self , substs : & Substs ) -> bool {
659
659
if substs. is_noop ( ) {
660
660
return false ;
661
661
}
@@ -667,7 +667,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
667
667
} ;
668
668
}
669
669
670
- fn evaluate_nested_obligations < ' b , ' c , ' d , ' cx ,
670
+ pub fn evaluate_nested_obligations < ' b , ' c , ' d , ' cx ,
671
671
T : Iterator < Item = Obligation < ' cx , ty:: Predicate < ' cx > > > > (
672
672
& self ,
673
673
ty : ty:: Ty ,
@@ -775,7 +775,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
775
775
return true ;
776
776
}
777
777
778
- fn clean_pred < ' c , ' d , ' cx > (
778
+ pub fn clean_pred < ' c , ' d , ' cx > (
779
779
& self ,
780
780
infcx : & InferCtxt < ' c , ' d , ' cx > ,
781
781
p : ty:: Predicate < ' cx > ,
@@ -785,7 +785,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
785
785
}
786
786
787
787
// Replaces all ReVars in a type with ty::Region's, using the provided map
788
- struct RegionReplacer < ' a , ' gcx : ' a + ' tcx , ' tcx : ' a > {
788
+ pub struct RegionReplacer < ' a , ' gcx : ' a + ' tcx , ' tcx : ' a > {
789
789
vid_to_region : & ' a FxHashMap < ty:: RegionVid , ty:: Region < ' tcx > > ,
790
790
tcx : TyCtxt < ' a , ' gcx , ' tcx > ,
791
791
}
0 commit comments