Skip to content

Commit e4d3b0a

Browse files
Update produce_ice so its error can be checked in ui tests
1 parent cfc7432 commit e4d3b0a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

clippy_lints/src/utils/internal_lints/produce_ice.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use rustc_ast::ast::NodeId;
22
use rustc_ast::visit::FnKind;
3-
use rustc_lint::{EarlyContext, EarlyLintPass};
3+
use rustc_lint::{EarlyContext, EarlyLintPass, LintContext};
44
use rustc_session::declare_lint_pass;
55
use rustc_span::Span;
66

@@ -24,8 +24,12 @@ declare_clippy_lint! {
2424
declare_lint_pass!(ProduceIce => [PRODUCE_ICE]);
2525

2626
impl EarlyLintPass for ProduceIce {
27-
fn check_fn(&mut self, _: &EarlyContext<'_>, fn_kind: FnKind<'_>, _: Span, _: NodeId) {
28-
assert!(!is_trigger_fn(fn_kind), "Would you like some help with that?");
27+
fn check_fn(&mut self, ctx: &EarlyContext<'_>, fn_kind: FnKind<'_>, span: Span, _: NodeId) {
28+
if is_trigger_fn(fn_kind) {
29+
ctx.sess()
30+
.dcx()
31+
.span_delayed_bug(span, "Would you like some help with that?");
32+
}
2933
}
3034
}
3135

0 commit comments

Comments
 (0)