Commit e856e21
committed
Auto merge of #795 - lowr:fix/clauses-for-assoc-placeholders, r=jackh726
Generate clauses for placeholder associated types
Currently, we don't generate clauses for placeholder associated types (`TyKind::AssociatedType`) except for some `FromEnv`s. This leads to `NoSolution` for goals like `(IntoIterator::IntoIter)<Opaque>: Iterator` where `Opaque = impl IntoIterator`.
For every associated type in a trait definition
```rust
trait Foo {
type Assoc<'a, T>: Bar<U = Ty> where WC;
}
```
chalk with this patch generates
```rust
forall<Self, 'a, T> {
Implemented((Foo::Assoc<'a, T>)<Self>: Bar) :- WC.
AliasEq(<<(Foo::Assoc<'a, T>)<Self>> as Bar>::U = Ty) :- WC.
}
```
To be honest, I'm not entirely sure if `AssociatedTyDatum::to_program_clauses()` is the best place to generate those clauses in, but analogous clauses for placeholder opaque types are generated in `OpaqueTyDatum::to_program_clauses()`, which I modeled after.
Spotted in rust-lang/rust-analyzer#14680.File tree
3 files changed
+99
-10
lines changed- chalk-solve/src
- clauses
- tests/test
3 files changed
+99
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
440 | 440 | | |
441 | 441 | | |
442 | 442 | | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
443 | 448 | | |
444 | 449 | | |
445 | 450 | | |
| |||
519 | 524 | | |
520 | 525 | | |
521 | 526 | | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
522 | 531 | | |
523 | 532 | | |
524 | 533 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
768 | 768 | | |
769 | 769 | | |
770 | 770 | | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
771 | 789 | | |
772 | 790 | | |
773 | 791 | | |
| |||
818 | 836 | | |
819 | 837 | | |
820 | 838 | | |
821 | | - | |
| 839 | + | |
822 | 840 | | |
823 | 841 | | |
824 | 842 | | |
825 | | - | |
| 843 | + | |
826 | 844 | | |
827 | 845 | | |
828 | 846 | | |
| |||
839 | 857 | | |
840 | 858 | | |
841 | 859 | | |
842 | | - | |
| 860 | + | |
843 | 861 | | |
844 | 862 | | |
845 | 863 | | |
| |||
856 | 874 | | |
857 | 875 | | |
858 | 876 | | |
859 | | - | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
860 | 881 | | |
861 | 882 | | |
862 | 883 | | |
| |||
869 | 890 | | |
870 | 891 | | |
871 | 892 | | |
872 | | - | |
| 893 | + | |
873 | 894 | | |
874 | 895 | | |
875 | 896 | | |
876 | 897 | | |
877 | | - | |
878 | | - | |
879 | | - | |
880 | | - | |
881 | | - | |
882 | 898 | | |
883 | 899 | | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
884 | 905 | | |
885 | 906 | | |
886 | 907 | | |
| |||
890 | 911 | | |
891 | 912 | | |
892 | 913 | | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
893 | 926 | | |
894 | 927 | | |
895 | 928 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1226 | 1226 | | |
1227 | 1227 | | |
1228 | 1228 | | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
0 commit comments