Commit 213d946
committed
Auto merge of rust-lang#144303 - Kobzol:bootstrap-tool-cleanup, r=jieyouxu
Consolidate staging for `rustc_private` tools
This PR continues bootstrap refactoring, this time by consolidating staging for `Mode::ToolRustc` tools. This refactoring was in the critical path of refactoring `test`/`dist`/`clippy`/`doc` steps, and getting rid of the rmeta/rlib sysroot copy, because tools are pervasive and they are being used for a lot of things in bootstrap.
The main idea is to explicitly model the fact that a stage N `Mode::ToolRustc` tool always works with two different compilers:
- Stage N-1 rustc (`build_compiler`) builds stage N rustc (`target_compiler`)
- Rlib artifacts from stage N rustc are copied to the sysroot of stage N-1 rustc
- Stage N-1 rustc builds the (stage N) tool itself, the tool links to the rlib artifacts of the stage N rustc
Before, the code often used `compiler`, which meant sometimes the build compiler, sometimes the target compiler, and sometimes neither (looking at you, `download-rustc`). This is especially annoying when you get to a situation where you have an install step that invokes a dist step that invokes a tool build step, where *some* compiler is being propagated through, without it being clear what does that compiler represent. This refactoring hopefully makes that clearer and more explicit. It also gets rid of a few `builder.ensure(Rustc(...))` calls within bootstrap, which is always nice.
`Rustdoc` needs to be handled a bit specially, because it acts as a compiler itself, I documented that in the changes.
It wasn't practical to do these refactorings in multiple PRs, so I did it all in one PR. The meat of the change is 9ee6d1c.
I tested manually that `x build rustdoc` and `x build miri` still works even with `download-rustc`, although I cannot promise any extra support for `download-rustc`, IMO we will just have to reimplement it from scratch in a different way.
As usually, I did some drive-by refactorings to bootstrap, trying to document and clarify things, add more step metadata and tests.
Since these changes broke Cargo, which was incorrectly using `Mode::ToolRustc`, I also changed cargo to `ToolTarget` in this PR.
Best reviewed commit-by-commit (note that I renamed `link_compiler` to `target_compiler`, in accordance to the rest of bootstrap, in the last commit).
r? `@jieyouxu`
try-job: x86_64-gnu-aux
try-job: x86_64-msvc-ext112 files changed
+744
-453
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
1131 | 1131 | | |
1132 | 1132 | | |
1133 | 1133 | | |
1134 | | - | |
| 1134 | + | |
1135 | 1135 | | |
1136 | 1136 | | |
1137 | 1137 | | |
| |||
1544 | 1544 | | |
1545 | 1545 | | |
1546 | 1546 | | |
1547 | | - | |
1548 | | - | |
1549 | | - | |
| 1547 | + | |
| 1548 | + | |
1550 | 1549 | | |
1551 | 1550 | | |
1552 | 1551 | | |
| |||
1610 | 1609 | | |
1611 | 1610 | | |
1612 | 1611 | | |
1613 | | - | |
1614 | | - | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
1615 | 1617 | | |
1616 | 1618 | | |
1617 | 1619 | | |
| |||
1624 | 1626 | | |
1625 | 1627 | | |
1626 | 1628 | | |
1627 | | - | |
1628 | | - | |
1629 | | - | |
| 1629 | + | |
| 1630 | + | |
1630 | 1631 | | |
1631 | 1632 | | |
1632 | 1633 | | |
1633 | 1634 | | |
1634 | | - | |
1635 | | - | |
1636 | 1635 | | |
| 1636 | + | |
| 1637 | + | |
1637 | 1638 | | |
1638 | | - | |
1639 | | - | |
1640 | | - | |
| 1639 | + | |
1641 | 1640 | | |
1642 | 1641 | | |
1643 | 1642 | | |
| |||
1648 | 1647 | | |
1649 | 1648 | | |
1650 | 1649 | | |
1651 | | - | |
1652 | | - | |
1653 | | - | |
1654 | | - | |
1655 | | - | |
1656 | | - | |
1657 | | - | |
| 1650 | + | |
1658 | 1651 | | |
1659 | 1652 | | |
1660 | 1653 | | |
1661 | | - | |
| 1654 | + | |
1662 | 1655 | | |
1663 | 1656 | | |
1664 | 1657 | | |
| |||
1679 | 1672 | | |
1680 | 1673 | | |
1681 | 1674 | | |
1682 | | - | |
1683 | | - | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
1684 | 1682 | | |
1685 | 1683 | | |
1686 | 1684 | | |
| |||
1700 | 1698 | | |
1701 | 1699 | | |
1702 | 1700 | | |
1703 | | - | |
| 1701 | + | |
1704 | 1702 | | |
1705 | 1703 | | |
1706 | 1704 | | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
1707 | 1712 | | |
1708 | 1713 | | |
1709 | 1714 | | |
| |||
2190 | 2195 | | |
2191 | 2196 | | |
2192 | 2197 | | |
2193 | | - | |
2194 | | - | |
| 2198 | + | |
| 2199 | + | |
| 2200 | + | |
| 2201 | + | |
2195 | 2202 | | |
2196 | 2203 | | |
2197 | 2204 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
425 | 425 | | |
426 | 426 | | |
427 | 427 | | |
428 | | - | |
| 428 | + | |
429 | 429 | | |
430 | 430 | | |
431 | 431 | | |
432 | 432 | | |
433 | 433 | | |
434 | | - | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
435 | 439 | | |
436 | 440 | | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
| 441 | + | |
441 | 442 | | |
442 | 443 | | |
443 | 444 | | |
| |||
1172 | 1173 | | |
1173 | 1174 | | |
1174 | 1175 | | |
1175 | | - | |
| 1176 | + | |
1176 | 1177 | | |
1177 | 1178 | | |
1178 | 1179 | | |
| |||
1188 | 1189 | | |
1189 | 1190 | | |
1190 | 1191 | | |
1191 | | - | |
| 1192 | + | |
1192 | 1193 | | |
1193 | 1194 | | |
1194 | 1195 | | |
| |||
1198 | 1199 | | |
1199 | 1200 | | |
1200 | 1201 | | |
1201 | | - | |
| 1202 | + | |
1202 | 1203 | | |
1203 | 1204 | | |
1204 | | - | |
1205 | | - | |
1206 | | - | |
| 1205 | + | |
1207 | 1206 | | |
1208 | 1207 | | |
1209 | 1208 | | |
| |||
1228 | 1227 | | |
1229 | 1228 | | |
1230 | 1229 | | |
1231 | | - | |
| 1230 | + | |
1232 | 1231 | | |
1233 | 1232 | | |
1234 | 1233 | | |
| |||
1244 | 1243 | | |
1245 | 1244 | | |
1246 | 1245 | | |
1247 | | - | |
| 1246 | + | |
1248 | 1247 | | |
1249 | 1248 | | |
1250 | 1249 | | |
| |||
1254 | 1253 | | |
1255 | 1254 | | |
1256 | 1255 | | |
1257 | | - | |
1258 | 1256 | | |
| 1257 | + | |
| 1258 | + | |
1259 | 1259 | | |
1260 | | - | |
1261 | | - | |
1262 | | - | |
| 1260 | + | |
1263 | 1261 | | |
1264 | 1262 | | |
1265 | 1263 | | |
| |||
1270 | 1268 | | |
1271 | 1269 | | |
1272 | 1270 | | |
1273 | | - | |
| 1271 | + | |
1274 | 1272 | | |
1275 | | - | |
| 1273 | + | |
1276 | 1274 | | |
1277 | 1275 | | |
1278 | 1276 | | |
| |||
1288 | 1286 | | |
1289 | 1287 | | |
1290 | 1288 | | |
1291 | | - | |
| 1289 | + | |
1292 | 1290 | | |
1293 | 1291 | | |
1294 | 1292 | | |
| |||
1298 | 1296 | | |
1299 | 1297 | | |
1300 | 1298 | | |
1301 | | - | |
1302 | 1299 | | |
1303 | | - | |
1304 | | - | |
| 1300 | + | |
| 1301 | + | |
1305 | 1302 | | |
1306 | 1303 | | |
1307 | 1304 | | |
1308 | 1305 | | |
1309 | | - | |
1310 | | - | |
| 1306 | + | |
| 1307 | + | |
1311 | 1308 | | |
1312 | 1309 | | |
1313 | 1310 | | |
| |||
1319 | 1316 | | |
1320 | 1317 | | |
1321 | 1318 | | |
1322 | | - | |
| 1319 | + | |
1323 | 1320 | | |
1324 | | - | |
| 1321 | + | |
1325 | 1322 | | |
1326 | 1323 | | |
1327 | 1324 | | |
| |||
1337 | 1334 | | |
1338 | 1335 | | |
1339 | 1336 | | |
1340 | | - | |
| 1337 | + | |
1341 | 1338 | | |
1342 | 1339 | | |
1343 | 1340 | | |
| |||
1354 | 1351 | | |
1355 | 1352 | | |
1356 | 1353 | | |
1357 | | - | |
1358 | | - | |
1359 | | - | |
1360 | | - | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
1361 | 1358 | | |
1362 | | - | |
1363 | | - | |
1364 | | - | |
1365 | | - | |
| 1359 | + | |
1366 | 1360 | | |
1367 | 1361 | | |
1368 | 1362 | | |
| |||
1466 | 1460 | | |
1467 | 1461 | | |
1468 | 1462 | | |
1469 | | - | |
| 1463 | + | |
1470 | 1464 | | |
1471 | | - | |
| 1465 | + | |
1472 | 1466 | | |
1473 | 1467 | | |
1474 | 1468 | | |
| |||
1484 | 1478 | | |
1485 | 1479 | | |
1486 | 1480 | | |
1487 | | - | |
| 1481 | + | |
1488 | 1482 | | |
1489 | 1483 | | |
1490 | 1484 | | |
| |||
1494 | 1488 | | |
1495 | 1489 | | |
1496 | 1490 | | |
1497 | | - | |
1498 | | - | |
| 1491 | + | |
| 1492 | + | |
1499 | 1493 | | |
1500 | | - | |
| 1494 | + | |
| 1495 | + | |
1501 | 1496 | | |
1502 | | - | |
1503 | | - | |
1504 | | - | |
| 1497 | + | |
1505 | 1498 | | |
1506 | 1499 | | |
1507 | 1500 | | |
| |||
1548 | 1541 | | |
1549 | 1542 | | |
1550 | 1543 | | |
1551 | | - | |
| 1544 | + | |
1552 | 1545 | | |
1553 | 1546 | | |
1554 | 1547 | | |
| |||
1568 | 1561 | | |
1569 | 1562 | | |
1570 | 1563 | | |
1571 | | - | |
1572 | | - | |
1573 | | - | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
1574 | 1567 | | |
1575 | | - | |
1576 | | - | |
| 1568 | + | |
| 1569 | + | |
1577 | 1570 | | |
1578 | 1571 | | |
1579 | 1572 | | |
| |||
0 commit comments