@@ -2,6 +2,7 @@ use rustc_index::vec::IndexVec;
2
2
use rustc_infer:: infer:: { InferCtxt , NllRegionVariableOrigin } ;
3
3
use rustc_middle:: mir:: visit:: { MutVisitor , TyContext } ;
4
4
use rustc_middle:: mir:: { Body , Location , Promoted } ;
5
+ use rustc_middle:: mir:: { Constant , ConstantKind } ;
5
6
use rustc_middle:: ty:: subst:: SubstsRef ;
6
7
use rustc_middle:: ty:: { self , Ty , TyCtxt , TypeFoldable } ;
7
8
@@ -77,7 +78,36 @@ impl<'a, 'tcx> MutVisitor<'tcx> for NllVisitor<'a, 'tcx> {
77
78
debug ! ( ?region) ;
78
79
}
79
80
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" ) ;
82
112
}
83
113
}
0 commit comments