bors
47dd709bed
Auto merge of #121123 - compiler-errors:item-assumptions, r=oli-obk
...
Split an item bounds and an item's super predicates
This is the moral equivalent of #107614 , but instead for predicates this applies to **item bounds**. This PR splits out the item bounds (i.e. *all* predicates that are assumed to hold for the alias) from the item *super predicates*, which are the subset of item bounds which share the same self type as the alias.
## Why?
Much like #107614 , there are places in the compiler where we *only* care about super-predicates, and considering predicates that possibly don't have anything to do with the alias is problematic. This includes things like closure signature inference (which is at its core searching for `Self: Fn(..)` style bounds), but also lints like `#[must_use]`, error reporting for aliases, computing type outlives predicates.
Even in cases where considering all of the `item_bounds` doesn't lead to bugs, unnecessarily considering irrelevant bounds does lead to a regression (#121121 ) due to doing extra work in the solver.
## Example 1 - Trait Aliases
This is best explored via an example:
```
type TAIT<T> = impl TraitAlias<T>;
trait TraitAlias<T> = A + B where T: C;
```
The item bounds list for `Tait<T>` will include:
* `Tait<T>: A`
* `Tait<T>: B`
* `T: C`
While `item_super_predicates` query will include just the first two predicates.
Side-note: You may wonder why `T: C` is included in the item bounds for `TAIT`? This is because when we elaborate `TraitAlias<T>`, we will also elaborate all the predicates on the trait.
## Example 2 - Associated Type Bounds
```
type TAIT<T> = impl Iterator<Item: A>;
```
The `item_bounds` list for `TAIT<T>` will include:
* `Tait<T>: Iterator`
* `<Tait<T> as Iterator>::Item: A`
But the `item_super_predicates` will just include the first bound, since that's the only bound that is relevant to the *alias* itself.
## So what
This leads to some diagnostics duplication just like #107614 , but none of it will be user-facing. We only see it in the UI test suite because we explicitly disable diagnostic deduplication.
Regarding naming, I went with `super_predicates` kind of arbitrarily; this can easily be changed, but I'd consider better names as long as we don't block this PR in perpetuity.
2024-03-21 06:12:24 +00:00
..
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-03-20 13:00:34 -04:00
2024-03-20 13:00:34 -04:00
2024-02-16 20:02:50 +00:00
2024-02-19 22:04:58 +00:00
2024-02-16 20:02:50 +00:00
2023-05-25 02:45:14 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-03-12 06:03:43 +00:00
2024-03-12 06:03:43 +00:00
2024-02-16 20:02:50 +00:00
2024-02-26 10:57:46 +01:00
2023-11-24 19:15:52 +01:00
2024-02-26 10:57:46 +01:00
2023-08-28 03:16:48 -07:00
2024-01-30 21:28:18 +00:00
2024-02-16 20:02:50 +00:00
2023-10-26 17:58:02 +00:00
2024-03-11 17:19:37 +00:00
2024-03-10 21:18:41 -04:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-09-08 03:45:36 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-09-08 03:45:36 +00:00
2023-09-08 03:45:36 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 21:04:51 +01:00
2023-09-21 08:17:58 +02:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-01-24 02:53:15 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2023-06-11 00:19:56 +00:00
2023-11-24 19:15:52 +01:00
2024-01-24 16:57:15 +00:00
2024-01-24 16:57:15 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-05-18 01:53:01 +00:00
2024-01-30 21:28:18 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-22 08:03:47 +11:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-06-27 23:31:06 +00:00
2024-03-18 16:44:12 +00:00
2024-03-18 16:44:12 +00:00
2024-03-18 16:44:12 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-07 10:42:01 +08:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-05-13 10:51:21 +02:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-09-08 03:45:36 +00:00
2024-03-20 13:00:34 -04:00
2024-03-20 13:00:34 -04:00
2023-11-24 19:15:52 +01:00
2024-01-09 21:08:16 +00:00
2024-02-16 20:02:50 +00:00
2024-02-28 09:54:44 +00:00
2024-02-28 09:54:44 +00:00
2024-02-28 09:54:44 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-01-09 21:08:16 +00:00
2024-01-30 21:28:18 +00:00
2023-11-24 19:15:52 +01:00
2024-03-20 17:29:58 +00:00
2024-03-20 17:29:58 +00:00
2024-03-20 17:29:58 +00:00
2024-03-20 17:29:58 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-03-08 19:08:13 +00:00
2023-05-12 10:26:50 +00:00
2023-06-22 15:00:12 +00:00
2023-07-07 13:13:18 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2023-04-12 16:17:31 +00:00
2024-01-30 21:28:18 +00:00
2024-02-16 20:02:50 +00:00
2023-10-05 01:04:41 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2023-04-12 16:17:31 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-01-11 09:52:25 +00:00
2024-01-11 09:52:25 +00:00
2023-11-24 19:15:52 +01:00
2023-08-14 15:25:20 +02:00
2023-08-14 15:25:20 +02:00
2023-08-14 15:25:20 +02:00
2023-09-21 22:20:58 +02:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-07-15 22:02:16 +00:00
2024-03-10 21:18:41 -04:00
2024-03-10 21:18:41 -04:00
2024-03-10 21:18:41 -04:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2023-05-31 17:45:45 +00:00
2023-11-24 19:15:52 +01:00
2024-02-08 08:10:43 +00:00
2024-02-08 08:10:43 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-01-07 18:00:03 +00:00
2024-01-30 21:28:18 +00:00
2024-02-16 20:02:50 +00:00
2023-10-16 15:50:31 +00:00
2024-02-16 20:02:50 +00:00
2023-10-16 15:50:31 +00:00
2024-02-16 20:02:50 +00:00
2023-06-16 19:39:48 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-06-16 19:39:48 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-06-16 19:39:48 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2023-08-04 15:11:09 +00:00
2023-11-24 19:15:52 +01:00
2024-03-20 17:30:19 +00:00
2024-03-20 17:30:19 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-22 18:05:28 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-03-18 16:08:58 +00:00
2024-02-16 20:02:50 +00:00
2024-02-14 11:00:30 +00:00
2024-02-14 11:00:30 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-03-20 13:00:34 -04:00
2024-03-20 13:00:34 -04:00
2023-05-18 01:53:01 +00:00
2023-05-18 01:53:01 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-03-10 21:18:41 -04:00
2024-03-10 21:18:41 -04:00
2024-03-10 21:18:41 -04:00
2024-03-10 21:18:41 -04:00
2024-03-10 21:18:41 -04:00
2024-02-16 20:02:50 +00:00
2024-01-08 20:30:24 +00:00
2024-01-08 20:30:24 +00:00
2024-02-16 20:02:50 +00:00
2023-12-07 23:00:46 -05:00
2023-06-16 19:39:48 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-03-10 21:18:41 -04:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-02-29 11:08:27 +11:00
2024-02-29 11:08:27 +11:00
2024-02-16 20:02:50 +00:00
2023-09-21 22:20:58 +02:00
2024-03-20 13:00:34 -04:00
2024-03-20 13:00:34 -04:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-03-10 21:18:41 -04:00
2024-03-10 21:18:41 -04:00
2024-03-10 21:18:41 -04:00
2024-03-10 21:18:41 -04:00
2024-03-10 21:18:41 -04:00
2024-03-10 21:18:41 -04:00
2024-03-10 21:18:41 -04:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-07 10:42:01 +08:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-04-12 22:50:10 +00:00
2023-06-26 19:14:49 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2023-12-05 19:53:59 +00:00
2023-12-05 19:53:59 +00:00
2023-12-05 19:53:59 +00:00
2024-02-16 20:02:50 +00:00
2024-02-27 15:57:49 +01:00
2024-02-27 15:57:49 +01:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-02-19 23:54:49 +00:00
2024-03-07 14:26:31 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00