Commit 992aa1e
authored
Rollup merge of rust-lang#122879 - maurer:callsite-instances, r=workingjubilee
CFI: Strip auto traits off Virtual calls
We already use `Instance` at declaration sites when available to glean additional information about possible abstractions of the type in use. This does the same when possible at callsites as well.
The primary purpose of this change is to allow CFI to alter how it generates type information for indirect calls through `Virtual` instances.
This is needed for the "separate machinery" version of my approach to the vtable issues (rust-lang#122573), because we need to respond differently to a `Virtual` call to the same type as a non-virtual call, specifically [stripping auto traits off the receiver's `Self`](rust-lang@54b15b0) because there isn't a separate vtable for `Foo` vs `Foo + Send`.
This would also make a more general underlying mechanism that could be used by rcvalle's [proposed drop detection / encoding](rust-lang@edcd1e2) if we end up using his approach, as we could condition out on the `def_id` in the CFI code rather than requiring the generating code to explicitly note whether it was calling drop.File tree
14 files changed
+155
-58
lines changed- compiler
- rustc_codegen_gcc/src
- intrinsic
- rustc_codegen_llvm/src
- rustc_codegen_ssa/src
- mir
- traits
- rustc_symbol_mangling/src
- typeid
- tests/ui/sanitizer
14 files changed
+155
-58
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
541 | 541 | | |
542 | 542 | | |
543 | 543 | | |
544 | | - | |
| 544 | + | |
545 | 545 | | |
546 | 546 | | |
547 | 547 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
592 | 592 | | |
593 | 593 | | |
594 | 594 | | |
| 595 | + | |
595 | 596 | | |
596 | 597 | | |
597 | 598 | | |
598 | 599 | | |
599 | 600 | | |
600 | | - | |
| 601 | + | |
601 | 602 | | |
602 | 603 | | |
603 | 604 | | |
| |||
1667 | 1668 | | |
1668 | 1669 | | |
1669 | 1670 | | |
| 1671 | + | |
1670 | 1672 | | |
1671 | 1673 | | |
1672 | 1674 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| 136 | + | |
136 | 137 | | |
137 | 138 | | |
138 | 139 | | |
| |||
401 | 402 | | |
402 | 403 | | |
403 | 404 | | |
404 | | - | |
| 405 | + | |
405 | 406 | | |
406 | 407 | | |
407 | 408 | | |
| |||
1103 | 1104 | | |
1104 | 1105 | | |
1105 | 1106 | | |
1106 | | - | |
| 1107 | + | |
1107 | 1108 | | |
1108 | 1109 | | |
1109 | 1110 | | |
| |||
1177 | 1178 | | |
1178 | 1179 | | |
1179 | 1180 | | |
1180 | | - | |
| 1181 | + | |
1181 | 1182 | | |
1182 | 1183 | | |
1183 | 1184 | | |
1184 | 1185 | | |
1185 | 1186 | | |
1186 | 1187 | | |
1187 | | - | |
| 1188 | + | |
1188 | 1189 | | |
1189 | 1190 | | |
1190 | 1191 | | |
1191 | 1192 | | |
1192 | 1193 | | |
1193 | 1194 | | |
1194 | | - | |
| 1195 | + | |
1195 | 1196 | | |
1196 | 1197 | | |
1197 | 1198 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
466 | 466 | | |
467 | 467 | | |
468 | 468 | | |
469 | | - | |
| 469 | + | |
470 | 470 | | |
471 | | - | |
| 471 | + | |
472 | 472 | | |
473 | | - | |
| 473 | + | |
474 | 474 | | |
475 | 475 | | |
476 | 476 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
25 | 28 | | |
26 | 29 | | |
27 | 30 | | |
| |||
221 | 224 | | |
222 | 225 | | |
223 | 226 | | |
| 227 | + | |
224 | 228 | | |
225 | 229 | | |
226 | 230 | | |
| |||
233 | 237 | | |
234 | 238 | | |
235 | 239 | | |
236 | | - | |
| 240 | + | |
237 | 241 | | |
238 | 242 | | |
239 | | - | |
| 243 | + | |
240 | 244 | | |
241 | 245 | | |
242 | 246 | | |
| |||
1231 | 1235 | | |
1232 | 1236 | | |
1233 | 1237 | | |
| 1238 | + | |
1234 | 1239 | | |
1235 | 1240 | | |
1236 | 1241 | | |
| |||
1243 | 1248 | | |
1244 | 1249 | | |
1245 | 1250 | | |
1246 | | - | |
| 1251 | + | |
1247 | 1252 | | |
1248 | 1253 | | |
1249 | | - | |
| 1254 | + | |
1250 | 1255 | | |
1251 | 1256 | | |
1252 | 1257 | | |
| |||
1468 | 1473 | | |
1469 | 1474 | | |
1470 | 1475 | | |
1471 | | - | |
| 1476 | + | |
1472 | 1477 | | |
1473 | 1478 | | |
1474 | 1479 | | |
| |||
1526 | 1531 | | |
1527 | 1532 | | |
1528 | 1533 | | |
1529 | | - | |
| 1534 | + | |
1530 | 1535 | | |
1531 | 1536 | | |
1532 | 1537 | | |
| |||
1554 | 1559 | | |
1555 | 1560 | | |
1556 | 1561 | | |
| 1562 | + | |
1557 | 1563 | | |
1558 | 1564 | | |
1559 | 1565 | | |
| |||
1566 | 1572 | | |
1567 | 1573 | | |
1568 | 1574 | | |
1569 | | - | |
| 1575 | + | |
1570 | 1576 | | |
1571 | 1577 | | |
1572 | | - | |
| 1578 | + | |
1573 | 1579 | | |
1574 | 1580 | | |
1575 | 1581 | | |
| |||
1601 | 1607 | | |
1602 | 1608 | | |
1603 | 1609 | | |
| 1610 | + | |
1604 | 1611 | | |
1605 | 1612 | | |
1606 | 1613 | | |
| |||
1622 | 1629 | | |
1623 | 1630 | | |
1624 | 1631 | | |
1625 | | - | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
1626 | 1637 | | |
1627 | 1638 | | |
1628 | 1639 | | |
| |||
1644 | 1655 | | |
1645 | 1656 | | |
1646 | 1657 | | |
| 1658 | + | |
1647 | 1659 | | |
1648 | 1660 | | |
1649 | 1661 | | |
| |||
1665 | 1677 | | |
1666 | 1678 | | |
1667 | 1679 | | |
1668 | | - | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
1669 | 1686 | | |
1670 | 1687 | | |
1671 | 1688 | | |
| |||
0 commit comments