-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Return ExitCode from rustc_driver::main instead of calling process::exit
#150379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
r? @SparrowLii rustbot has assigned @SparrowLii. Use |
This comment has been minimized.
This comment has been minimized.
a59f490 to
1c598a2
Compare
|
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
|
The Miri subtree was changed cc @rust-lang/miri |
This comment has been minimized.
This comment has been minimized.
This makes rustc simply return an exit code from main rather than calling `std::process::exit` with an exit code. This means that drops run normally and the process exits cleanly. Also instead of hard coding success and failure codes this uses `ExitCode::SUCCESS` and `ExitCode::FAILURE`, which in turn effectively uses `libc::EXIT_SUCCESS` and `libc::EXIT_FAILURE` (via std). These are `0` and `1` respectively for all currently supported host platforms so it doesn't actually change the exit code.
a12784b to
614b563
Compare
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Return `ExitCode` from `rustc_driver::main` instead of calling `process::exit`
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (ffd099f): comparison URL. Overall result: ❌✅ regressions and improvements - no action neededBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (secondary -1.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 2.8%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 482.343s -> 483.621s (0.26%) |
614b563 to
2c61e81
Compare
| exit(if exit_code == ExitCode::SUCCESS { | ||
| rustc_driver::EXIT_SUCCESS | ||
| } else { | ||
| rustc_driver::EXIT_FAILURE | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Annoyingly ExitCode does not have a method to convert it to the i32 that process::exit requires. I think this is a libs issue that should be addressed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that is unfortunate.
Either way, 👍 for the Miri changes.
This makes rustc simply return an exit code from main rather than calling
std::process::exitwith an exit code. This means that drops run normally and the process exits cleanly. This is similar to what happens when an ICE occurs (due to being a panic that's caught by std'slang_start).Also instead of hard coding success and failure codes this uses
ExitCode::SUCCESSandExitCode::FAILURE, which in turn effectively useslibc::EXIT_SUCCESSandlibc::EXIT_FAILURE(via std). These are0and1respectively for all currently supported host platforms so it doesn't actually change the exit code.