Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit ab8dc9a

Browse files
committed
Hide lifetimes of impl Trait in force trimmed paths
1 parent 252c43b commit ab8dc9a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

compiler/rustc_middle/src/ty/print/pretty.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,9 +1084,11 @@ pub trait PrettyPrinter<'tcx>:
10841084
write!(self, "Sized")?;
10851085
}
10861086

1087-
for re in lifetimes {
1088-
write!(self, " + ")?;
1089-
self = self.print_region(re)?;
1087+
if !FORCE_TRIMMED_PATH.with(|flag| flag.get()) {
1088+
for re in lifetimes {
1089+
write!(self, " + ")?;
1090+
self = self.print_region(re)?;
1091+
}
10901092
}
10911093

10921094
Ok(self)

tests/ui/associated-type-bounds/inside-adt.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ LL | union U3 { f: ManuallyDrop<dyn Iterator<Item: 'static>> }
114114
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
115115
|
116116
= help: within `ManuallyDrop<(dyn Iterator<Item = impl Sized + 'static> + 'static)>`, the trait `Sized` is not implemented for `(dyn Iterator<Item = impl Sized + 'static> + 'static)`
117-
= note: required because it appears within the type `ManuallyDrop<dyn Iterator<Item = impl Sized + 'static>>`
117+
= note: required because it appears within the type `ManuallyDrop<dyn Iterator<Item = impl Sized>>`
118118
= note: no field of a union may have a dynamically sized type
119119
= help: change the field's type to have a statically known size
120120
help: borrowed types always have a statically known size

0 commit comments

Comments
 (0)