Skip to content

Commit ffb9336

Browse files
authored
Rollup merge of #127439 - compiler-errors:uplift-elaborate, r=lcnr
Uplift elaboration into `rustc_type_ir` Allows us to deduplicate and consolidate elaboration (including these stupid elaboration duplicate fns i added for pretty printing like 3 years ago) so I'm pretty hyped about this change :3 r? lcnr
2 parents 928d71f + 15d16f1 commit ffb9336

File tree

29 files changed

+506
-522
lines changed

29 files changed

+506
-522
lines changed

compiler/rustc_hir_analysis/src/check/wfcheck.rs

+11-12
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ fn check_gat_where_clauses(tcx: TyCtxt<'_>, trait_def_id: LocalDefId) {
478478
param_env,
479479
item_def_id,
480480
tcx.explicit_item_bounds(item_def_id)
481-
.instantiate_identity_iter_copied()
481+
.iter_identity_copied()
482482
.collect::<Vec<_>>(),
483483
&FxIndexSet::default(),
484484
gat_def_id,
@@ -1205,17 +1205,16 @@ fn check_associated_type_bounds(wfcx: &WfCheckingCtxt<'_, '_>, item: ty::AssocIt
12051205
let bounds = wfcx.tcx().explicit_item_bounds(item.def_id);
12061206

12071207
debug!("check_associated_type_bounds: bounds={:?}", bounds);
1208-
let wf_obligations =
1209-
bounds.instantiate_identity_iter_copied().flat_map(|(bound, bound_span)| {
1210-
let normalized_bound = wfcx.normalize(span, None, bound);
1211-
traits::wf::clause_obligations(
1212-
wfcx.infcx,
1213-
wfcx.param_env,
1214-
wfcx.body_def_id,
1215-
normalized_bound,
1216-
bound_span,
1217-
)
1218-
});
1208+
let wf_obligations = bounds.iter_identity_copied().flat_map(|(bound, bound_span)| {
1209+
let normalized_bound = wfcx.normalize(span, None, bound);
1210+
traits::wf::clause_obligations(
1211+
wfcx.infcx,
1212+
wfcx.param_env,
1213+
wfcx.body_def_id,
1214+
normalized_bound,
1215+
bound_span,
1216+
)
1217+
});
12191218

12201219
wfcx.register_obligations(wf_obligations);
12211220
}

compiler/rustc_hir_typeck/src/coercion.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -1752,10 +1752,8 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> {
17521752
fcx.probe(|_| {
17531753
let ocx = ObligationCtxt::new(fcx);
17541754
ocx.register_obligations(
1755-
fcx.tcx
1756-
.item_super_predicates(rpit_def_id)
1757-
.instantiate_identity_iter()
1758-
.filter_map(|clause| {
1755+
fcx.tcx.item_super_predicates(rpit_def_id).iter_identity().filter_map(
1756+
|clause| {
17591757
let predicate = clause
17601758
.kind()
17611759
.map_bound(|clause| match clause {
@@ -1776,7 +1774,8 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> {
17761774
fcx.param_env,
17771775
predicate,
17781776
))
1779-
}),
1777+
},
1778+
),
17801779
);
17811780
ocx.select_where_possible().is_empty()
17821781
})

0 commit comments

Comments
 (0)