Matthias Krüger
ae92125a75
Rollup merge of #127574 - lcnr:coherence-check-supertrait, r=compiler-errors
...
elaborate unknowable goals
A reimplemented version of #124532 affecting only the new solver. Always trying to prove super traits ends up causing a fatal overflow error in diesel, so we cannot land this in the old solver.
The following test currently does not pass coherence:
```rust
trait Super {}
trait Sub<T>: Super {}
trait Overlap<T> {}
impl<T, U: Sub<T>> Overlap<T> for U {}
impl<T> Overlap<T> for () {}
fn main() {}
```
We check whether `(): Sub<?t>` holds. This stalls with ambiguity as downstream crates may add an impl for `(): Sub<Local>`. However, its super trait bound `(): Super` cannot be implemented downstream, so this one is known not to hold.
By trying to prove that all the super bounds of a trait before adding a coherence unknowable candidate, this compiles. This is necessary to prevent breakage from enabling `-Znext-solver=coherence` (#121848 ), see tests/ui/coherence/super-traits/super-trait-knowable-2.rs for more details. The idea is that while there may be an impl of the trait itself we don't know about, if we're able to prove that a super trait is definitely not implemented, then that impl would also never apply/not be well-formed.
This approach is different from #124532 as it allows tests/ui/coherence/super-traits/super-trait-knowable-3.rs to compile. The approach in #124532 only elaborating the root obligations while this approach tries it for all unknowable trait goals.
r? `@compiler-errors`
2024-07-30 04:31:54 +02:00
..
2024-07-18 18:39:20 +00:00
2024-03-11 09:36:35 -07:00
2024-03-11 09:36:35 -07:00
2024-07-18 00:19:27 +00:00
2024-05-04 11:30:38 +02:00
2024-07-22 22:51:53 +00:00
2024-07-28 03:11:54 +08:00
2024-07-28 08:57:16 +02:00
2024-07-18 11:58:16 +02:00
2024-07-23 01:48:03 +02:00
2024-07-23 01:48:03 +02:00
2024-07-26 13:56:06 -04:00
2024-07-28 20:07:46 +02:00
2024-07-25 22:50:58 +00:00
2024-07-24 17:19:44 -04:00
2024-05-20 19:55:59 -07:00
2024-07-12 11:52:04 -04:00
2024-05-02 19:42:31 -04:00
2024-06-25 10:00:30 +08:00
2024-07-18 00:00:04 +00:00
2024-07-25 16:48:21 +02:00
2024-04-24 22:21:15 +00:00
2024-04-11 16:41:41 +00:00
2024-07-14 13:50:09 +09:00
2024-07-14 13:50:09 +09:00
2024-07-12 18:52:52 +00:00
2024-07-23 09:45:28 +00:00
2024-07-22 21:51:44 -04:00
2024-07-18 14:32:10 +02:00
2024-07-19 23:27:42 +03:00
2024-07-18 20:08:38 +00:00
2024-06-17 10:57:52 +00:00
2024-07-30 04:31:54 +02:00
2024-03-11 09:36:35 -07:00
2024-07-06 21:00:30 +08:00
2024-04-07 17:06:15 +00:00
2024-07-12 03:02:57 +00:00
2024-05-28 11:55:20 +00:00
2024-07-26 02:20:28 -04:00
2024-07-27 21:12:54 +02:00
2024-07-27 21:12:54 +02:00
2024-07-21 22:32:29 -04:00
2024-07-12 03:02:57 +00:00
2024-03-18 16:08:58 +00:00
2024-06-04 22:50:35 +02:00
2024-07-11 12:23:44 +10:00
2024-07-16 18:03:15 +03:00
2024-06-22 17:06:47 +00:00
2024-06-14 20:25:17 +02:00
2024-04-21 15:43:43 -03:00
2024-07-26 21:56:35 +08:00
2024-07-06 14:24:20 +02:00
2024-07-11 08:14:28 +02:00
2024-04-25 10:48:11 +03:00
2024-07-12 03:02:57 +00:00
2024-07-18 18:39:20 +00:00
2024-07-02 02:30:38 +01:00
2024-07-18 00:00:04 +00:00
2024-04-22 11:51:50 -04:00
2024-05-09 14:47:09 +10:00
2024-06-13 21:47:43 -04:00
2024-07-18 18:20:35 +00:00
2024-07-18 18:20:35 +00:00
2024-03-17 21:59:40 +00:00
2024-07-27 21:12:54 +02:00
2024-04-27 10:54:31 +03:00
2024-07-22 10:12:00 -04:00
2024-07-07 18:16:38 +02:00
2024-07-18 18:20:35 +00:00
2024-07-17 16:22:26 +02:00
2024-06-11 09:14:34 +01:00
2024-07-29 17:50:12 +01:00
2024-05-20 19:55:59 -07:00
2024-07-12 03:02:57 +00:00
2024-07-17 16:22:26 +02:00
2024-05-20 19:55:59 -07:00
2024-05-16 21:08:42 -04:00
2024-04-30 12:46:59 +05:30
2024-05-20 19:55:59 -07:00
2024-05-20 19:55:59 -07:00
2024-04-12 20:57:07 +00:00
2024-07-22 22:51:53 +00:00
2024-07-17 11:01:29 +01:00
2024-07-22 22:51:53 +00:00
2024-07-12 03:02:57 +00:00
2024-07-25 22:50:58 +00:00
2024-07-11 12:23:44 +10:00
2024-05-24 11:20:33 -04:00
2024-07-25 04:43:18 +02:00
2024-07-13 13:12:52 +00:00
2024-07-24 21:03:27 +00:00
2024-03-29 18:22:44 -07:00
2024-06-21 19:00:18 -04:00
2024-06-01 09:40:46 +08:00
2024-07-29 22:29:34 +08:00
2024-06-26 16:01:45 +00:00
2024-07-18 11:58:16 +02:00
2024-06-21 19:00:18 -04:00
2024-04-15 08:54:11 -04:00
2024-07-11 12:23:44 +10:00
2024-04-25 07:58:31 +02:00
2024-07-11 12:23:44 +10:00
2024-07-30 04:31:54 +02:00
2024-07-12 21:16:09 -04:00
2024-07-24 21:03:27 +00:00
2024-06-12 20:57:23 -04:00
2024-07-12 03:02:57 +00:00
2024-07-25 15:14:42 -04:00
2024-07-22 22:51:53 +00:00
2024-07-24 18:00:35 +02:00
2024-07-19 18:53:40 +02:00
2024-07-12 03:22:32 +00:00
2024-07-18 20:08:38 +00:00
2024-07-22 22:51:53 +00:00
2024-07-11 12:23:44 +10:00
2024-06-29 13:02:59 +02:00
2024-07-29 21:26:13 +02:00
2024-07-04 02:02:21 +00:00
2024-06-20 04:25:17 +00:00
2024-04-29 14:53:38 +02:00
2024-07-21 13:45:55 -04:00
2024-07-27 05:33:24 -04:00
2024-07-18 20:08:38 +00:00
2024-05-28 12:31:33 +02:00
2024-03-31 20:44:30 -04:00
2024-07-05 11:17:49 -04:00
2024-05-20 11:13:10 -04:00
2024-07-29 17:46:43 +02:00
2024-07-21 21:42:10 +08:00
2024-07-17 16:22:26 +02:00
2024-04-21 20:10:12 -04:00
2024-04-07 17:38:07 -03:00
2024-07-11 17:01:36 +02:00
2024-07-04 02:02:21 +00:00
2024-06-13 20:22:21 +00:00
2024-07-11 12:23:44 +10:00
2024-06-28 22:23:43 +02:00
2024-07-21 22:32:29 -04:00
2024-06-16 03:41:57 -04:00
2024-07-18 18:20:35 +00:00
2024-03-20 17:29:58 +00:00
2024-07-26 00:57:20 +02:00
2024-07-29 17:50:12 +01:00
2024-06-12 12:34:47 +00:00
2024-07-12 03:02:57 +00:00
2024-07-24 08:46:52 +02:00
2024-07-11 12:23:44 +10:00
2024-07-11 12:23:44 +10:00
2024-05-28 12:31:12 +02:00
2024-07-11 12:23:44 +10:00
2024-07-26 19:03:08 -04:00
2024-06-27 22:24:36 +02:00
2024-07-24 08:46:52 +02:00
2024-07-24 22:59:57 -04:00
2024-04-11 17:53:27 -04:00
2024-04-24 08:05:29 +00:00
2024-07-26 02:20:28 -04:00
2024-07-24 21:03:52 +10:00
2024-07-11 12:23:44 +10:00
2024-07-18 18:10:15 +02:00
2024-07-12 03:02:57 +00:00
2024-05-03 15:56:59 +02:00
2024-07-24 08:02:55 +02:00
2024-07-12 21:16:09 -04:00
2024-06-24 03:39:54 +00:00
2024-07-11 20:39:24 +00:00
2024-07-11 12:23:44 +10:00
2024-07-26 02:20:30 -04:00
2024-06-30 23:11:54 -04:00
2024-07-28 08:57:16 +02:00
2024-05-28 12:31:12 +02:00
2024-06-13 20:22:21 +00:00
2024-05-23 09:07:59 +08:00
2024-07-28 13:42:18 +02:00
2024-05-19 20:09:03 -07:00
2024-07-18 20:08:38 +00:00
2024-07-29 17:46:42 +02:00
2024-07-18 13:33:38 +00:00
2024-05-04 11:30:38 +02:00
2024-07-24 21:03:27 +00:00
2024-03-09 18:24:45 +00:00
2024-07-02 16:31:40 +02:00
2024-07-18 20:08:38 +00:00
2024-07-16 19:27:28 -07:00
2024-06-30 17:08:45 +00:00
2024-03-25 14:19:07 +00:00
2024-07-23 13:06:54 +02:00
2024-07-21 05:36:21 +00:00
2024-07-16 19:27:28 -07:00
2024-04-28 16:10:12 -04:00
2024-04-28 16:10:12 -04:00
2024-07-18 20:08:38 +00:00
2024-07-22 22:51:53 +00:00
2024-06-05 23:20:09 +08:00
2024-07-25 22:33:45 +08:00
2024-07-17 11:01:29 +01:00
2024-05-24 17:44:37 -07:00
2024-07-17 07:55:22 +08:00
2024-07-15 22:21:41 +00:00
2024-07-11 00:18:47 +08:00
2024-05-23 13:44:56 +02:00
2024-07-10 18:56:06 -04:00
2024-07-11 12:23:44 +10:00
2024-07-14 17:46:25 +05:30
2024-07-29 17:46:42 +02:00
2024-07-22 22:51:53 +00:00
2024-07-11 12:23:44 +10:00
2024-07-11 12:23:44 +10:00
2024-07-23 01:48:03 +02:00
2024-07-04 05:19:35 +00:00
2024-07-22 07:29:59 +02:00
2024-07-14 13:50:09 +09:00
2024-07-23 01:48:03 +02:00
2024-07-23 01:26:25 +02:00
2024-07-22 22:51:53 +00:00
2024-07-24 16:00:48 +00:00
2024-04-10 00:41:27 +00:00
2024-07-25 04:43:19 +02:00
2024-07-11 20:39:24 +00:00
2024-07-22 22:51:53 +00:00
2024-07-22 22:51:53 +00:00
2024-07-24 21:03:27 +00:00
2024-03-20 17:29:58 +00:00
2024-07-24 08:02:55 +02:00
2024-04-24 22:21:15 +00:00
2024-05-20 19:55:59 -07:00
2024-07-11 12:23:44 +10:00
2024-07-24 21:03:27 +00:00
2024-07-04 06:06:33 +00:00
2024-07-25 20:53:33 +03:00
2024-03-24 09:34:11 +01:00
2024-06-03 07:25:32 +02:00
2024-06-19 13:54:55 +01:00
2024-05-21 20:16:39 +00:00
2024-07-26 13:56:06 -04:00
2024-07-18 00:00:04 +00:00
2024-05-09 14:47:09 +10:00
2024-03-22 11:27:34 -04:00
2024-07-18 16:51:06 -04:00
2024-06-19 04:41:56 +00:00
2024-07-02 11:37:59 -04:00
2024-06-13 12:55:55 +02:00
2024-03-27 14:02:16 +00:00
2024-07-04 02:02:21 +00:00
2024-07-04 02:02:21 +00:00
2024-04-17 13:00:43 +02:00
2024-04-11 16:41:41 +00:00
2024-04-11 16:41:41 +00:00
2024-06-25 10:00:30 +08:00
2024-07-04 05:36:34 +00:00
2024-07-04 02:02:21 +00:00
2024-07-22 22:51:53 +00:00
2024-07-11 12:23:44 +10:00
2024-06-11 15:47:00 +02:00
2024-04-07 01:16:45 +02:00
2024-03-12 10:59:41 +01:00
2024-04-07 01:16:45 +02:00
2024-05-28 12:31:33 +02:00
2024-07-25 20:53:33 +03:00
2024-07-06 21:00:30 +08:00
2024-07-06 21:00:30 +08:00
2024-06-25 10:00:30 +08:00
2024-07-02 11:37:59 -04:00
2024-04-07 01:16:45 +02:00
2024-04-15 08:54:11 -04:00
2024-04-15 08:54:11 -04:00
2024-07-14 13:50:09 +09:00
2024-04-11 16:41:42 +00:00
2024-03-11 09:36:35 -07:00
2024-03-11 09:36:35 -07:00
2024-07-22 22:51:53 +00:00
2024-06-25 18:06:22 +02:00
2024-03-11 09:36:35 -07:00
2024-07-12 21:16:09 -04:00
2024-07-02 15:48:48 -04:00
2024-04-17 13:00:43 +02:00
2024-04-17 13:00:43 +02:00
2024-07-11 12:23:44 +10:00
2024-07-05 00:52:01 +00:00
2024-06-29 19:39:09 +08:00
2024-05-20 11:13:10 -04:00
2024-04-24 08:05:29 +00:00
2024-05-11 15:13:18 +02:00