From 6cabf9581df3b56951055bd63a250e2fda9f49ec Mon Sep 17 00:00:00 2001 From: Jason Newcomb Date: Mon, 17 Aug 2026 10:56:29 -0400 Subject: [PATCH 1/3] Move `custom-ice-message` test --- tests/{ui-internal => ui}/custom_ice_message.rs | 0 tests/{ui-internal => ui}/custom_ice_message.stderr | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename tests/{ui-internal => ui}/custom_ice_message.rs (100%) rename tests/{ui-internal => ui}/custom_ice_message.stderr (89%) diff --git a/tests/ui-internal/custom_ice_message.rs b/tests/ui/custom_ice_message.rs similarity index 100% rename from tests/ui-internal/custom_ice_message.rs rename to tests/ui/custom_ice_message.rs diff --git a/tests/ui-internal/custom_ice_message.stderr b/tests/ui/custom_ice_message.stderr similarity index 89% rename from tests/ui-internal/custom_ice_message.stderr rename to tests/ui/custom_ice_message.stderr index 2e4d53104fba..c21963007c89 100644 --- a/tests/ui-internal/custom_ice_message.stderr +++ b/tests/ui/custom_ice_message.stderr @@ -3,13 +3,13 @@ note: no errors encountered even though delayed bugs were created note: those delayed bugs will now be shown as internal compiler errors error: internal compiler error: Would you like some help with that? - --> tests/ui-internal/custom_ice_message.rs:12:1 + --> tests/ui/custom_ice_message.rs:12:1 | LL | fn it_looks_like_you_are_trying_to_kill_clippy() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: delayed at clippy_lints_internal/src/produce_ice.rs - disabled backtrace - --> tests/ui-internal/custom_ice_message.rs:12:1 + --> tests/ui/custom_ice_message.rs:12:1 | LL | fn it_looks_like_you_are_trying_to_kill_clippy() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ From ba47895f5aee2ae4d79aa146ab7850948b743e33 Mon Sep 17 00:00:00 2001 From: Jason Newcomb Date: Mon, 3 Aug 2026 15:40:26 -0400 Subject: [PATCH 2/3] Use `rustc_delayed_bug_from_inside_query` to test the ICE message hook. --- clippy_lints_internal/src/lib.rs | 3 -- clippy_lints_internal/src/produce_ice.rs | 41 ------------------------ tests/ui/custom_ice_message.rs | 14 ++++---- tests/ui/custom_ice_message.stderr | 22 ++++++------- 4 files changed, 16 insertions(+), 64 deletions(-) delete mode 100644 clippy_lints_internal/src/produce_ice.rs diff --git a/clippy_lints_internal/src/lib.rs b/clippy_lints_internal/src/lib.rs index 2d0694098179..301d37153c94 100644 --- a/clippy_lints_internal/src/lib.rs +++ b/clippy_lints_internal/src/lib.rs @@ -29,7 +29,6 @@ mod internal_paths; mod lint_without_lint_pass; mod msrv_attr_impl; mod outer_expn_data_pass; -mod produce_ice; mod repeated_is_diagnostic_item; mod symbols; mod unnecessary_def_path; @@ -47,7 +46,6 @@ static LINTS: &[&Lint] = &[ lint_without_lint_pass::MISSING_CLIPPY_VERSION_ATTRIBUTE, msrv_attr_impl::MISSING_MSRV_ATTR_IMPL, outer_expn_data_pass::OUTER_EXPN_EXPN_DATA, - produce_ice::PRODUCE_ICE, symbols::INTERNING_LITERALS, symbols::SYMBOL_AS_STR, unnecessary_def_path::UNNECESSARY_DEF_PATH, @@ -61,7 +59,6 @@ pub fn register_lints(store: &mut LintStore) { store.register_early_lint_pass(Box::new(|| { Box::new(unsorted_clippy_utils_paths::UnsortedClippyUtilsPaths) })); - store.register_early_lint_pass(Box::new(|| Box::new(produce_ice::ProduceIce))); store.register_late_lint_pass(Box::new(|_| Box::new(collapsible_span_lint_calls::CollapsibleCalls))); store.register_late_lint_pass(Box::new(|_| Box::::default())); store.register_late_lint_pass(Box::new(|_| { diff --git a/clippy_lints_internal/src/produce_ice.rs b/clippy_lints_internal/src/produce_ice.rs deleted file mode 100644 index 82a6bcdf36af..000000000000 --- a/clippy_lints_internal/src/produce_ice.rs +++ /dev/null @@ -1,41 +0,0 @@ -use rustc_ast::ast::NodeId; -use rustc_ast::visit::FnKind; -use rustc_lint::{EarlyContext, EarlyLintPass, LintContext as _, declare_lint_pass, declare_tool_lint}; -use rustc_span::Span; - -declare_tool_lint! { - /// ### What it does - /// Not an actual lint. This lint is only meant for testing our customized internal compiler - /// error message by calling `panic`. - /// - /// ### Why is this bad? - /// ICE in large quantities can damage your teeth - /// - /// ### Example - /// ```rust,ignore - /// 🍦🍦🍦🍦🍦 - /// ``` - pub clippy::PRODUCE_ICE, - Warn, - "this message should not appear anywhere as we ICE before and don't emit the lint", - report_in_external_macro: true -} - -declare_lint_pass!(ProduceIce => [PRODUCE_ICE]); - -impl EarlyLintPass for ProduceIce { - fn check_fn(&mut self, cx: &EarlyContext<'_>, fn_kind: FnKind<'_>, span: Span, _: NodeId) { - if is_trigger_fn(fn_kind) { - cx.sess() - .dcx() - .span_delayed_bug(span, "Would you like some help with that?"); - } - } -} - -fn is_trigger_fn(fn_kind: FnKind<'_>) -> bool { - match fn_kind { - FnKind::Fn(_, _, func) => func.ident.name.as_str() == "it_looks_like_you_are_trying_to_kill_clippy", - FnKind::Closure(..) => false, - } -} diff --git a/tests/ui/custom_ice_message.rs b/tests/ui/custom_ice_message.rs index c7e92b1bf164..0102b9d76ecc 100644 --- a/tests/ui/custom_ice_message.rs +++ b/tests/ui/custom_ice_message.rs @@ -1,15 +1,13 @@ //@rustc-env:RUST_BACKTRACE=0 //@normalize-stderr-test: "Clippy version: .*" -> "Clippy version: foo" -//@normalize-stderr-test: "produce_ice.rs:\d*:\d*" -> "produce_ice.rs" -//@normalize-stderr-test: "', .*clippy_lints" -> "', clippy_lints" -//@normalize-stderr-test: "'rustc'" -> "''" +//@normalize-stderr-test: "custom_ice_message.rs:\d*:\d*" -> "custom_ice_message.rs" //@normalize-stderr-test: "rustc 1\.\d+.* running on .*" -> "rustc running on " //@normalize-stderr-test: "(?ms)query stack during panic:\n.*end of query stack\n" -> "" +//@normalize-stderr-test: "note: delayed at .*" -> "note: delayed at " +//@normalize-stderr-test: "note: compiler flags: .*" -> "note: compiler flags: " -#![deny(clippy::produce_ice)] -#![allow(clippy::missing_clippy_version_attribute)] - -fn it_looks_like_you_are_trying_to_kill_clippy() {} -//~^ ice: Would you like some help with that? +#![feature(rustc_attrs)] +#[rustc_delayed_bug_from_inside_query] fn main() {} +//~^ ice: delayed bug triggered by diff --git a/tests/ui/custom_ice_message.stderr b/tests/ui/custom_ice_message.stderr index c21963007c89..5fc979cfaf67 100644 --- a/tests/ui/custom_ice_message.stderr +++ b/tests/ui/custom_ice_message.stderr @@ -2,25 +2,23 @@ note: no errors encountered even though delayed bugs were created note: those delayed bugs will now be shown as internal compiler errors -error: internal compiler error: Would you like some help with that? - --> tests/ui/custom_ice_message.rs:12:1 +error: internal compiler error: delayed bug triggered by #[rustc_delayed_bug_from_inside_query] + --> tests/ui/custom_ice_message.rs | -LL | fn it_looks_like_you_are_trying_to_kill_clippy() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn main() {} + | ^^^^^^^^^ | -note: delayed at clippy_lints_internal/src/produce_ice.rs - disabled backtrace - --> tests/ui/custom_ice_message.rs:12:1 +note: delayed at + --> tests/ui/custom_ice_message.rs | -LL | fn it_looks_like_you_are_trying_to_kill_clippy() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn main() {} + | ^^^^^^^^^ -note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new?template=ice.yml - -note: please make sure that you have updated to the latest nightly +note: using internal features is not supported and expected to cause internal compiler errors when used incorrectly note: rustc running on -note: compiler flags: -Z ui-testing -Z deduplicate-diagnostics=no -Z next-solver=coherence +note: compiler flags: note: Clippy version: foo From 09c7d6fab3648d715c3ae00cc37b96c8f3f9bb93 Mon Sep 17 00:00:00 2001 From: Jason Newcomb Date: Mon, 17 Aug 2026 11:14:07 -0400 Subject: [PATCH 3/3] Remove the ICE integration test; it already has a regular test. --- .github/workflows/clippy_mq.yml | 1 - tests/integration.rs | 20 -------------------- 2 files changed, 21 deletions(-) diff --git a/.github/workflows/clippy_mq.yml b/.github/workflows/clippy_mq.yml index 43cab49d8ece..3dd4a5abe8f3 100644 --- a/.github/workflows/clippy_mq.yml +++ b/.github/workflows/clippy_mq.yml @@ -147,7 +147,6 @@ jobs: max-parallel: 6 matrix: integration: - - 'matthiaskrgr/clippy_ci_panic_test' - 'rust-lang/cargo' - 'rust-lang/chalk' - 'rust-lang/rustfmt' diff --git a/tests/integration.rs b/tests/integration.rs index 4275292fd86e..06e87c17d283 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -61,26 +61,6 @@ fn integration_test() { // debug: eprintln!("{stderr}"); - // this is an internal test to make sure we would correctly panic on a span_delayed_bug - if repo_name == "matthiaskrgr/clippy_ci_panic_test" { - // we need to kind of switch around our logic here: - // if we find a panic, everything is fine, if we don't panic, SOMETHING is broken about our testing - - // the repo basically just contains a span_delayed_bug that forces rustc/clippy to panic: - /* - #![feature(rustc_attrs)] - #[rustc_error(delayed_bug_from_inside_query)] - fn main() {} - */ - - if stderr.find("error: internal compiler error").is_some() { - eprintln!("we saw that we intentionally panicked, yay"); - return; - } - - panic!("panic caused by span_delayed_bug was NOT detected! Something is broken!"); - } - if let Some(backtrace_start) = stderr.find("error: internal compiler error") { static BACKTRACE_END_MSG: &str = "end of query stack"; let backtrace_end = stderr[backtrace_start..]