1
Fork 0

Fix multiple expect attribs in impl block

Closes #114416
This commit is contained in:
Chinedu Francis Nwafili 2023-08-03 09:50:00 -04:00
parent c115ec11d2
commit b56a04975c
No known key found for this signature in database
GPG key ID: 3C85D8F6538D8AD9
3 changed files with 36 additions and 0 deletions

View file

@ -814,6 +814,13 @@ impl<'tcx> DeadVisitor<'tcx> {
}
};
for id in &dead_codes[1..] {
let hir = self.tcx.hir().local_def_id_to_hir_id(*id);
let lint_level = self.tcx.lint_level_at_node(lint::builtin::DEAD_CODE, hir).0;
if let Some(expectation_id) = lint_level.get_expectation_id() {
self.tcx.sess.diagnostic().insert_fulfilled_expectation(expectation_id);
}
}
self.tcx.emit_spanned_lint(
lint,
tcx.hir().local_def_id_to_hir_id(first_id),