]> git.lizzy.rs Git - rust.git/commitdiff
make `get_highlight_region_for_regionvid` only affect re-vid
authorNiko Matsakis <niko@alum.mit.edu>
Sat, 17 Nov 2018 00:13:55 +0000 (19:13 -0500)
committerNiko Matsakis <niko@alum.mit.edu>
Wed, 2 Jan 2019 22:35:05 +0000 (17:35 -0500)
In NLL, ReVid is all there is, but I might want to repurpose.

src/librustc/util/ppaux.rs

index 318d7adb1901107f70a0fbf539968fc0908ad176..cbba4181271fd7278d96d4bc3303b648fae729c4 100644 (file)
@@ -771,7 +771,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 define_print! {
     () ty::RegionKind, (self, f, cx) {
         display {
-            if cx.is_verbose || get_highlight_region_for_regionvid().is_some() {
+            if cx.is_verbose {
                 return self.print_debug(f, cx);
             }
 
@@ -806,11 +806,16 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                         ),
                     }
                 }
-                ty::ReVar(region_vid) if cx.identify_regions => {
-                    write!(f, "'{}rv", region_vid.index())
+                ty::ReVar(region_vid) => {
+                    if get_highlight_region_for_regionvid().is_some() {
+                        write!(f, "{:?}", region_vid)
+                    } else if cx.identify_regions {
+                        write!(f, "'{}rv", region_vid.index())
+                    } else {
+                        Ok(())
+                    }
                 }
                 ty::ReScope(_) |
-                ty::ReVar(_) |
                 ty::ReErased => Ok(()),
                 ty::ReStatic => write!(f, "'static"),
                 ty::ReEmpty => write!(f, "'<empty>"),