Remove MaybeMutBorrowedLocals
This commit is contained in:
parent
473eaa42e9
commit
b285e0c5d8
7 changed files with 26 additions and 207 deletions
|
@ -110,6 +110,15 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
/// `&` and `&raw` only allow mutation if the borrowed place is `!Freeze`.
|
||||
///
|
||||
/// This assumes that it is UB to take the address of a struct field whose type is
|
||||
/// `Freeze`, then use pointer arithmetic to derive a pointer to a *different* field of
|
||||
/// that same struct whose type is `!Freeze`. If we decide that this is not UB, we will
|
||||
/// have to check the type of the borrowed **local** instead of the borrowed **place**
|
||||
/// below. See [rust-lang/unsafe-code-guidelines#134].
|
||||
///
|
||||
/// [rust-lang/unsafe-code-guidelines#134]: https://github.com/rust-lang/unsafe-code-guidelines/issues/134
|
||||
fn shared_borrow_allows_mutation(&self, place: mir::Place<'tcx>) -> bool {
|
||||
!place
|
||||
.ty(self.ccx.body, self.ccx.tcx)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue