@@ -5,7 +5,7 @@ use rustc_pattern_analysis::usefulness::{PlaceValidity, UsefulnessReport};
5
5
use rustc_pattern_analysis:: { MatchArm , PatCx , PrivateUninhabitedField } ;
6
6
7
7
/// Sets up `tracing` for easier debugging. Tries to look like the `rustc` setup.
8
- pub fn init_tracing ( ) {
8
+ fn init_tracing ( ) {
9
9
use tracing_subscriber:: Layer ;
10
10
use tracing_subscriber:: layer:: SubscriberExt ;
11
11
use tracing_subscriber:: util:: SubscriberInitExt ;
@@ -24,7 +24,7 @@ pub fn init_tracing() {
24
24
/// A simple set of types.
25
25
#[ allow( dead_code) ]
26
26
#[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
27
- pub enum Ty {
27
+ pub ( super ) enum Ty {
28
28
/// Booleans
29
29
Bool ,
30
30
/// 8-bit unsigned integers
@@ -41,7 +41,7 @@ pub enum Ty {
41
41
42
42
/// The important logic.
43
43
impl Ty {
44
- pub fn sub_tys ( & self , ctor : & Constructor < Cx > ) -> Vec < Self > {
44
+ pub ( super ) fn sub_tys ( & self , ctor : & Constructor < Cx > ) -> Vec < Self > {
45
45
use Constructor :: * ;
46
46
match ( ctor, * self ) {
47
47
( Struct , Ty :: Tuple ( tys) ) => tys. iter ( ) . copied ( ) . collect ( ) ,
@@ -63,7 +63,7 @@ impl Ty {
63
63
}
64
64
}
65
65
66
- pub fn ctor_set ( & self ) -> ConstructorSet < Cx > {
66
+ fn ctor_set ( & self ) -> ConstructorSet < Cx > {
67
67
match * self {
68
68
Ty :: Bool => ConstructorSet :: Bool ,
69
69
Ty :: U8 => ConstructorSet :: Integers {
@@ -104,7 +104,7 @@ impl Ty {
104
104
}
105
105
}
106
106
107
- pub fn write_variant_name (
107
+ fn write_variant_name (
108
108
& self ,
109
109
f : & mut std:: fmt:: Formatter < ' _ > ,
110
110
ctor : & Constructor < Cx > ,
@@ -120,7 +120,7 @@ impl Ty {
120
120
}
121
121
122
122
/// Compute usefulness in our simple context (and set up tracing for easier debugging).
123
- pub fn compute_match_usefulness < ' p > (
123
+ pub ( super ) fn compute_match_usefulness < ' p > (
124
124
arms : & [ MatchArm < ' p , Cx > ] ,
125
125
ty : Ty ,
126
126
scrut_validity : PlaceValidity ,
@@ -137,7 +137,7 @@ pub fn compute_match_usefulness<'p>(
137
137
}
138
138
139
139
#[ derive( Debug ) ]
140
- pub struct Cx ;
140
+ pub ( super ) struct Cx ;
141
141
142
142
/// The context for pattern analysis. Forwards anything interesting to `Ty` methods.
143
143
impl PatCx for Cx {
0 commit comments