]> git.lizzy.rs Git - rust.git/commitdiff
Hide lifetimes of `impl Trait` in force trimmed paths
authorEsteban Küber <esteban@kuber.com.ar>
Fri, 6 Jan 2023 01:22:24 +0000 (01:22 +0000)
committerEsteban Küber <esteban@kuber.com.ar>
Mon, 30 Jan 2023 20:12:21 +0000 (20:12 +0000)
compiler/rustc_middle/src/ty/print/pretty.rs
tests/ui/associated-type-bounds/inside-adt.stderr

index 78f17c7783e9e89495fc5d375e8614173c0792d4..6a20f62b6f9b82c3374f560f881389e937e0cef9 100644 (file)
@@ -1084,9 +1084,11 @@ fn pretty_print_opaque_impl_type(
             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)
index fa1390a5462fe779b4a9aade0923a5b562a5c18f..1668b613b25b1629efc4ee5a1ea8cb3862a73f3c 100644 (file)
@@ -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