Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable -Zdrop-tracking-mir by default #107421

Merged
merged 11 commits into from
Sep 23, 2023
Prev Previous commit
Next Next commit
Fold lifetimes before substitution.
  • Loading branch information
cjgillot committed Sep 23, 2023
commit ff032043653e7aebfbf74ab59572f929aa2beb65
28 changes: 14 additions & 14 deletions compiler/rustc_trait_selection/src/traits/select/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3115,25 3115,25 @@ fn bind_generator_hidden_types_above<'tcx>(
.generator_hidden_types(def_id)
// Deduplicate tys to avoid repeated work.
.filter(|bty| seen_tys.insert(*bty))
.map(|bty| {
let mut ty = bty.instantiate(tcx, args);

.map(|mut bty| {
// Only remap erased regions if we use them.
if considering_regions {
ty = tcx.fold_regions(ty, |r, current_depth| match r.kind() {
ty::ReErased => {
let br = ty::BoundRegion {
var: ty::BoundVar::from_u32(counter),
kind: ty::BrAnon(None),
};
counter = 1;
ty::Region::new_late_bound(tcx, current_depth, br)
}
r => bug!("unexpected region: {r:?}"),
bty = bty.map_bound(|ty| {
tcx.fold_regions(ty, |r, current_depth| match r.kind() {
ty::ReErased => {
let br = ty::BoundRegion {
var: ty::BoundVar::from_u32(counter),
kind: ty::BrAnon(None),
};
counter = 1;
ty::Region::new_late_bound(tcx, current_depth, br)
}
r => bug!("unexpected region: {r:?}"),
})
})
}

ty
bty.instantiate(tcx, args)
})
.collect();
if considering_regions {
Expand Down