about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2023-01-06 01:03:52 +0000
committerEsteban Küber <esteban@kuber.com.ar>2023-01-30 20:12:21 +0000
commit81973a39e05bfc5ddad4b5a54903c2c8fbdfa273 (patch)
treedbd0983c2dc59a962daf3a5a09a67628ec39cfa1 /compiler/rustc_middle/src
parent3fa95b847be64342562bccd55abb7e55c8daa3f2 (diff)
downloadrust-81973a39e05bfc5ddad4b5a54903c2c8fbdfa273.tar.gz
rust-81973a39e05bfc5ddad4b5a54903c2c8fbdfa273.zip
Don't show `for<'lt>` in force trimmed paths
Diffstat (limited to 'compiler/rustc_middle/src')
-rw-r--r--compiler/rustc_middle/src/ty/print/pretty.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs
index f2abec216b7..d9d6e65a97a 100644
--- a/compiler/rustc_middle/src/ty/print/pretty.rs
+++ b/compiler/rustc_middle/src/ty/print/pretty.rs
@@ -2346,6 +2346,7 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
         } else {
             let tcx = self.tcx;
 
+            let trim_path = FORCE_TRIMMED_PATH.with(|flag| flag.get());
             // Closure used in `RegionFolder` to create names for anonymous late-bound
             // regions. We use two `DebruijnIndex`es (one for the currently folded
             // late-bound region and the other for the binder level) to determine
@@ -2400,8 +2401,10 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
                     }
                 };
 
-                start_or_continue(&mut self, "for<", ", ");
-                do_continue(&mut self, name);
+                if !trim_path {
+                    start_or_continue(&mut self, "for<", ", ");
+                    do_continue(&mut self, name);
+                }
                 tcx.mk_region(ty::ReLateBound(ty::INNERMOST, ty::BoundRegion { var: br.var, kind }))
             };
             let mut folder = RegionFolder {
@@ -2412,7 +2415,9 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
             };
             let new_value = value.clone().skip_binder().fold_with(&mut folder);
             let region_map = folder.region_map;
-            start_or_continue(&mut self, "", "> ");
+            if !trim_path {
+                start_or_continue(&mut self, "", "> ");
+            }
             (new_value, region_map)
         };