Commit c6c7866
committed
auto merge of #20490 : japaric/rust/assoc-types, r=aturon
closes #20486
closes #20474
closes #20441
[breaking-change]
The `Index[Mut]` traits now have one less input parameter, as the return type of the indexing operation is an associated type. This breaks all existing implementations.
---
binop traits (`Add`, `Sub`, etc) now have an associated type for their return type. Also, the RHS input parameter now defaults to `Self` (except for the `Shl` and `Shr` traits). For example, the `Add` trait now looks like this:
``` rust
trait Add<Rhs=Self> {
type Output;
fn add(self, Rhs) -> Self::Output;
}
```
The `Neg` and `Not` traits now also have an associated type for their return type.
This breaks all existing implementations of these traits.
---
Affected traits:
- `Iterator { type Item }`
- `IteratorExt` no input/output types, uses `<Self as Iterator>::Item` in its methods
- `DoubleEndedIterator` no input/output types, uses `<Self as Iterator>::Item` in its methods
- `DoubleEndedIteratorExt` no input/output types, uses `<Self as Iterator>::Item` in its methods
- `RandomAccessIterator` no input/output types
- `ExactSizeIterator` no input/output types, uses `<Self as Iterator>::Item` in its methods
This breaks all the implementations of these traits.File tree
137 files changed
+1788
-826
lines changed- src
- libcollections
- btree
- libcoretest
- num
- libcore
- fmt
- num
- str
- libfmt_macros
- libgraphviz
- librand
- libregex_macros
- libregex
- librustc_driver
- librustc_trans
- back
- trans
- librustc_typeck
- check
- librustc
- metadata
- middle
- cfg
- traits
- session
- librustdoc
- libserialize
- libstd
- collections/hash
- io
- num
- path
- prelude
- rand
- sync/mpsc
- time
- libsyntax
- ast_map
- ext
- tt
- parse
- util
- libtest
- libtime
- libunicode
- test
- auxiliary
- bench
- compile-fail
- run-pass
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
137 files changed
+1788
-826
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
573 | 573 | | |
574 | 574 | | |
575 | 575 | | |
576 | | - | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
577 | 579 | | |
578 | 580 | | |
579 | 581 | | |
| |||
582 | 584 | | |
583 | 585 | | |
584 | 586 | | |
585 | | - | |
| 587 | + | |
586 | 588 | | |
587 | 589 | | |
588 | 590 | | |
589 | 591 | | |
590 | 592 | | |
591 | | - | |
| 593 | + | |
592 | 594 | | |
593 | 595 | | |
594 | 596 | | |
595 | 597 | | |
596 | 598 | | |
597 | 599 | | |
598 | 600 | | |
599 | | - | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
600 | 604 | | |
601 | 605 | | |
602 | 606 | | |
| |||
605 | 609 | | |
606 | 610 | | |
607 | 611 | | |
608 | | - | |
| 612 | + | |
609 | 613 | | |
610 | 614 | | |
611 | 615 | | |
612 | 616 | | |
613 | 617 | | |
614 | | - | |
| 618 | + | |
615 | 619 | | |
616 | 620 | | |
617 | 621 | | |
618 | 622 | | |
619 | 623 | | |
620 | 624 | | |
621 | 625 | | |
622 | | - | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
623 | 629 | | |
624 | 630 | | |
625 | 631 | | |
| |||
628 | 634 | | |
629 | 635 | | |
630 | 636 | | |
631 | | - | |
| 637 | + | |
632 | 638 | | |
633 | 639 | | |
634 | 640 | | |
635 | 641 | | |
636 | 642 | | |
637 | | - | |
| 643 | + | |
638 | 644 | | |
639 | 645 | | |
640 | 646 | | |
641 | | - | |
| 647 | + | |
642 | 648 | | |
643 | 649 | | |
644 | 650 | | |
645 | 651 | | |
646 | 652 | | |
647 | 653 | | |
648 | | - | |
| 654 | + | |
649 | 655 | | |
650 | 656 | | |
651 | 657 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| 167 | + | |
| 168 | + | |
167 | 169 | | |
168 | 170 | | |
169 | 171 | | |
| |||
176 | 178 | | |
177 | 179 | | |
178 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
179 | 196 | | |
180 | 197 | | |
181 | 198 | | |
| |||
938 | 955 | | |
939 | 956 | | |
940 | 957 | | |
941 | | - | |
| 958 | + | |
942 | 959 | | |
943 | 960 | | |
944 | 961 | | |
| |||
948 | 965 | | |
949 | 966 | | |
950 | 967 | | |
951 | | - | |
| 968 | + | |
952 | 969 | | |
953 | 970 | | |
954 | 971 | | |
| |||
1031 | 1048 | | |
1032 | 1049 | | |
1033 | 1050 | | |
1034 | | - | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
1035 | 1054 | | |
1036 | 1055 | | |
1037 | 1056 | | |
| |||
1050 | 1069 | | |
1051 | 1070 | | |
1052 | 1071 | | |
1053 | | - | |
| 1072 | + | |
1054 | 1073 | | |
1055 | 1074 | | |
1056 | 1075 | | |
| |||
1063 | 1082 | | |
1064 | 1083 | | |
1065 | 1084 | | |
1066 | | - | |
| 1085 | + | |
1067 | 1086 | | |
1068 | 1087 | | |
1069 | | - | |
| 1088 | + | |
1070 | 1089 | | |
1071 | 1090 | | |
1072 | 1091 | | |
| |||
1134 | 1153 | | |
1135 | 1154 | | |
1136 | 1155 | | |
1137 | | - | |
| 1156 | + | |
1138 | 1157 | | |
1139 | 1158 | | |
1140 | 1159 | | |
| |||
1144 | 1163 | | |
1145 | 1164 | | |
1146 | 1165 | | |
1147 | | - | |
| 1166 | + | |
1148 | 1167 | | |
1149 | 1168 | | |
1150 | 1169 | | |
| |||
1792 | 1811 | | |
1793 | 1812 | | |
1794 | 1813 | | |
1795 | | - | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
1796 | 1817 | | |
1797 | 1818 | | |
1798 | 1819 | | |
| |||
1813 | 1834 | | |
1814 | 1835 | | |
1815 | 1836 | | |
1816 | | - | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
1817 | 1840 | | |
1818 | 1841 | | |
1819 | 1842 | | |
| |||
1849 | 1872 | | |
1850 | 1873 | | |
1851 | 1874 | | |
1852 | | - | |
| 1875 | + | |
| 1876 | + | |
| 1877 | + | |
1853 | 1878 | | |
1854 | 1879 | | |
1855 | 1880 | | |
1856 | 1881 | | |
1857 | 1882 | | |
1858 | | - | |
| 1883 | + | |
| 1884 | + | |
| 1885 | + | |
1859 | 1886 | | |
1860 | 1887 | | |
1861 | 1888 | | |
1862 | 1889 | | |
1863 | 1890 | | |
1864 | | - | |
| 1891 | + | |
| 1892 | + | |
| 1893 | + | |
1865 | 1894 | | |
1866 | 1895 | | |
1867 | 1896 | | |
1868 | 1897 | | |
1869 | 1898 | | |
1870 | | - | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
1871 | 1902 | | |
1872 | 1903 | | |
1873 | 1904 | | |
| |||
0 commit comments