about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2023-01-06 01:22:24 +0000
committerEsteban Küber <esteban@kuber.com.ar>2023-01-30 20:12:21 +0000
commitab8dc9a0adedcee75a217ea0d60709fe38269768 (patch)
tree30bf69d0400fd251de30a87a6097649a89532002
parent252c43b42b33dc2bf341afd525d0041c5097d2b1 (diff)
Hide lifetimes of `impl Trait` in force trimmed paths
-rw-r--r--compiler/rustc_middle/src/ty/print/pretty.rs8
-rw-r--r--tests/ui/associated-type-bounds/inside-adt.stderr2
2 files changed, 6 insertions, 4 deletions
diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs
index 78f17c7783e..6a20f62b6f9 100644
--- a/compiler/rustc_middle/src/ty/print/pretty.rs
+++ b/compiler/rustc_middle/src/ty/print/pretty.rs
@@ -1084,9 +1084,11 @@ pub trait PrettyPrinter<'tcx>:
             write!(self, "Sized")?;
         }
 
-        for re in lifetimes {
-            write!(self, " + ")?;
-            self = self.print_region(re)?;
+        if !FORCE_TRIMMED_PATH.with(|flag| flag.get()) {
+            for re in lifetimes {
+                write!(self, " + ")?;
+                self = self.print_region(re)?;
+            }
         }
 
         Ok(self)
diff --git a/tests/ui/associated-type-bounds/inside-adt.stderr b/tests/ui/associated-type-bounds/inside-adt.stderr
index fa1390a5462..1668b613b25 100644
--- a/tests/ui/associated-type-bounds/inside-adt.stderr
+++ b/tests/ui/associated-type-bounds/inside-adt.stderr
@@ -114,7 +114,7 @@ LL | union U3 { f: ManuallyDrop<dyn Iterator<Item: 'static>> }
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
    |
    = help: within `ManuallyDrop<(dyn Iterator<Item = impl Sized + 'static> + 'static)>`, the trait `Sized` is not implemented for `(dyn Iterator<Item = impl Sized + 'static> + 'static)`
-   = note: required because it appears within the type `ManuallyDrop<dyn Iterator<Item = impl Sized + 'static>>`
+   = note: required because it appears within the type `ManuallyDrop<dyn Iterator<Item = impl Sized>>`
    = note: no field of a union may have a dynamically sized type
    = help: change the field's type to have a statically known size
 help: borrowed types always have a statically known size