@@ -15,7 +15,6 @@ use rustc::ty::cast::CastTy;
1515use rustc:: ty:: query:: Providers ;
1616use rustc:: mir:: * ;
1717use rustc:: mir:: interpret:: ConstValue ;
18- use rustc:: mir:: traversal:: ReversePostorder ;
1918use rustc:: mir:: visit:: { PlaceContext , Visitor , MutatingUseContext , NonMutatingUseContext } ;
2019use rustc:: middle:: lang_items;
2120use rustc:: session:: config:: nightly_options;
@@ -31,7 +30,6 @@ use std::usize;
3130
3231use rustc:: hir:: HirId ;
3332use crate :: transform:: { MirPass , MirSource } ;
34- use super :: promote_consts:: { self , Candidate , TempState } ;
3533use crate :: transform:: check_consts:: ops:: { self , NonConstOp } ;
3634
3735/// What kind of item we are in.
@@ -477,10 +475,6 @@ struct Checker<'a, 'tcx> {
477475
478476 span : Span ,
479477 def_id : DefId ,
480- rpo : ReversePostorder < ' a , ' tcx > ,
481-
482- temp_promotion_state : IndexVec < Local , TempState > ,
483- unchecked_promotion_candidates : Vec < Candidate > ,
484478
485479 /// If `true`, do not emit errors to the user, merely collect them in `errors`.
486480 suppress_errors : bool ,
@@ -509,10 +503,6 @@ impl Deref for Checker<'a, 'tcx> {
509503impl < ' a , ' tcx > Checker < ' a , ' tcx > {
510504 fn new ( tcx : TyCtxt < ' tcx > , def_id : DefId , body : & ' a Body < ' tcx > , mode : Mode ) -> Self {
511505 assert ! ( def_id. is_local( ) ) ;
512- let mut rpo = traversal:: reverse_postorder ( body) ;
513- let ( temps, unchecked_promotion_candidates) =
514- promote_consts:: collect_temps_and_candidates ( tcx, body, & mut rpo) ;
515- rpo. reset ( ) ;
516506
517507 let param_env = tcx. param_env ( def_id) ;
518508
@@ -539,9 +529,6 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
539529 cx,
540530 span : body. span ,
541531 def_id,
542- rpo,
543- temp_promotion_state : temps,
544- unchecked_promotion_candidates,
545532 errors : vec ! [ ] ,
546533 suppress_errors : false ,
547534 }
@@ -662,14 +649,6 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
662649 let kind = self . body . local_kind ( index) ;
663650 debug ! ( "store to {:?} {:?}" , kind, index) ;
664651
665- // Only handle promotable temps in non-const functions.
666- if self . mode == Mode :: NonConstFn {
667- if kind != LocalKind :: Temp ||
668- !self . temp_promotion_state [ index] . is_promotable ( ) {
669- return ;
670- }
671- }
672-
673652 // this is overly restrictive, because even full assignments do not clear the qualif
674653 // While we could special case full assignments, this would be inconsistent with
675654 // aggregates where we overwrite all fields via assignments, which would not get
0 commit comments