@@ -25,7 +25,7 @@ use rustc_index::{Idx, IndexSlice, IndexVec};
25
25
use std:: cell:: Cell ;
26
26
use std:: { cmp, iter, mem} ;
27
27
28
- use crate :: transform:: check_consts:: { qualifs, ConstCx } ;
28
+ use rustc_const_eval :: transform:: check_consts:: { qualifs, ConstCx } ;
29
29
30
30
/// A `MirPass` for promotion.
31
31
///
@@ -64,7 +64,7 @@ impl<'tcx> MirPass<'tcx> for PromoteTemps<'tcx> {
64
64
65
65
/// State of a temporary during collection and promotion.
66
66
#[ derive( Copy , Clone , PartialEq , Eq , Debug ) ]
67
- pub enum TempState {
67
+ enum TempState {
68
68
/// No references to this temp.
69
69
Undefined ,
70
70
/// One direct assignment and any number of direct uses.
@@ -78,18 +78,11 @@ pub enum TempState {
78
78
PromotedOut ,
79
79
}
80
80
81
- impl TempState {
82
- pub fn is_promotable ( & self ) -> bool {
83
- debug ! ( "is_promotable: self={:?}" , self ) ;
84
- matches ! ( self , TempState :: Defined { .. } )
85
- }
86
- }
87
-
88
81
/// A "root candidate" for promotion, which will become the
89
82
/// returned value in a promoted MIR, unless it's a subset
90
83
/// of a larger candidate.
91
84
#[ derive( Copy , Clone , PartialEq , Eq , Debug ) ]
92
- pub struct Candidate {
85
+ struct Candidate {
93
86
location : Location ,
94
87
}
95
88
@@ -162,7 +155,7 @@ impl<'tcx> Visitor<'tcx> for Collector<'_, 'tcx> {
162
155
}
163
156
}
164
157
165
- pub fn collect_temps_and_candidates < ' tcx > (
158
+ fn collect_temps_and_candidates < ' tcx > (
166
159
ccx : & ConstCx < ' _ , ' tcx > ,
167
160
) -> ( IndexVec < Local , TempState > , Vec < Candidate > ) {
168
161
let mut collector = Collector {
@@ -676,7 +669,7 @@ impl<'tcx> Validator<'_, 'tcx> {
676
669
}
677
670
678
671
// FIXME(eddyb) remove the differences for promotability in `static`, `const`, `const fn`.
679
- pub fn validate_candidates (
672
+ fn validate_candidates (
680
673
ccx : & ConstCx < ' _ , ' _ > ,
681
674
temps : & mut IndexSlice < Local , TempState > ,
682
675
candidates : & [ Candidate ] ,
@@ -930,7 +923,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Promoter<'a, 'tcx> {
930
923
}
931
924
}
932
925
933
- pub fn promote_candidates < ' tcx > (
926
+ fn promote_candidates < ' tcx > (
934
927
body : & mut Body < ' tcx > ,
935
928
tcx : TyCtxt < ' tcx > ,
936
929
mut temps : IndexVec < Local , TempState > ,
0 commit comments