Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 45eec0f

Browse files
committedMay 30, 2023
Auto merge of #112075 - WaffleLapkin:unmkII, r=lcnr
Replace `tcx.mk_re_*` with `Region::new_*` Second step in implementing rust-lang/compiler-team#616 r? `@lcnr`
2 parents 165cdda + e33e208 commit 45eec0f

File tree

42 files changed

+292
-234
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+292
-234
lines changed
 

‎compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -180,24 +180,25 @@ trait TypeOpInfo<'tcx> {
180180
return;
181181
};
182182

183-
let placeholder_region = tcx.mk_re_placeholder(ty::Placeholder {
184-
universe: adjusted_universe.into(),
185-
bound: placeholder.bound,
186-
});
187-
188-
let error_region =
189-
if let RegionElement::PlaceholderRegion(error_placeholder) = error_element {
190-
let adjusted_universe =
191-
error_placeholder.universe.as_u32().checked_sub(base_universe.as_u32());
192-
adjusted_universe.map(|adjusted| {
193-
tcx.mk_re_placeholder(ty::Placeholder {
194-
universe: adjusted.into(),
195-
bound: error_placeholder.bound,
196-
})
197-
})
198-
} else {
199-
None
200-
};
183+
let placeholder_region = ty::Region::new_placeholder(
184+
tcx,
185+
ty::Placeholder { universe: adjusted_universe.into(), bound: placeholder.bound },
186+
);
187+
188+
let error_region = if let RegionElement::PlaceholderRegion(error_placeholder) =
189+
error_element
190+
{
191+
let adjusted_universe =
192+
error_placeholder.universe.as_u32().checked_sub(base_universe.as_u32());
193+
adjusted_universe.map(|adjusted| {
194+
ty::Region::new_placeholder(
195+
tcx,
196+
ty::Placeholder { universe: adjusted.into(), bound: error_placeholder.bound },
197+
)
198+
})
199+
} else {
200+
None
201+
};
201202

202203
debug!(?placeholder_region);
203204

@@ -390,7 +391,7 @@ fn try_extract_error_from_fulfill_cx<'tcx>(
390391
error_region,
391392
&region_constraints,
392393
|vid| ocx.infcx.region_var_origin(vid),
393-
|vid| ocx.infcx.universe_of_region(ocx.infcx.tcx.mk_re_var(vid)),
394+
|vid| ocx.infcx.universe_of_region(ty::Region::new_var(ocx.infcx.tcx, vid)),
394395
)
395396
}
396397

@@ -411,7 +412,7 @@ fn try_extract_error_from_region_constraints<'tcx>(
411412
}
412413
// FIXME: Should this check the universe of the var?
413414
Constraint::VarSubReg(vid, sup) if sup == placeholder_region => {
414-
Some((infcx.tcx.mk_re_var(vid), cause.clone()))
415+
Some((ty::Region::new_var(infcx.tcx, vid), cause.clone()))
415416
}
416417
_ => None,
417418
}

‎compiler/rustc_borrowck/src/nll.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ fn for_each_region_constraint<'tcx>(
441441
let subject = match req.subject {
442442
ClosureOutlivesSubject::Region(subject) => format!("{:?}", subject),
443443
ClosureOutlivesSubject::Ty(ty) => {
444-
format!("{:?}", ty.instantiate(tcx, |vid| tcx.mk_re_var(vid)))
444+
format!("{:?}", ty.instantiate(tcx, |vid| ty::Region::new_var(tcx, vid)))
445445
}
446446
};
447447
with_msg(format!("where {}: {:?}", subject, req.outlived_free_region,))?;

0 commit comments

Comments
 (0)
Please sign in to comment.