]> git.lizzy.rs Git - rust.git/commitdiff
comment the pattern
authorNiko Matsakis <niko@alum.mit.edu>
Fri, 25 Jan 2019 20:43:36 +0000 (15:43 -0500)
committerRémy Rakic <remy.rakic@gmail.com>
Sun, 27 Jan 2019 09:52:44 +0000 (10:52 +0100)
src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs

index f5c51f8ee26083341ceec63d7e9054e33aee58bd..a0ce250d7e977fe86f2a6fc329b29b5f9eb097d7 100644 (file)
@@ -270,6 +270,21 @@ fn try_report_placeholders_trait(
             self_ty_has_vid
         );
 
+        // The weird thing here with the `maybe_highlighting_region` calls and the
+        // the match inside is meant to be like this:
+        //
+        // - The match checks whether the given things (placeholders, etc) appear
+        //   in the types are about to print
+        // - Meanwhile, the `maybe_highlighting_region` calls set up
+        //   highlights so that, if they do appear, we will replace
+        //   them `'0` and whatever.  (This replacement takes place
+        //   inside the closure given to `maybe_highlighting_region`.)
+        //
+        // There is some duplication between the calls -- i.e., the
+        // `maybe_highlighting_region` checks if (e.g.) `has_sub` is
+        // None, an then we check again inside the closure, but this
+        // setup sort of minimized the number of calls and so form.
+
         RegionHighlightMode::maybe_highlighting_region(sub_placeholder, has_sub, || {
             RegionHighlightMode::maybe_highlighting_region(sup_placeholder, has_sup, || {
                 match (has_sub, has_sup) {