You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rollup merge of #103414 - compiler-errors:rpit-print-lt, r=cjgillot
Pretty print lifetimes captured by RPIT
This specifically makes the output in #103409 change from:
```diff
error: `impl` item signature doesn't match `trait` item signature
--> $DIR/signature-mismatch.rs:15:5
|
LL | fn async_fn(&self, buff: &[u8]) -> impl Future<Output = Vec<u8>>;
| ----------------------------------------------------------------- expected `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>>`
...
LL | fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>>`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '2`
|
= note: expected `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>>`
- found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>>`
+ found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '2`
= help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait`
= help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output
error: aborting due to previous error
```
Along with the UI tests in this PR, which I think are all improvements!
r? `@oli-obk` though feel free to re-roll
Copy file name to clipboardExpand all lines: src/test/ui/associated-type-bounds/inside-adt.stderr
+5-5
Original file line number
Diff line number
Diff line change
@@ -70,13 +70,13 @@ help: the `Box` type always has a statically known size and allocates its conten
70
70
LL | enum E1 { V(Box<dyn Iterator<Item: Copy>>) }
71
71
| ++++ +
72
72
73
-
error[E0277]: the size for values of type `(dyn Iterator<Item = impl Sized> + 'static)` cannot be known at compilation time
73
+
error[E0277]: the size for values of type `(dyn Iterator<Item = impl Sized + 'static> + 'static)` cannot be known at compilation time
74
74
--> $DIR/inside-adt.rs:17:13
75
75
|
76
76
LL | enum E3 { V(dyn Iterator<Item: 'static>) }
77
77
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
78
78
|
79
-
= help: the trait `Sized` is not implemented for `(dyn Iterator<Item = impl Sized> + 'static)`
79
+
= help: the trait `Sized` is not implemented for `(dyn Iterator<Item = impl Sized + 'static> + 'static)`
80
80
= note: no field of an enum variant may have a dynamically sized type
81
81
= help: change the field's type to have a statically known size
82
82
help: borrowed types always have a statically known size
@@ -107,14 +107,14 @@ help: the `Box` type always has a statically known size and allocates its conten
107
107
LL | union U1 { f: Box<ManuallyDrop<dyn Iterator<Item: Copy>>> }
108
108
| ++++ +
109
109
110
-
error[E0277]: the size for values of type `(dyn Iterator<Item = impl Sized> + 'static)` cannot be known at compilation time
110
+
error[E0277]: the size for values of type `(dyn Iterator<Item = impl Sized + 'static> + 'static)` cannot be known at compilation time
111
111
--> $DIR/inside-adt.rs:26:15
112
112
|
113
113
LL | union U3 { f: ManuallyDrop<dyn Iterator<Item: 'static>> }
114
114
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
115
115
|
116
-
= help: within `ManuallyDrop<(dyn Iterator<Item = impl Sized> + 'static)>`, the trait `Sized` is not implemented for `(dyn Iterator<Item = impl Sized> + 'static)`
117
-
= note: required because it appears within the type `ManuallyDrop<(dyn Iterator<Item = impl Sized> + 'static)>`
116
+
= 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> + 'static)>`
118
118
= note: no field of a union may have a dynamically sized type
119
119
= help: change the field's type to have a statically known size
120
120
help: borrowed types always have a statically known size
0 commit comments