1
1
use rustc:: ty:: { self , Ty , TypeFoldable , UpvarSubsts } ;
2
2
use rustc:: ty:: layout:: { TyLayout , HasTyCtxt } ;
3
3
use rustc:: mir:: { self , Mir } ;
4
- use rustc:: ty:: subst:: SubstsRef ;
5
4
use rustc:: session:: config:: DebugInfo ;
6
5
use rustc_mir:: monomorphize:: Instance ;
7
6
use rustc_target:: abi:: call:: { FnType , PassMode , IgnoreMode } ;
@@ -83,9 +82,6 @@ pub struct FunctionCx<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> {
83
82
/// Debug information for MIR scopes.
84
83
scopes : IndexVec < mir:: SourceScope , debuginfo:: MirDebugScope < Bx :: DIScope > > ,
85
84
86
- /// If this function is being monomorphized, this contains the type substitutions used.
87
- param_substs : SubstsRef < ' tcx > ,
88
-
89
85
/// If this function is a C-variadic function, this contains the `PlaceRef` of the
90
86
/// "spoofed" `VaList`.
91
87
va_list_ref : Option < PlaceRef < ' tcx , Bx :: Value > > ,
@@ -96,7 +92,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
96
92
where T : TypeFoldable < ' tcx >
97
93
{
98
94
self . cx . tcx ( ) . subst_and_normalize_erasing_regions (
99
- self . param_substs ,
95
+ self . instance . substs ,
100
96
ty:: ParamEnv :: reveal_all ( ) ,
101
97
value,
102
98
)
@@ -203,6 +199,8 @@ pub fn codegen_mir<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
203
199
instance : Instance < ' tcx > ,
204
200
sig : ty:: FnSig < ' tcx > ,
205
201
) {
202
+ assert ! ( !instance. substs. needs_infer( ) ) ;
203
+
206
204
let fn_ty = cx. new_fn_type ( sig, & [ ] ) ;
207
205
debug ! ( "fn_ty: {:?}" , fn_ty) ;
208
206
let debug_context =
@@ -245,10 +243,6 @@ pub fn codegen_mir<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
245
243
scopes,
246
244
locals : IndexVec :: new ( ) ,
247
245
debug_context,
248
- param_substs : {
249
- assert ! ( !instance. substs. needs_infer( ) ) ;
250
- instance. substs
251
- } ,
252
246
va_list_ref : None ,
253
247
} ;
254
248
0 commit comments