@@ -2,6 +2,7 @@ use rustc_index::vec::IndexVec;
22use rustc_infer:: infer:: { InferCtxt , NllRegionVariableOrigin } ;
33use rustc_middle:: mir:: visit:: { MutVisitor , TyContext } ;
44use rustc_middle:: mir:: { Body , Location , Promoted } ;
5+ use rustc_middle:: mir:: { Constant , ConstantKind } ;
56use rustc_middle:: ty:: subst:: SubstsRef ;
67use rustc_middle:: ty:: { self , Ty , TyCtxt , TypeFoldable } ;
78
@@ -77,7 +78,36 @@ impl<'a, 'tcx> MutVisitor<'tcx> for NllVisitor<'a, 'tcx> {
7778 debug ! ( ?region) ;
7879 }
7980
80- fn visit_const ( & mut self , constant : & mut ty:: Const < ' tcx > , _location : Location ) {
81- * constant = self . renumber_regions ( * constant) ;
81+ #[ instrument( skip( self ) , level = "debug" ) ]
82+ fn visit_constant ( & mut self , constant : & mut Constant < ' tcx > , _location : Location ) {
83+ let literal = constant. literal ;
84+ debug ! ( "{:#?}" , literal) ;
85+
86+ match literal {
87+ ConstantKind :: Ty ( ct) => {
88+ let ct = self . renumber_regions ( ct) ;
89+ debug ! ( "renumbered ct {:#?}" , ct) ;
90+
91+ constant. literal = ConstantKind :: Ty ( ct) ;
92+ }
93+ ConstantKind :: Unevaluated ( uv, ty) => {
94+ debug ! ( "uv: {:#?}, ty: {:#?}" , uv, ty) ;
95+ let uv = self . renumber_regions ( uv) ;
96+ debug ! ( "uv: {:#?}" , uv) ;
97+ let ty = self . renumber_regions ( ty) ;
98+ debug ! ( "{:#?}" , ty) ;
99+ constant. literal = ConstantKind :: Unevaluated ( uv, ty) ;
100+ }
101+ ConstantKind :: Val ( val, ty) => {
102+ let ty = self . renumber_regions ( ty) ;
103+ constant. literal = ConstantKind :: Val ( val, ty) ;
104+ }
105+ }
106+
107+ debug ! ( "constant: {:#?}" , constant) ;
108+ }
109+
110+ fn visit_const ( & mut self , _constant : & mut ty:: Const < ' tcx > , _location : Location ) {
111+ bug ! ( "should never be called" ) ;
82112 }
83113}
0 commit comments