@@ -940,7 +940,7 @@ fn check_associated_item(
940
940
item. ident ( fcx. tcx ) . span ,
941
941
sig,
942
942
hir_sig. decl ,
943
- item. def_id ,
943
+ item. def_id . expect_local ( ) ,
944
944
& mut implied_bounds,
945
945
) ;
946
946
check_method_receiver ( fcx, hir_sig, item, self_ty) ;
@@ -1068,7 +1068,7 @@ fn check_type_defn<'tcx, F>(
1068
1068
}
1069
1069
}
1070
1070
1071
- check_where_clauses ( fcx, item. span , item. def_id . to_def_id ( ) , None ) ;
1071
+ check_where_clauses ( fcx, item. span , item. def_id , None ) ;
1072
1072
1073
1073
// No implied bounds in a struct definition.
1074
1074
FxHashSet :: default ( )
@@ -1096,7 +1096,7 @@ fn check_trait(tcx: TyCtxt<'_>, item: &hir::Item<'_>) {
1096
1096
1097
1097
// FIXME: this shouldn't use an `FnCtxt` at all.
1098
1098
for_item ( tcx, item) . with_fcx ( |fcx| {
1099
- check_where_clauses ( fcx, item. span , item. def_id . to_def_id ( ) , None ) ;
1099
+ check_where_clauses ( fcx, item. span , item. def_id , None ) ;
1100
1100
1101
1101
FxHashSet :: default ( )
1102
1102
} ) ;
@@ -1144,7 +1144,7 @@ fn check_item_fn(
1144
1144
for_id ( tcx, def_id, span) . with_fcx ( |fcx| {
1145
1145
let sig = tcx. fn_sig ( def_id) ;
1146
1146
let mut implied_bounds = FxHashSet :: default ( ) ;
1147
- check_fn_or_method ( fcx, ident. span , sig, decl, def_id. to_def_id ( ) , & mut implied_bounds) ;
1147
+ check_fn_or_method ( fcx, ident. span , sig, decl, def_id, & mut implied_bounds) ;
1148
1148
implied_bounds
1149
1149
} )
1150
1150
}
@@ -1238,7 +1238,7 @@ fn check_impl<'tcx>(
1238
1238
}
1239
1239
}
1240
1240
1241
- check_where_clauses ( fcx, item. span , item. def_id . to_def_id ( ) , None ) ;
1241
+ check_where_clauses ( fcx, item. span , item. def_id , None ) ;
1242
1242
1243
1243
fcx. impl_implied_bounds ( item. def_id . to_def_id ( ) , item. span )
1244
1244
} ) ;
@@ -1249,7 +1249,7 @@ fn check_impl<'tcx>(
1249
1249
fn check_where_clauses < ' tcx , ' fcx > (
1250
1250
fcx : & FnCtxt < ' fcx , ' tcx > ,
1251
1251
span : Span ,
1252
- def_id : DefId ,
1252
+ def_id : LocalDefId ,
1253
1253
return_ty : Option < ( Ty < ' tcx > , Span ) > ,
1254
1254
) {
1255
1255
let tcx = fcx. tcx ;
@@ -1317,7 +1317,7 @@ fn check_where_clauses<'tcx, 'fcx>(
1317
1317
// For more examples see tests `defaults-well-formedness.rs` and `type-check-defaults.rs`.
1318
1318
//
1319
1319
// First we build the defaulted substitution.
1320
- let substs = InternalSubsts :: for_item ( tcx, def_id, |param, _| {
1320
+ let substs = InternalSubsts :: for_item ( tcx, def_id. to_def_id ( ) , |param, _| {
1321
1321
match param. kind {
1322
1322
GenericParamDefKind :: Lifetime => {
1323
1323
// All regions are identity.
@@ -1411,8 +1411,11 @@ fn check_where_clauses<'tcx, 'fcx>(
1411
1411
// below: there, we are not trying to prove those predicates
1412
1412
// to be *true* but merely *well-formed*.
1413
1413
let pred = fcx. normalize_associated_types_in ( sp, pred) ;
1414
- let cause =
1415
- traits:: ObligationCause :: new ( sp, fcx. body_id , traits:: ItemObligation ( def_id) ) ;
1414
+ let cause = traits:: ObligationCause :: new (
1415
+ sp,
1416
+ fcx. body_id ,
1417
+ traits:: ItemObligation ( def_id. to_def_id ( ) ) ,
1418
+ ) ;
1416
1419
traits:: Obligation :: new ( cause, fcx. param_env , pred)
1417
1420
} ) ;
1418
1421
@@ -1445,10 +1448,10 @@ fn check_fn_or_method<'fcx, 'tcx>(
1445
1448
span : Span ,
1446
1449
sig : ty:: PolyFnSig < ' tcx > ,
1447
1450
hir_decl : & hir:: FnDecl < ' _ > ,
1448
- def_id : DefId ,
1451
+ def_id : LocalDefId ,
1449
1452
implied_bounds : & mut FxHashSet < Ty < ' tcx > > ,
1450
1453
) {
1451
- let sig = fcx. tcx . liberate_late_bound_regions ( def_id, sig) ;
1454
+ let sig = fcx. tcx . liberate_late_bound_regions ( def_id. to_def_id ( ) , sig) ;
1452
1455
1453
1456
// Normalize the input and output types one at a time, using a different
1454
1457
// `WellFormedLoc` for each. We cannot call `normalize_associated_types`
@@ -1462,7 +1465,7 @@ fn check_fn_or_method<'fcx, 'tcx>(
1462
1465
span,
1463
1466
ty,
1464
1467
WellFormedLoc :: Param {
1465
- function : def_id. expect_local ( ) ,
1468
+ function : def_id,
1466
1469
// Note that the `param_idx` of the output type is
1467
1470
// one greater than the index of the last input type.
1468
1471
param_idx : i. try_into ( ) . unwrap ( ) ,
@@ -1485,7 +1488,7 @@ fn check_fn_or_method<'fcx, 'tcx>(
1485
1488
input_ty. into ( ) ,
1486
1489
ty. span ,
1487
1490
ObligationCauseCode :: WellFormed ( Some ( WellFormedLoc :: Param {
1488
- function : def_id. expect_local ( ) ,
1491
+ function : def_id,
1489
1492
param_idx : i. try_into ( ) . unwrap ( ) ,
1490
1493
} ) ) ,
1491
1494
) ;
0 commit comments