From 9da9ddb7db5b3005b38386bed2bf77932e7d4b4c Mon Sep 17 00:00:00 2001 From: Philipp Krones Date: Tue, 28 Jan 2025 19:22:55 +0100 Subject: Merge commit '51d49c1ae2785b24ef18a46ef233fc1d91844666' into clippy-subtree-update --- src/driver.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/driver.rs b/src/driver.rs index 68edefd3095..8201f332d33 100644 --- a/src/driver.rs +++ b/src/driver.rs @@ -223,7 +223,7 @@ pub fn main() { if !has_sysroot_arg(args) { args.extend(vec!["--sysroot".into(), sys_root]); } - }; + } }; // make "clippy-driver --rustc" work like a subcommand that passes further args to "rustc" -- cgit 1.4.1-3-g733a5 From 27454db7d156cf8b99d6d59145ae2a1b92368a49 Mon Sep 17 00:00:00 2001 From: Bastian Kersting Date: Tue, 17 Dec 2024 13:00:22 +0000 Subject: Insert null checks for pointer dereferences when debug assertions are enabled Similar to how the alignment is already checked, this adds a check for null pointer dereferences in debug mode. It is implemented similarly to the alignment check as a MirPass. This is related to a 2025H1 project goal for better UB checks in debug mode: https://github.com/rust-lang/rust-project-goals/pull/177. --- src/driver.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/driver.rs b/src/driver.rs index 8201f332d33..c548f262a92 100644 --- a/src/driver.rs +++ b/src/driver.rs @@ -166,6 +166,8 @@ impl rustc_driver::Callbacks for ClippyCallbacks { // MIR passes can be enabled / disabled separately, we should figure out, what passes to // use for Clippy. config.opts.unstable_opts.mir_opt_level = Some(0); + config.opts.unstable_opts.mir_enable_passes = + vec![("CheckNull".to_owned(), false), ("CheckAlignment".to_owned(), false)]; // Disable flattening and inlining of format_args!(), so the HIR matches with the AST. config.opts.unstable_opts.flatten_format_args = false; -- cgit 1.4.1-3-g733a5 From abdee777c24c9ad398044b819a93f7a8903acbd3 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 2 Feb 2025 15:17:29 +0000 Subject: Some cleanups around EarlyDiagCtxt All callers of EarlyDiagCtxt::early_error now emit a fatal error. --- src/driver.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/driver.rs b/src/driver.rs index c548f262a92..e4092bcd105 100644 --- a/src/driver.rs +++ b/src/driver.rs @@ -197,7 +197,7 @@ pub fn main() { }); exit(rustc_driver::catch_with_exit_code(move || { - let mut orig_args = rustc_driver::args::raw_args(&early_dcx)?; + let mut orig_args = rustc_driver::args::raw_args(&early_dcx); let has_sysroot_arg = |args: &mut [String]| -> bool { if has_arg(args, "--sysroot") { @@ -239,7 +239,7 @@ pub fn main() { pass_sysroot_env_if_given(&mut args, sys_root_env); rustc_driver::run_compiler(&args, &mut DefaultCallbacks); - return Ok(()); + return; } if orig_args.iter().any(|a| a == "--version" || a == "-V") { @@ -301,7 +301,6 @@ pub fn main() { } else { rustc_driver::run_compiler(&args, &mut RustcCallbacks { clippy_args_var }); } - Ok(()) })) } -- cgit 1.4.1-3-g733a5