From ab8dc9a0adedcee75a217ea0d60709fe38269768 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Fri, 6 Jan 2023 01:22:24 +0000 Subject: [PATCH] Hide lifetimes of `impl Trait` in force trimmed paths --- compiler/rustc_middle/src/ty/print/pretty.rs | 8 +++++--- tests/ui/associated-type-bounds/inside-adt.stderr | 2 +- 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> } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `ManuallyDrop<(dyn Iterator + 'static)>`, the trait `Sized` is not implemented for `(dyn Iterator + 'static)` - = note: required because it appears within the type `ManuallyDrop>` + = note: required because it appears within the type `ManuallyDrop>` = 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