Rollup merge of #77420 - ecstatic-morse:const-checking-raw-mut-ref, r=davidtwco

Unify const-checking structured errors for `&mut` and `&raw mut`

Resolves #77414 as well as a FIXME.
This commit is contained in:
Yuki Okushi 2020-10-22 09:45:25 +09:00 committed by GitHub
commit 6245b951d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 32 additions and 54 deletions

View file

@ -525,14 +525,16 @@ impl Visitor<'tcx> for Validator<'mir, 'tcx> {
if !is_allowed {
if let BorrowKind::Mut { .. } = kind {
self.check_op(ops::MutBorrow);
self.check_op(ops::MutBorrow(hir::BorrowKind::Ref));
} else {
self.check_op(ops::CellBorrow);
}
}
}
Rvalue::AddressOf(Mutability::Mut, _) => self.check_op(ops::MutAddressOf),
Rvalue::AddressOf(Mutability::Mut, _) => {
self.check_op(ops::MutBorrow(hir::BorrowKind::Raw))
}
Rvalue::Ref(_, BorrowKind::Shared | BorrowKind::Shallow, ref place)
| Rvalue::AddressOf(Mutability::Not, ref place) => {