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/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/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..] diff --git a/tests/ui-internal/custom_ice_message.rs b/tests/ui-internal/custom_ice_message.rs deleted file mode 100644 index c7e92b1bf164..000000000000 --- a/tests/ui-internal/custom_ice_message.rs +++ /dev/null @@ -1,15 +0,0 @@ -//@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: "rustc 1\.\d+.* running on .*" -> "rustc running on " -//@normalize-stderr-test: "(?ms)query stack during panic:\n.*end of query stack\n" -> "" - -#![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? - -fn main() {} diff --git a/tests/ui-internal/custom_ice_message.stderr b/tests/ui-internal/custom_ice_message.stderr deleted file mode 100644 index 2e4d53104fba..000000000000 --- a/tests/ui-internal/custom_ice_message.stderr +++ /dev/null @@ -1,26 +0,0 @@ -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 - | -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 - | -LL | fn it_looks_like_you_are_trying_to_kill_clippy() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -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: rustc running on - -note: compiler flags: -Z ui-testing -Z deduplicate-diagnostics=no -Z next-solver=coherence - -note: Clippy version: foo - diff --git a/tests/ui/custom_ice_message.rs b/tests/ui/custom_ice_message.rs new file mode 100644 index 000000000000..0102b9d76ecc --- /dev/null +++ b/tests/ui/custom_ice_message.rs @@ -0,0 +1,13 @@ +//@rustc-env:RUST_BACKTRACE=0 +//@normalize-stderr-test: "Clippy version: .*" -> "Clippy version: foo" +//@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: " + +#![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 new file mode 100644 index 000000000000..5fc979cfaf67 --- /dev/null +++ b/tests/ui/custom_ice_message.stderr @@ -0,0 +1,24 @@ +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: delayed bug triggered by #[rustc_delayed_bug_from_inside_query] + --> tests/ui/custom_ice_message.rs + | +LL | fn main() {} + | ^^^^^^^^^ + | +note: delayed at + --> tests/ui/custom_ice_message.rs + | +LL | fn main() {} + | ^^^^^^^^^ + +note: using internal features is not supported and expected to cause internal compiler errors when used incorrectly + +note: rustc running on + +note: compiler flags: + +note: Clippy version: foo +