@@ -1231,65 +1231,6 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
1231
1231
self . inlined_shallow_resolve ( typ)
1232
1232
}
1233
1233
1234
- /// A hacky sort of method used by the NLL type-relating code:
1235
- ///
1236
- /// - `var` must be some unbound type variable.
1237
- /// - `value` must be a suitable type to use as its value.
1238
- ///
1239
- /// `var` will then be equated with `value`. Note that this
1240
- /// sidesteps a number of important checks, such as the "occurs
1241
- /// check" that prevents cyclic types, so it is important not to
1242
- /// use this method during regular type-check.
1243
- fn force_instantiate_unchecked ( & self , var : Ty < ' tcx > , value : Ty < ' tcx > ) {
1244
- match ( & var. sty , & value. sty ) {
1245
- ( & ty:: Infer ( ty:: TyVar ( vid) ) , _) => {
1246
- let mut type_variables = self . type_variables . borrow_mut ( ) ;
1247
-
1248
- // In NLL, we don't have type inference variables
1249
- // floating around, so we can do this rather imprecise
1250
- // variant of the occurs-check.
1251
- assert ! ( !value. has_infer_types( ) ) ;
1252
-
1253
- type_variables. instantiate ( vid, value) ;
1254
- }
1255
-
1256
- ( & ty:: Infer ( ty:: IntVar ( vid) ) , & ty:: Int ( value) ) => {
1257
- let mut int_unification_table = self . int_unification_table . borrow_mut ( ) ;
1258
- int_unification_table
1259
- . unify_var_value ( vid, Some ( ty:: IntVarValue :: IntType ( value) ) )
1260
- . unwrap_or_else ( |_| {
1261
- bug ! ( "failed to unify int var `{:?}` with `{:?}`" , vid, value) ;
1262
- } ) ;
1263
- }
1264
-
1265
- ( & ty:: Infer ( ty:: IntVar ( vid) ) , & ty:: Uint ( value) ) => {
1266
- let mut int_unification_table = self . int_unification_table . borrow_mut ( ) ;
1267
- int_unification_table
1268
- . unify_var_value ( vid, Some ( ty:: IntVarValue :: UintType ( value) ) )
1269
- . unwrap_or_else ( |_| {
1270
- bug ! ( "failed to unify int var `{:?}` with `{:?}`" , vid, value) ;
1271
- } ) ;
1272
- }
1273
-
1274
- ( & ty:: Infer ( ty:: FloatVar ( vid) ) , & ty:: Float ( value) ) => {
1275
- let mut float_unification_table = self . float_unification_table . borrow_mut ( ) ;
1276
- float_unification_table
1277
- . unify_var_value ( vid, Some ( ty:: FloatVarValue ( value) ) )
1278
- . unwrap_or_else ( |_| {
1279
- bug ! ( "failed to unify float var `{:?}` with `{:?}`" , vid, value)
1280
- } ) ;
1281
- }
1282
-
1283
- _ => {
1284
- bug ! (
1285
- "force_instantiate_unchecked invoked with bad combination: var={:?} value={:?}" ,
1286
- var,
1287
- value,
1288
- ) ;
1289
- }
1290
- }
1291
- }
1292
-
1293
1234
pub fn resolve_type_vars_if_possible < T > ( & self , value : & T ) -> T
1294
1235
where
1295
1236
T : TypeFoldable < ' tcx > ,
0 commit comments