@@ -25,7 +25,7 @@ use rustc_index::{Idx, IndexSlice, IndexVec};
2525use std:: cell:: Cell ;
2626use std:: { cmp, iter, mem} ;
2727
28- use crate :: transform:: check_consts:: { qualifs, ConstCx } ;
28+ use rustc_const_eval :: transform:: check_consts:: { qualifs, ConstCx } ;
2929
3030/// A `MirPass` for promotion.
3131///
@@ -64,7 +64,7 @@ impl<'tcx> MirPass<'tcx> for PromoteTemps<'tcx> {
6464
6565/// State of a temporary during collection and promotion.
6666#[ derive( Copy , Clone , PartialEq , Eq , Debug ) ]
67- pub enum TempState {
67+ enum TempState {
6868 /// No references to this temp.
6969 Undefined ,
7070 /// One direct assignment and any number of direct uses.
@@ -78,18 +78,11 @@ pub enum TempState {
7878 PromotedOut ,
7979}
8080
81- impl TempState {
82- pub fn is_promotable ( & self ) -> bool {
83- debug ! ( "is_promotable: self={:?}" , self ) ;
84- matches ! ( self , TempState :: Defined { .. } )
85- }
86- }
87-
8881/// A "root candidate" for promotion, which will become the
8982/// returned value in a promoted MIR, unless it's a subset
9083/// of a larger candidate.
9184#[ derive( Copy , Clone , PartialEq , Eq , Debug ) ]
92- pub struct Candidate {
85+ struct Candidate {
9386 location : Location ,
9487}
9588
@@ -162,7 +155,7 @@ impl<'tcx> Visitor<'tcx> for Collector<'_, 'tcx> {
162155 }
163156}
164157
165- pub fn collect_temps_and_candidates < ' tcx > (
158+ fn collect_temps_and_candidates < ' tcx > (
166159 ccx : & ConstCx < ' _ , ' tcx > ,
167160) -> ( IndexVec < Local , TempState > , Vec < Candidate > ) {
168161 let mut collector = Collector {
@@ -676,7 +669,7 @@ impl<'tcx> Validator<'_, 'tcx> {
676669}
677670
678671// FIXME(eddyb) remove the differences for promotability in `static`, `const`, `const fn`.
679- pub fn validate_candidates (
672+ fn validate_candidates (
680673 ccx : & ConstCx < ' _ , ' _ > ,
681674 temps : & mut IndexSlice < Local , TempState > ,
682675 candidates : & [ Candidate ] ,
@@ -930,7 +923,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Promoter<'a, 'tcx> {
930923 }
931924}
932925
933- pub fn promote_candidates < ' tcx > (
926+ fn promote_candidates < ' tcx > (
934927 body : & mut Body < ' tcx > ,
935928 tcx : TyCtxt < ' tcx > ,
936929 mut temps : IndexVec < Local , TempState > ,
0 commit comments