Skip to content

Commit 790ed91

Browse files
nikomatsakislqd
authored andcommitted
comment the pattern
1 parent ec6405b commit 790ed91

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,21 @@ impl NiceRegionError<'me, 'gcx, 'tcx> {
270270
self_ty_has_vid
271271
);
272272

273+
// The weird thing here with the `maybe_highlighting_region` calls and the
274+
// the match inside is meant to be like this:
275+
//
276+
// - The match checks whether the given things (placeholders, etc) appear
277+
// in the types are about to print
278+
// - Meanwhile, the `maybe_highlighting_region` calls set up
279+
// highlights so that, if they do appear, we will replace
280+
// them `'0` and whatever. (This replacement takes place
281+
// inside the closure given to `maybe_highlighting_region`.)
282+
//
283+
// There is some duplication between the calls -- i.e., the
284+
// `maybe_highlighting_region` checks if (e.g.) `has_sub` is
285+
// None, an then we check again inside the closure, but this
286+
// setup sort of minimized the number of calls and so form.
287+
273288
RegionHighlightMode::maybe_highlighting_region(sub_placeholder, has_sub, || {
274289
RegionHighlightMode::maybe_highlighting_region(sup_placeholder, has_sup, || {
275290
match (has_sub, has_sup) {

0 commit comments

Comments
 (0)