Commit 4ed2eda
committed
Auto merge of #42281 - eddyb:well-adjusted, r=nikomatsakis
Decompose Adjustment into smaller steps and remove the method map.
The method map held method callee information for:
* actual method calls (`x.f(...)`)
* overloaded unary, binary, indexing and call operators
* *every overloaded deref adjustment* (many can exist for each expression)
That last one was a historical ~~accident~~ hack, and part of the motivation for this PR, along with:
* a desire to compose adjustments more freely
* containing the autoderef logic better to avoid mutation within an inference snapshot
* not creating `TyFnDef` types which are incompatible with the original one
* i.e. we used to take a`TyFnDef`'s `for<'a> &'a T -> &'a U` signature and instantiate `'a` using a region inference variable, *then* package the resulting `&'b T -> &'b U` signature in another `TyFnDef`, while keeping *the same* `DefId` and `Substs`
* to fix #3548 by explicitly writing autorefs for the RHS of comparison operators
Individual commits tell their own story, of "atomic" changes avoiding breaking semantics.
Future work based on this PR could include:
* removing the signature from `TyFnDef`, now that it's always "canonical"
* some questions of variance remain, as subtyping *still* treats the signature differently
* moving part of the typeck logic for methods, autoderef and coercion into `rustc::traits`
* allowing LUB coercions (joining multiple expressions) to "stack up" many adjustments
* transitive coercions (e.g. reify or unsize after multiple steps of autoderef)
r? @nikomatsakisFile tree
49 files changed
+1479
-2147
lines changed- src
- libcollections/tests
- librustc_borrowck/borrowck
- gather_loans
- librustc_const_eval
- librustc_lint
- librustc_mir
- build/expr
- hair/cx
- librustc_passes
- librustc_save_analysis
- librustc_typeck
- check
- method
- librustc
- cfg
- ich
- infer
- middle
- ty
- util
- libstd/sync/mpsc
- test/ui
- impl-trait
- mismatched_types
- span
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
49 files changed
+1479
-2147
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | | - | |
| 137 | + | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
| 140 | + | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
| 143 | + | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
| 146 | + | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
150 | 150 | | |
151 | 151 | | |
152 | | - | |
| 152 | + | |
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
358 | | - | |
| 358 | + | |
359 | 359 | | |
360 | 360 | | |
361 | 361 | | |
362 | | - | |
| 362 | + | |
363 | 363 | | |
364 | 364 | | |
365 | 365 | | |
| |||
412 | 412 | | |
413 | 413 | | |
414 | 414 | | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | 415 | | |
422 | 416 | | |
423 | 417 | | |
424 | | - | |
| 418 | + | |
425 | 419 | | |
426 | 420 | | |
427 | 421 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | 22 | | |
25 | 23 | | |
26 | 24 | | |
| |||
101 | 99 | | |
102 | 100 | | |
103 | 101 | | |
104 | | - | |
105 | | - | |
106 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
107 | 108 | | |
108 | | - | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
116 | | - | |
| 115 | + | |
117 | 116 | | |
118 | 117 | | |
119 | 118 | | |
| |||
601 | 600 | | |
602 | 601 | | |
603 | 602 | | |
604 | | - | |
| 603 | + | |
605 | 604 | | |
606 | | - | |
| 605 | + | |
607 | 606 | | |
608 | | - | |
609 | 607 | | |
610 | 608 | | |
611 | 609 | | |
| |||
622 | 620 | | |
623 | 621 | | |
624 | 622 | | |
625 | | - | |
| 623 | + | |
626 | 624 | | |
627 | | - | |
| 625 | + | |
628 | 626 | | |
629 | | - | |
630 | | - | |
631 | | - | |
632 | | - | |
633 | | - | |
634 | | - | |
635 | | - | |
636 | | - | |
637 | | - | |
638 | | - | |
639 | | - | |
640 | 627 | | |
641 | 628 | | |
642 | 629 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
564 | 564 | | |
565 | 565 | | |
566 | 566 | | |
567 | | - | |
| 567 | + | |
568 | 568 | | |
569 | 569 | | |
570 | 570 | | |
571 | 571 | | |
572 | 572 | | |
573 | 573 | | |
| 574 | + | |
574 | 575 | | |
575 | 576 | | |
576 | 577 | | |
| |||
888 | 889 | | |
889 | 890 | | |
890 | 891 | | |
891 | | - | |
| 892 | + | |
892 | 893 | | |
893 | 894 | | |
894 | 895 | | |
| |||
901 | 902 | | |
902 | 903 | | |
903 | 904 | | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
904 | 911 | | |
905 | 912 | | |
906 | 913 | | |
| |||
911 | 918 | | |
912 | 919 | | |
913 | 920 | | |
914 | | - | |
| 921 | + | |
| 922 | + | |
915 | 923 | | |
916 | 924 | | |
917 | 925 | | |
| |||
938 | 946 | | |
939 | 947 | | |
940 | 948 | | |
941 | | - | |
| 949 | + | |
| 950 | + | |
942 | 951 | | |
943 | 952 | | |
944 | 953 | | |
| |||
1645 | 1654 | | |
1646 | 1655 | | |
1647 | 1656 | | |
1648 | | - | |
1649 | | - | |
1650 | | - | |
1651 | | - | |
1652 | | - | |
1653 | | - | |
1654 | | - | |
1655 | | - | |
1656 | | - | |
1657 | | - | |
1658 | | - | |
1659 | | - | |
1660 | | - | |
1661 | | - | |
1662 | | - | |
1663 | | - | |
1664 | | - | |
1665 | | - | |
1666 | | - | |
1667 | | - | |
1668 | | - | |
1669 | | - | |
1670 | | - | |
1671 | 1657 | | |
1672 | 1658 | | |
1673 | 1659 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
99 | | - | |
100 | | - | |
| 98 | + | |
101 | 99 | | |
102 | 100 | | |
103 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
| |||
174 | 173 | | |
175 | 174 | | |
176 | 175 | | |
177 | | - | |
178 | | - | |
| 176 | + | |
| 177 | + | |
179 | 178 | | |
180 | 179 | | |
181 | 180 | | |
| |||
0 commit comments