Commit 42cd3c6
authored
Rollup merge of rust-lang#129418 - petrochenkov:libsearch2, r=jieyouxu
rustc: Simplify getting sysroot library directory
It was very non-obvious that `sess.target_tlib_path`, `make_target_lib_path(...)`, and `sess.target_filesearch(...).search_paths()` result in the same sysroot library directory paths.
They are however, indeed the same, because `sess.target_tlib_path` is initialized to `make_target_lib_path(...)` on `Session` creation, and they are used interchangeably.
There are still some redundant calls to `make_target_lib_path` and other inconsistent ways to obtain sysroot directories, but fixing that requires some behavior changes, while this PR is a pure refactoring.
Some places in the compiler even disagree on the number of sysroots - 1 (explicit `--sysroot` *or* default sysroot), 2 (explicit `--sysroot` *and* default sysroot), or an unclear number of `sysroot_candidates` every of which is considered.
The logic currently using `sess.target_tlib_path` or equivalents assumes one sysroot.File tree
3 files changed
+14
-45
lines changed- compiler
- rustc_codegen_ssa/src/back
- rustc_session/src
3 files changed
+14
-45
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1317 | 1317 | | |
1318 | 1318 | | |
1319 | 1319 | | |
1320 | | - | |
1321 | | - | |
1322 | | - | |
| 1320 | + | |
1323 | 1321 | | |
1324 | | - | |
| 1322 | + | |
1325 | 1323 | | |
1326 | 1324 | | |
1327 | 1325 | | |
| |||
1612 | 1610 | | |
1613 | 1611 | | |
1614 | 1612 | | |
1615 | | - | |
1616 | | - | |
| 1613 | + | |
1617 | 1614 | | |
1618 | 1615 | | |
1619 | 1616 | | |
1620 | 1617 | | |
1621 | 1618 | | |
1622 | | - | |
| 1619 | + | |
1623 | 1620 | | |
1624 | 1621 | | |
1625 | 1622 | | |
1626 | 1623 | | |
1627 | | - | |
| 1624 | + | |
1628 | 1625 | | |
1629 | 1626 | | |
1630 | 1627 | | |
| |||
2131 | 2128 | | |
2132 | 2129 | | |
2133 | 2130 | | |
2134 | | - | |
| 2131 | + | |
2135 | 2132 | | |
2136 | 2133 | | |
2137 | 2134 | | |
| |||
2146 | 2143 | | |
2147 | 2144 | | |
2148 | 2145 | | |
2149 | | - | |
2150 | | - | |
| 2146 | + | |
2151 | 2147 | | |
2152 | 2148 | | |
2153 | 2149 | | |
| |||
2859 | 2855 | | |
2860 | 2856 | | |
2861 | 2857 | | |
2862 | | - | |
| 2858 | + | |
2863 | 2859 | | |
2864 | | - | |
| 2860 | + | |
2865 | 2861 | | |
2866 | 2862 | | |
2867 | 2863 | | |
2868 | | - | |
2869 | | - | |
2870 | | - | |
| 2864 | + | |
| 2865 | + | |
2871 | 2866 | | |
2872 | 2867 | | |
2873 | 2868 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
14 | | - | |
15 | | - | |
16 | 13 | | |
17 | 14 | | |
18 | 15 | | |
| |||
32 | 29 | | |
33 | 30 | | |
34 | 31 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | 32 | | |
44 | | - | |
45 | | - | |
46 | 33 | | |
47 | 34 | | |
48 | 35 | | |
49 | 36 | | |
50 | | - | |
51 | | - | |
| 37 | + | |
52 | 38 | | |
53 | 39 | | |
54 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
440 | 440 | | |
441 | 441 | | |
442 | 442 | | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
| 443 | + | |
450 | 444 | | |
451 | 445 | | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
| 446 | + | |
459 | 447 | | |
460 | 448 | | |
461 | 449 | | |
| |||
0 commit comments