1
Fork 0

Handle #[expect(unfulfilled_lint_expectations)] with a lint message

This commit is contained in:
xFrednet 2022-03-06 14:18:28 +01:00
parent 165b5583e5
commit d39d60971b
No known key found for this signature in database
GPG key ID: FCDCBF29AF64D601
6 changed files with 119 additions and 14 deletions

View file

@ -30,10 +30,6 @@ fn emit_unfulfilled_expectation_lint(
hir_id: HirId,
expectation: &LintExpectation,
) {
// FIXME: The current implementation doesn't cover cases where the
// `unfulfilled_lint_expectations` is actually expected by another lint
// expectation. This can be added here by checking the lint level and
// retrieving the `LintExpectationId` if it was expected.
tcx.struct_span_lint_hir(
builtin::UNFULFILLED_LINT_EXPECTATIONS,
hir_id,
@ -43,6 +39,11 @@ fn emit_unfulfilled_expectation_lint(
if let Some(rationale) = expectation.reason {
diag.note(&rationale.as_str());
}
if expectation.is_unfulfilled_lint_expectations {
diag.note("the `unfulfilled_lint_expectations` lint can't be expected and will always produce this message");
}
diag.emit();
},
);