Don't emit null pointer lint for raw ref of null deref
This commit is contained in:
parent
f2a80a0f89
commit
367183bc0c
7 changed files with 28 additions and 41 deletions
|
@ -509,8 +509,6 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> {
|
|||
}
|
||||
ExprKind::RawBorrow { arg, .. } => {
|
||||
if let ExprKind::Scope { value: arg, .. } = self.thir[arg].kind
|
||||
// THIR desugars UNSAFE_STATIC into *UNSAFE_STATIC_REF, where
|
||||
// UNSAFE_STATIC_REF holds the addr of the UNSAFE_STATIC, so: take two steps
|
||||
&& let ExprKind::Deref { arg } = self.thir[arg].kind
|
||||
{
|
||||
// Taking a raw ref to a deref place expr is always safe.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue