Skip to content

Commit c18773a

Browse files
committed
Make mk_bound_region closure more generic.
This is necessary for the subsequent commits.
1 parent 722e078 commit c18773a

File tree

1 file changed

+8
-9
lines changed
  • compiler/rustc_hir_typeck/src/generator_interior

1 file changed

+8
-9
lines changed

compiler/rustc_hir_typeck/src/generator_interior/mod.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,7 @@ pub fn resolve_interior<'a, 'tcx>(
239239
// typeck had previously found constraints that would cause them to be related.
240240

241241
let mut counter = 0;
242-
let mut mk_bound_region = |span| {
243-
let kind = ty::BrAnon(span);
242+
let mut mk_bound_region = |kind| {
244243
let var = ty::BoundVar::from_u32(counter);
245244
counter += 1;
246245
ty::BoundRegion { var, kind }
@@ -252,24 +251,24 @@ pub fn resolve_interior<'a, 'tcx>(
252251
let origin = fcx.region_var_origin(vid);
253252
match origin {
254253
RegionVariableOrigin::EarlyBoundRegion(span, _) => {
255-
mk_bound_region(Some(span))
254+
mk_bound_region(ty::BrAnon(Some(span)))
256255
}
257-
_ => mk_bound_region(None),
256+
_ => mk_bound_region(ty::BrAnon(None)),
258257
}
259258
}
260259
// FIXME: these should use `BrNamed`
261260
ty::ReEarlyBound(region) => {
262-
mk_bound_region(Some(fcx.tcx.def_span(region.def_id)))
261+
mk_bound_region(ty::BrAnon(Some(fcx.tcx.def_span(region.def_id))))
263262
}
264263
ty::ReLateBound(_, ty::BoundRegion { kind, .. })
265264
| ty::ReFree(ty::FreeRegion { bound_region: kind, .. }) => match kind {
266-
ty::BoundRegionKind::BrAnon(span) => mk_bound_region(span),
265+
ty::BoundRegionKind::BrAnon(span) => mk_bound_region(ty::BrAnon(span)),
267266
ty::BoundRegionKind::BrNamed(def_id, _) => {
268-
mk_bound_region(Some(fcx.tcx.def_span(def_id)))
267+
mk_bound_region(ty::BrAnon(Some(fcx.tcx.def_span(def_id))))
269268
}
270-
ty::BoundRegionKind::BrEnv => mk_bound_region(None),
269+
ty::BoundRegionKind::BrEnv => mk_bound_region(ty::BrAnon(None)),
271270
},
272-
_ => mk_bound_region(None),
271+
_ => mk_bound_region(ty::BrAnon(None)),
273272
};
274273
let r = fcx.tcx.mk_re_late_bound(current_depth, br);
275274
r

0 commit comments

Comments
 (0)