Commit 6742dc4
authored
Rollup merge of rust-lang#98994 - kons-9:dont_use_process_exit, r=jyn514
replace process exit with more detailed exit in src/bootstrap/*.rs
Fixes [rust-lang#98830](rust-lang#98830)
I implemeted "detail_exit.rs" in lib.rs, and replace all of std::process::exit.
So, error code should panic in test code.
```
// lib.rs
pub fn detail_exit(code: i32) -> ! {
// Successful exit
if code == 0 {
std::process::exit(0);
}
if cfg!(test) {
panic!("status code: {}", code);
} else {
std::panic::resume_unwind(Box::new(code));
}
}
```
<details>
<summary>% rg "exit\(" src/bootstrap/*.rs</summary>
```
builder.rs
351: crate::detail_exit(1);
1000: crate::detail_exit(1);
1429: crate::detail_exit(1);
compile.rs
1331: crate::detail_exit(1);
config.rs
818: crate::detail_exit(2);
1488: crate::detail_exit(1);
flags.rs
263: crate::detail_exit(exit_code);
349: crate::detail_exit(exit_code);
381: crate::detail_exit(1);
602: crate::detail_exit(1);
616: crate::detail_exit(1);
807: crate::detail_exit(1);
format.rs
35: crate::detail_exit(1);
117: crate::detail_exit(1);
lib.rs
714: detail_exit(1);
1620: detail_exit(1);
1651:pub fn detail_exit(code: i32) -> ! {
1654: std::process::exit(0);
sanity.rs
107: crate::detail_exit(1);
setup.rs
97: crate::detail_exit(1);
290: crate::detail_exit(1);
test.rs
676: crate::detail_exit(1);
1024: crate::detail_exit(1);
1254: crate::detail_exit(1);
tool.rs
207: crate::detail_exit(1);
toolstate.rs
96: crate::detail_exit(3);
111: crate::detail_exit(1);
182: crate::detail_exit(1);
228: crate::detail_exit(1);
util.rs
339: crate::detail_exit(1);
378: crate::detail_exit(1);
468: crate::detail_exit(1);
```
</details>File tree
12 files changed
+48
-41
lines changed- src/bootstrap
12 files changed
+48
-41
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
| 349 | + | |
354 | 350 | | |
355 | 351 | | |
356 | 352 | | |
| |||
1008 | 1004 | | |
1009 | 1005 | | |
1010 | 1006 | | |
1011 | | - | |
| 1007 | + | |
1012 | 1008 | | |
1013 | 1009 | | |
1014 | 1010 | | |
| |||
1437 | 1433 | | |
1438 | 1434 | | |
1439 | 1435 | | |
1440 | | - | |
| 1436 | + | |
1441 | 1437 | | |
1442 | 1438 | | |
1443 | 1439 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
1377 | 1377 | | |
1378 | 1378 | | |
1379 | 1379 | | |
1380 | | - | |
| 1380 | + | |
1381 | 1381 | | |
1382 | 1382 | | |
1383 | 1383 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
805 | 805 | | |
806 | 806 | | |
807 | 807 | | |
808 | | - | |
809 | | - | |
810 | 808 | | |
811 | 809 | | |
812 | 810 | | |
| |||
817 | 815 | | |
818 | 816 | | |
819 | 817 | | |
820 | | - | |
| 818 | + | |
821 | 819 | | |
822 | 820 | | |
823 | 821 | | |
| |||
1487 | 1485 | | |
1488 | 1486 | | |
1489 | 1487 | | |
1490 | | - | |
| 1488 | + | |
1491 | 1489 | | |
1492 | 1490 | | |
1493 | 1491 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
| |||
261 | 260 | | |
262 | 261 | | |
263 | 262 | | |
264 | | - | |
| 263 | + | |
265 | 264 | | |
266 | 265 | | |
267 | 266 | | |
| |||
347 | 346 | | |
348 | 347 | | |
349 | 348 | | |
350 | | - | |
| 349 | + | |
351 | 350 | | |
352 | 351 | | |
353 | 352 | | |
| |||
379 | 378 | | |
380 | 379 | | |
381 | 380 | | |
382 | | - | |
| 381 | + | |
383 | 382 | | |
384 | 383 | | |
385 | 384 | | |
| |||
600 | 599 | | |
601 | 600 | | |
602 | 601 | | |
603 | | - | |
| 602 | + | |
604 | 603 | | |
605 | 604 | | |
606 | 605 | | |
| |||
614 | 613 | | |
615 | 614 | | |
616 | 615 | | |
617 | | - | |
| 616 | + | |
618 | 617 | | |
619 | 618 | | |
620 | 619 | | |
| |||
805 | 804 | | |
806 | 805 | | |
807 | 806 | | |
808 | | - | |
| 807 | + | |
809 | 808 | | |
810 | 809 | | |
811 | 810 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
| 117 | + | |
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
711 | 711 | | |
712 | 712 | | |
713 | 713 | | |
714 | | - | |
| 714 | + | |
715 | 715 | | |
716 | 716 | | |
717 | 717 | | |
| |||
1617 | 1617 | | |
1618 | 1618 | | |
1619 | 1619 | | |
1620 | | - | |
| 1620 | + | |
1621 | 1621 | | |
1622 | 1622 | | |
1623 | 1623 | | |
| |||
1646 | 1646 | | |
1647 | 1647 | | |
1648 | 1648 | | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
1649 | 1663 | | |
1650 | 1664 | | |
1651 | 1665 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
290 | | - | |
| 290 | + | |
291 | 291 | | |
292 | 292 | | |
293 | 293 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
673 | 673 | | |
674 | 674 | | |
675 | 675 | | |
676 | | - | |
| 676 | + | |
677 | 677 | | |
678 | 678 | | |
679 | 679 | | |
| |||
1021 | 1021 | | |
1022 | 1022 | | |
1023 | 1023 | | |
1024 | | - | |
| 1024 | + | |
1025 | 1025 | | |
1026 | 1026 | | |
1027 | 1027 | | |
| |||
1251 | 1251 | | |
1252 | 1252 | | |
1253 | 1253 | | |
1254 | | - | |
| 1254 | + | |
1255 | 1255 | | |
1256 | 1256 | | |
1257 | 1257 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | | - | |
| 207 | + | |
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
| |||
0 commit comments