@@ -108,26 +108,22 @@ mod relate_tys;
108
108
///
109
109
/// - `infcx` -- inference context to use
110
110
/// - `param_env` -- parameter environment to use for trait solving
111
- /// - `mir` -- MIR to type-check
112
- /// - `mir_def_id` -- DefId from which the MIR is derived (must be local)
113
- /// - `region_bound_pairs` -- the implied outlives obligations between type parameters
114
- /// and lifetimes (e.g., `&'a T` implies `T: 'a`)
115
- /// - `implicit_region_bound` -- a region which all generic parameters are assumed
116
- /// to outlive; should represent the fn body
117
- /// - `input_tys` -- fully liberated, but **not** normalized, expected types of the arguments;
118
- /// the types of the input parameters found in the MIR itself will be equated with these
119
- /// - `output_ty` -- fully liberated, but **not** normalized, expected return type;
120
- /// the type for the RETURN_PLACE will be equated with this
121
- /// - `liveness` -- results of a liveness computation on the MIR; used to create liveness
122
- /// constraints for the regions in the types of variables
111
+ /// - `body` -- MIR body to type-check
112
+ /// - `promoted` -- map of promoted constants within `body`
113
+ /// - `mir_def_id` -- `LocalDefId` from which the MIR is derived
114
+ /// - `universal_regions` -- the universal regions from `body`s function signature
115
+ /// - `location_table` -- MIR location map of `body`
116
+ /// - `borrow_set` -- information about borrows occurring in `body`
117
+ /// - `all_facts` -- when using Polonius, this is the generated set of Polonius facts
123
118
/// - `flow_inits` -- results of a maybe-init dataflow analysis
124
119
/// - `move_data` -- move-data constructed when performing the maybe-init dataflow analysis
120
+ /// - `elements` -- MIR region map
125
121
pub ( crate ) fn type_check < ' mir , ' tcx > (
126
122
infcx : & InferCtxt < ' _ , ' tcx > ,
127
123
param_env : ty:: ParamEnv < ' tcx > ,
128
124
body : & Body < ' tcx > ,
129
125
promoted : & IndexVec < Promoted , Body < ' tcx > > ,
130
- mir_def_id : DefId ,
126
+ mir_def_id : LocalDefId ,
131
127
universal_regions : & Rc < UniversalRegions < ' tcx > > ,
132
128
location_table : & LocationTable ,
133
129
borrow_set : & BorrowSet < ' tcx > ,
@@ -191,7 +187,7 @@ pub(crate) fn type_check<'mir, 'tcx>(
191
187
192
188
fn type_check_internal < ' a , ' tcx , R > (
193
189
infcx : & ' a InferCtxt < ' a , ' tcx > ,
194
- mir_def_id : DefId ,
190
+ mir_def_id : LocalDefId ,
195
191
param_env : ty:: ParamEnv < ' tcx > ,
196
192
body : & ' a Body < ' tcx > ,
197
193
promoted : & ' a IndexVec < Promoted , Body < ' tcx > > ,
@@ -271,7 +267,7 @@ struct TypeVerifier<'a, 'b, 'tcx> {
271
267
body : & ' b Body < ' tcx > ,
272
268
promoted : & ' b IndexVec < Promoted , Body < ' tcx > > ,
273
269
last_span : Span ,
274
- mir_def_id : DefId ,
270
+ mir_def_id : LocalDefId ,
275
271
errors_reported : bool ,
276
272
}
277
273
@@ -815,7 +811,7 @@ struct TypeChecker<'a, 'tcx> {
815
811
/// User type annotations are shared between the main MIR and the MIR of
816
812
/// all of the promoted items.
817
813
user_type_annotations : & ' a CanonicalUserTypeAnnotations < ' tcx > ,
818
- mir_def_id : DefId ,
814
+ mir_def_id : LocalDefId ,
819
815
region_bound_pairs : & ' a RegionBoundPairs < ' tcx > ,
820
816
implicit_region_bound : ty:: Region < ' tcx > ,
821
817
reported_errors : FxHashSet < ( Ty < ' tcx > , Span ) > ,
@@ -963,7 +959,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
963
959
fn new (
964
960
infcx : & ' a InferCtxt < ' a , ' tcx > ,
965
961
body : & ' a Body < ' tcx > ,
966
- mir_def_id : DefId ,
962
+ mir_def_id : LocalDefId ,
967
963
param_env : ty:: ParamEnv < ' tcx > ,
968
964
region_bound_pairs : & ' a RegionBoundPairs < ' tcx > ,
969
965
implicit_region_bound : ty:: Region < ' tcx > ,
@@ -1142,7 +1138,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1142
1138
// When you have `let x: impl Foo = ...` in a closure,
1143
1139
// the resulting inferend values are stored with the
1144
1140
// def-id of the base function.
1145
- let parent_def_id = self . tcx ( ) . closure_base_def_id ( self . mir_def_id ) ;
1141
+ let parent_def_id = self . tcx ( ) . closure_base_def_id ( self . mir_def_id . to_def_id ( ) ) ;
1146
1142
return self . eq_opaque_type_and_type ( sub, sup, parent_def_id, locations, category) ;
1147
1143
} else {
1148
1144
return Err ( terr) ;
@@ -1994,7 +1990,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
1994
1990
if !self . infcx . type_is_copy_modulo_regions ( self . param_env , ty, span) {
1995
1991
let ccx = ConstCx :: new_with_param_env (
1996
1992
tcx,
1997
- self . mir_def_id . expect_local ( ) ,
1993
+ self . mir_def_id ,
1998
1994
body,
1999
1995
self . param_env ,
2000
1996
) ;
@@ -2010,9 +2006,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
2010
2006
& traits:: Obligation :: new (
2011
2007
ObligationCause :: new (
2012
2008
span,
2013
- self . tcx ( )
2014
- . hir ( )
2015
- . local_def_id_to_hir_id ( self . mir_def_id . expect_local ( ) ) ,
2009
+ self . tcx ( ) . hir ( ) . local_def_id_to_hir_id ( self . mir_def_id ) ,
2016
2010
traits:: ObligationCauseCode :: RepeatVec ( should_suggest) ,
2017
2011
) ,
2018
2012
self . param_env ,
0 commit comments