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:
commit
6245b951d5
6 changed files with 32 additions and 54 deletions
|
@ -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) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue