Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
a8ffa1c
docs: update default branch name of `rust-lang/rust`
jieyouxu Dec 6, 2025
ccdda58
clean-up
ada4a Jan 16, 2026
19bfad0
Introduce `AssocTag::descr` & refactor in the vicinity
fmease Jan 6, 2026
454842a
update `dbg!` clippy lint
joboet Dec 12, 2025
e8c449d
Move assert_matches to planned stable path
Voultapher Jan 19, 2026
76a536c
test: remove `unwrap.rs`
ada4a Jan 21, 2026
a0d33e0
Bump stage0
Mark-Simulacrum Jan 21, 2026
63c69a7
Rollup merge of #151439 - Mark-Simulacrum:bootstrap-bump, r=nnethercote
jhpratt Jan 22, 2026
3c9a084
Rollup merge of #151423 - Voultapher:move-assert-matches, r=Amanieu
JonathanBrouwer Jan 22, 2026
977edde
Merge commit '54482290b5f32e6c6b57cc9e0a17153f432b0036' into clippy-s…
flip1995 Jan 22, 2026
62846d2
test: remove `unwrap.rs` (#16437)
dswij Jan 23, 2026
1ebafc5
fix(manual_let_else): add trailing comma when necessary
Jan 22, 2026
3157c0b
reduce suggestion diff
ada4a Jan 16, 2026
f43f1d6
Update default branch name of `rust-lang/rust` in subtree sync docs (…
flip1995 Jan 23, 2026
529b820
Auto merge of #151501 - flip1995:clippy-subtree-update, r=Manishearth
bors Jan 23, 2026
4e4651b
Return ExitCode from rustc_driver::main
ChrisDenton Dec 25, 2025
dc57e57
fix(manual_let_else): add trailing comma to struct patterns ending wi…
dswij Jan 24, 2026
e4d146e
fix: `doc_markdown` add PowerShell to whitelist
profetia Jan 24, 2026
cc29987
fix: `test_attr_in_doctest` FP on `test_harness`
profetia Jan 24, 2026
d7281ea
Enhance `question_mark` to cover `else if`
profetia Jan 25, 2026
ed1d154
Rollup merge of #149869 - joboet:torn-dbg, r=Mark-Simulacrum
matthiaskrgr Jan 25, 2026
0f17b47
Add PowerShell to `doc_markdown` whitelist (#16453)
dswij Jan 25, 2026
8416c54
Also ignore cases with comments in `let_and_return`
Alexendoo Jan 25, 2026
4a6c0de
rhs of short-circuit expression doesn't always run
samueltardieu Jan 25, 2026
7ffda53
Also ignore cases with comments in `let_and_return` (#16461)
samueltardieu Jan 25, 2026
187893e
rhs of short-circuit expression doesn't always run (#16463)
Jarcho Jan 25, 2026
30dbf82
Fix `test_attr_in_doctest` FP on `test_harness` (#16454)
Jarcho Jan 25, 2026
02d9865
Enhance `manual_is_variant_and` to cover manual `is_none_or`
profetia Jan 17, 2026
1b33602
Make `manual_is_variant_and` to cover manual `is_none_or` (#16424)
Jarcho Jan 25, 2026
fdfbe73
Only `Duration` constructors taking `u64` are covered
samueltardieu Jan 25, 2026
9f308b7
Do not mention `-Zmacro-backtrace` for std macros that are a wrapper …
estebank Nov 8, 2025
dfcfd73
fix: `cmp_owned` FP when `to_string` comes from macro input
profetia Jan 26, 2026
c3ab233
fix: `manual_dangling_ptr` FP when pointee type is not `Sized`
profetia Jan 26, 2026
17f89e7
Fix `useless_attribute` FP on `exported_private_dependencies` lint at…
kpreid Jan 26, 2026
3075db4
Fix `manual_dangling_ptr` FP when pointee type is not `Sized` (#16469)
Jarcho Jan 26, 2026
d463a8d
Update `askama` version to `0.15.2`
GuillaumeGomez Jan 27, 2026
2b16dcd
Only `Duration` constructors taking `u64` are covered (#16465)
dswij Jan 27, 2026
7e3cf26
Update `askama` version to `0.15.2` (#16472)
samueltardieu Jan 27, 2026
b5f31e2
Fix `useless_attribute` FP on `exported_private_dependencies` lint at…
samueltardieu Jan 27, 2026
e882593
Fix grammar in doc comments in `conf.rs`
Cardosaum Jan 28, 2026
736e4b8
Fix grammar in doc comments in `conf.rs` (#16479)
samueltardieu Jan 28, 2026
f992358
Part 2 refactoring of moving placeholder types to `rustc_type_ir`
Jamesbarford Dec 22, 2025
cf66256
Update `askama` to `0.15.4`
GuillaumeGomez Jan 28, 2026
dc8b277
Update `askama` to `0.15.4` (#16485)
samueltardieu Jan 29, 2026
01eba55
Rollup merge of #150271 - Jamesbarford:chore/refactor-struct-placehol…
JonathanBrouwer Jan 29, 2026
cdee2fb
refactor: add an `enum DerefAdjustKind` in favor of `Option<Overloade…
frank-king Jan 30, 2026
9c1ca3a
doc_paragraphs_missing_punctuation: allow some non-punctuated paragraphs
AudaciousAxiom Jan 31, 2026
631120b
fix: `unwrap_used` and `expect_used` FN when using fully qualified sy…
profetia Jan 31, 2026
62c5f16
Fix `unwrap_used` and `expect_used` FN when using fully qualified syn…
Jarcho Jan 31, 2026
37c127c
`doc_paragraphs_missing_punctuation`: allow some non-punctuated parag…
dswij Feb 2, 2026
992a6f6
fix: allow_attributes false negative on attributes with whitespace
vishnupoddar12 Feb 2, 2026
301aae6
fix: allow_attributes false negative on attributes with whitespace (#…
llogiq Feb 2, 2026
267f40d
Fix missing unused_variables lint when using a match guard
eggyal Feb 2, 2026
b3d81e3
`str_split`: reduce suggestion diff (#16418)
dswij Feb 2, 2026
1826ec0
Extend `question_mark` to cover `else if` (#16455)
Jarcho Feb 3, 2026
691e226
fix: handle false negative for `str_to_string`
nyurik Feb 5, 2026
cec007b
Rollup merge of #150379 - ChrisDenton:exitcode, r=jieyouxu
JonathanBrouwer Feb 5, 2026
b303ab4
fix: handle false negative for `str_to_string` (#16512)
samueltardieu Feb 5, 2026
e94a62d
mGCA: Support directly represented negated literals
khyperia Feb 6, 2026
da779a0
Rollup merge of #152139 - khyperia:mgca-negative-literals, r=BoxyUwU
JonathanBrouwer Feb 6, 2026
f090e9c
Port rustc_intrinsic to the new attribute parser
jdonszelmann Feb 5, 2026
15e0ce9
Fix `cmp_owned` FP when `to_string` comes from macro input (#16468)
dswij Feb 7, 2026
236dac8
fix: remove unnecessary trailing commas in format strings
nyurik Feb 7, 2026
7c95f57
fix outdated doc comments
mikhailofff Feb 8, 2026
389294d
Fix documentation for `indexing_slicing`
puzzlewolf Feb 9, 2026
00432c0
fix dead links in type checking section of the doc
mikhailofff Feb 9, 2026
9bf9a12
Allow provisional mgca syntax of type const <IDENT> = <EXPR> to be re…
Keith-Cancel Feb 6, 2026
7eec730
chore: remove unnecessary trailing commas in format strings (#16533)
samueltardieu Feb 9, 2026
b1847b5
Remove SubdiagMessage in favour of the identical DiagMessage
JonathanBrouwer Feb 10, 2026
bbc5b53
Rollup merge of #152351 - JonathanBrouwer:remove_subdiag, r=nnethercote
JonathanBrouwer Feb 10, 2026
ae8a9d1
Fix documentation for `indexing_slicing` (#16543)
dswij Feb 10, 2026
fdaa633
Fix dead links in type checking section of the doc (#16544)
flip1995 Feb 10, 2026
5dac025
Do not lint main function in `must_use_candidates`
flip1995 Feb 10, 2026
b20572e
change to github permalinks
mikhailofff Feb 11, 2026
5d35527
Fix outdated doc comments (#16536)
flip1995 Feb 11, 2026
a9a368a
Do not lint main function in `must_use_candidates` (#16552)
Jarcho Feb 11, 2026
e1ade99
Enable triagebot new `[view-all-comments-link]` feature
Urgau Feb 11, 2026
4ccb80b
Enable triagebot new `[view-all-comments-link]` feature (#16554)
flip1995 Feb 11, 2026
c9841a6
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Feb 11, 2026
24b1392
Bump nightly version -> 2026-02-11
flip1995 Feb 11, 2026
a62c6af
Rustup (#16551)
flip1995 Feb 11, 2026
0e2af75
Merge commit 'a62c6af53676bb15a40488ce2d632de558f001de' into clippy-s…
flip1995 Feb 12, 2026
eaad11c
cg_gcc: remove Clippy expect attribute
flip1995 Feb 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Return ExitCode from rustc_driver::main
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.
  • Loading branch information
ChrisDenton committed Jan 23, 2026
commit 4e4651b0457166674cff7dcf25410a3a9a95e811
26 changes: 14 additions & 12 deletions src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use std::env;
use std::fs::read_to_string;
use std::io::Write as _;
use std::path::Path;
use std::process::exit;
use std::process::ExitCode;

/// If a command-line option matches `find_arg`, then apply the predicate `pred` on its value. If
/// true, then return it. The parameter is assumed to be either `--arg=value` or `--arg value`.
Expand Down Expand Up @@ -182,15 +182,17 @@ impl rustc_driver::Callbacks for ClippyCallbacks {
}
}

fn display_help() {
fn display_help() -> ExitCode {
if writeln!(&mut anstream::stdout().lock(), "{}", help_message()).is_err() {
exit(rustc_driver::EXIT_FAILURE);
ExitCode::FAILURE
} else {
ExitCode::SUCCESS
}
}

const BUG_REPORT_URL: &str = "https://github.com/rust-lang/rust-clippy/issues/new?template=ice.yml";

pub fn main() {
pub fn main() -> ExitCode {
let early_dcx = EarlyDiagCtxt::new(ErrorOutputType::default());

rustc_driver::init_rustc_env_logger(&early_dcx);
Expand All @@ -203,7 +205,7 @@ pub fn main() {
dcx.handle().note(format!("Clippy version: {version_info}"));
});

exit(rustc_driver::catch_with_exit_code(move || {
rustc_driver::catch_with_exit_code(move || {
let mut orig_args = rustc_driver::args::raw_args(&early_dcx);

let has_sysroot_arg = |args: &mut [String]| -> bool {
Expand Down Expand Up @@ -246,15 +248,15 @@ pub fn main() {
pass_sysroot_env_if_given(&mut args, sys_root_env);

rustc_driver::run_compiler(&args, &mut DefaultCallbacks);
return;
return ExitCode::SUCCESS;
}

if orig_args.iter().any(|a| a == "--version" || a == "-V") {
let version_info = rustc_tools_util::get_version_info!();

match writeln!(&mut anstream::stdout().lock(), "{version_info}") {
Ok(()) => exit(rustc_driver::EXIT_SUCCESS),
Err(_) => exit(rustc_driver::EXIT_FAILURE),
return match writeln!(&mut anstream::stdout().lock(), "{version_info}") {
Ok(()) => ExitCode::SUCCESS,
Err(_) => ExitCode::FAILURE,
}
}

Expand All @@ -268,8 +270,7 @@ pub fn main() {
}

if !wrapper_mode && (orig_args.iter().any(|a| a == "--help" || a == "-h") || orig_args.len() == 1) {
display_help();
exit(0);
return display_help();
}

let mut args: Vec<String> = orig_args.clone();
Expand Down Expand Up @@ -311,7 +312,8 @@ pub fn main() {
} else {
rustc_driver::run_compiler(&args, &mut RustcCallbacks { clippy_args_var });
}
}))
ExitCode::SUCCESS
})
}

#[must_use]
Expand Down