Ignore AscribeUserType in unsafeck to avoid duplicate diagnostics.

This commit is contained in:
Camille GILLOT 2022-11-26 13:16:47 +00:00
parent 4462bb54e3
commit e107194b66
6 changed files with 17 additions and 33 deletions

View file

@ -100,7 +100,6 @@ impl<'tcx> Visitor<'tcx> for UnsafetyChecker<'_, 'tcx> {
| StatementKind::StorageLive(..)
| StatementKind::StorageDead(..)
| StatementKind::Retag { .. }
| StatementKind::AscribeUserType(..)
| StatementKind::PlaceMention(..)
| StatementKind::Coverage(..)
| StatementKind::Intrinsic(..)
@ -108,6 +107,9 @@ impl<'tcx> Visitor<'tcx> for UnsafetyChecker<'_, 'tcx> {
| StatementKind::Nop => {
// safe (at least as emitted during MIR construction)
}
// `AscribeUserType` just exists to help MIR borrowck. It has no semantics, and
// everything is already reported by `PlaceMention`.
StatementKind::AscribeUserType(..) => return,
}
self.super_statement(statement, location);
}