Jonathan Brouwer
c5e1ca83ef
Rollup merge of #158992 - estebank:shorten-type-highlighted-lt, r=mejrs
...
Shorten types more when only interesting part is lifetimes
We have a mechanims (`Highlight`) to change the name of inferred lifetimes in types so that we can refer to them by a number. Modify it so that it also avoids printing sub-parts of the type that are irrelevant to the situation at hand. The new behavior will print any sub part that has *any* lifetime (as they might be informative) instead of *just* the lifetimes being replaced. This was found to produce the best effect empirically in the test suite, striking a nice balance between shortening labels and being informative.
```
error: lifetime may not live long enough
--> $DIR/wrong-closure-arg-suggestion-125325.rs:46:18
|
LL | take(|_| to_fn(|_| self.counter += 1));
| --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2`
| | |
| | return type of closure `aux::Map<{closure@...}>` contains a lifetime `'2`
| lifetime `'1` represents this closure's body
|
= note: closure implements `Fn`, so references to captured variables can't escape the closure
```
```
error: implementation of `FnOnce` is not general enough
--> $DIR/higher-ranked-auto-trait-15.rs:20:5
|
LL | require_send(future);
| ^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough
|
= note: closure with signature `fn(&'0 _) -> Iter<'_, i32>` must implement `FnOnce<(&'1 Vec<i32>,)>`, for any two lifetimes `'0` and `'1`...
= note: ...but it actually implements `FnOnce<(&Vec<i32>,)>`
```
Made this change after noticing that the first of the errors above had a corresponding `.stderr` file with lines longer than 150 columns by using `rg ".. \| .{150}" -g *.stderr`.
2026-07-16 21:01:53 +02:00
..
2026-05-09 17:50:35 +12:00
2026-03-09 18:31:29 -04:00
2026-05-08 15:10:37 +08:00
2026-07-15 16:37:18 +00:00
2026-03-16 17:58:49 +00:00
2026-03-14 22:40:28 +00:00
2025-12-02 18:25:13 +00:00
2026-02-28 21:13:48 +08:00
2026-02-28 21:13:48 +08:00
2026-02-28 21:13:48 +08:00
2026-04-25 11:47:34 -04:00
2026-04-25 11:47:34 -04:00
2026-04-15 00:59:25 -07:00
2026-04-15 00:59:25 -07:00
2026-04-15 00:59:25 -07:00
2026-04-15 00:59:25 -07:00
2026-01-26 17:34:31 +00:00
2026-07-13 22:48:25 +00:00
2025-12-09 17:29:23 +00:00
2026-02-17 16:51:44 +00:00
2026-02-17 16:51:44 +00:00
2026-02-17 16:51:44 +00:00
2026-02-17 16:51:44 +00:00
2026-02-17 16:51:44 +00:00
2026-03-31 21:32:31 +02:00
2026-03-31 21:32:31 +02:00
2026-02-17 16:51:44 +00:00
2026-02-17 16:51:44 +00:00
2026-03-28 16:18:11 +09:00
2026-03-28 16:18:11 +09:00
2026-02-01 18:31:21 +00:00
2026-02-01 18:31:21 +00:00
2026-02-01 18:20:30 +00:00
2026-02-01 18:20:30 +00:00
2026-02-01 18:20:30 +00:00
2026-05-29 18:02:10 -03:00
2026-01-21 19:00:03 +03:00
2025-11-27 11:19:00 -05:00
2025-12-09 17:29:23 +00:00
2025-11-09 22:14:48 +00:00
2026-04-18 10:51:16 -07:00
2026-04-18 10:51:16 -07:00
2026-03-21 02:24:36 +00:00
2026-07-15 16:35:42 +00:00
2025-12-10 19:27:40 +00:00
2025-12-02 18:25:13 +00:00
2025-12-02 18:25:13 +00:00
2026-03-28 16:18:11 +09:00
2026-03-28 16:18:11 +09:00
2025-11-27 11:19:00 -05:00
2025-11-27 11:19:00 -05:00
2026-07-13 22:48:25 +00:00
2026-03-15 01:50:36 +00:00
2026-04-20 16:46:57 +06:00
2026-04-20 16:46:57 +06:00
2026-01-13 01:16:58 +00:00
2026-06-15 20:38:53 +08:00
2026-06-15 20:38:53 +08:00
2026-03-29 16:23:14 +08:00
2026-03-29 16:23:14 +08:00
2026-03-29 16:23:14 +08:00
2025-12-10 15:15:56 +01:00
2025-10-31 20:44:01 +00:00
2025-10-31 20:44:01 +00:00
2025-10-31 20:44:01 +00:00
2025-10-31 20:44:01 +00:00
2026-03-28 16:18:11 +09:00
2025-11-06 17:34:48 +08:00
2025-11-06 17:34:48 +08:00
2025-11-06 17:34:48 +08:00
2026-03-02 00:23:24 +01:00
2026-03-02 00:23:24 +01:00
2026-03-21 02:24:36 +00:00
2025-12-09 17:29:23 +00:00
2025-11-09 22:14:48 +00:00
2025-11-09 22:14:48 +00:00
2026-02-07 17:09:23 -05:00
2026-01-13 01:16:58 +00:00
2025-10-31 20:44:01 +00:00
2025-10-31 20:44:01 +00:00
2026-01-13 01:16:58 +00:00
2026-01-26 17:34:31 +00:00
2025-10-31 20:44:01 +00:00
2025-10-31 20:38:31 +00:00
2025-11-21 20:34:35 +08:00
2026-04-15 00:59:25 -07:00
2026-02-17 16:51:44 +00:00
2026-02-17 16:51:44 +00:00
2025-11-21 20:34:35 +08:00
2026-07-08 18:38:30 +10:00
2025-11-27 14:13:58 -05:00
2025-11-27 14:13:58 -05:00
2025-11-27 14:13:58 -05:00
2026-07-13 22:48:25 +00:00
2026-03-28 16:18:11 +09:00
2026-03-28 16:18:11 +09:00
2025-12-01 18:12:35 -07:00
2025-12-01 18:12:35 -07:00
2026-02-17 16:51:44 +00:00
2026-02-17 16:51:44 +00:00
2026-03-20 19:33:05 +00:00
2026-03-20 19:33:05 +00:00
2026-07-15 12:08:14 +00:00
2026-02-01 18:20:30 +00:00
2026-02-01 18:20:30 +00:00
2026-02-01 18:20:30 +00:00
2026-02-01 18:20:30 +00:00
2026-07-15 12:08:14 +00:00
2026-07-09 17:36:19 +02:00
2026-07-07 17:31:05 +01:00
2026-07-07 17:31:05 +01:00
2026-04-06 12:36:45 +08:00
2025-12-29 17:41:49 -08:00
2026-04-06 12:36:45 +08:00
2025-12-02 18:25:13 +00:00
2026-07-15 23:38:07 +02:00
2026-07-15 23:38:07 +02:00
2026-03-10 09:35:03 -04:00
2026-02-01 18:20:31 +00:00
2026-03-10 09:35:03 -04:00
2026-04-24 23:00:28 +09:00
2026-04-24 23:00:28 +09:00
2026-03-21 02:24:36 +00:00
2026-05-02 17:59:25 +02:00
2025-11-27 11:19:00 -05:00
2025-11-27 11:19:00 -05:00
2026-06-27 16:43:23 +06:00
2026-06-26 23:28:41 +06:00
2026-03-21 02:24:36 +00:00
2026-01-08 16:07:18 -05:00
2026-02-28 20:32:20 -08:00
2026-02-28 20:32:20 -08:00
2026-02-28 20:32:20 -08:00
2026-01-26 04:09:28 +05:30
2026-01-26 04:09:28 +05:30
2026-07-07 09:40:03 +08:00
2026-07-07 09:40:03 +08:00
2025-11-21 20:34:35 +08:00
2025-11-21 20:34:35 +08:00
2025-11-21 20:34:35 +08:00
2025-11-21 20:34:35 +08:00
2025-11-21 20:34:35 +08:00
2025-11-21 20:34:35 +08:00
2026-05-04 10:55:24 -03:00
2026-07-15 16:35:42 +00:00
2026-04-19 12:32:26 +08:00
2026-04-19 12:32:26 +08:00
2026-04-19 12:32:26 +08:00
2026-03-15 03:51:25 +00:00
2026-03-15 03:51:25 +00:00
2026-03-24 22:31:37 +09:00
2026-01-21 19:00:03 +03:00
2026-01-21 19:00:03 +03:00
2026-04-15 01:38:14 +00:00
2026-04-15 01:38:14 +00:00
2026-04-15 01:38:14 +00:00
2025-11-09 22:14:48 +00:00
2025-12-01 18:12:35 -07:00
2025-11-27 11:19:00 -05:00
2025-11-27 11:19:00 -05:00
2026-02-17 16:51:44 +00:00
2026-02-17 16:51:44 +00:00
2025-12-29 15:24:25 +08:00
2026-03-28 16:18:11 +09:00
2026-02-18 18:33:35 +00:00
2026-02-28 05:29:28 +00:00
2026-02-28 05:29:28 +00:00
2026-02-28 05:29:28 +00:00
2026-07-08 23:47:21 +02:00
2026-07-08 23:47:21 +02:00
2026-05-31 04:04:30 +05:30
2026-05-31 04:04:30 +05:30
2025-12-02 18:25:13 +00:00
2026-04-25 08:46:06 +09:00
2026-04-25 08:46:06 +09:00
2026-04-25 08:46:06 +09:00
2026-05-09 17:50:35 +12:00
2026-05-09 17:50:35 +12:00
2026-02-17 16:51:44 +00:00
2026-02-17 16:51:44 +00:00
2026-04-19 12:32:26 +08:00
2025-11-27 11:19:00 -05:00
2025-11-27 11:19:00 -05:00
2025-11-27 11:19:00 -05:00
2026-06-15 12:02:46 +00:00
2026-06-15 12:02:46 +00:00
2025-11-04 22:33:13 +00:00
2026-05-27 18:16:17 +08:00
2026-05-27 18:16:17 +08:00
2026-05-27 18:16:17 +08:00