Add a non-shallow fake borrow
This commit is contained in:
parent
511bd78863
commit
50531806ee
32 changed files with 188 additions and 92 deletions
|
@ -685,7 +685,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
fake_borrow_temp.into(),
|
||||
Rvalue::Ref(
|
||||
tcx.lifetimes.re_erased,
|
||||
BorrowKind::Fake,
|
||||
BorrowKind::Fake(FakeBorrowKind::Shallow),
|
||||
Place { local: base_place.local, projection },
|
||||
),
|
||||
);
|
||||
|
|
|
@ -2106,7 +2106,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
let re_erased = tcx.lifetimes.re_erased;
|
||||
let scrutinee_source_info = self.source_info(scrutinee_span);
|
||||
for &(place, temp) in fake_borrows {
|
||||
let borrow = Rvalue::Ref(re_erased, BorrowKind::Fake, place);
|
||||
let borrow =
|
||||
Rvalue::Ref(re_erased, BorrowKind::Fake(FakeBorrowKind::Shallow), place);
|
||||
self.cfg.push_assign(block, scrutinee_source_info, Place::from(temp), borrow);
|
||||
}
|
||||
|
||||
|
|
|
@ -513,7 +513,7 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> {
|
|||
visit::walk_expr(&mut visitor, expr);
|
||||
if visitor.found {
|
||||
match borrow_kind {
|
||||
BorrowKind::Fake | BorrowKind::Shared
|
||||
BorrowKind::Fake(_) | BorrowKind::Shared
|
||||
if !self.thir[arg].ty.is_freeze(self.tcx, self.param_env) =>
|
||||
{
|
||||
self.requires_unsafe(expr.span, BorrowOfLayoutConstrainedField)
|
||||
|
@ -521,7 +521,7 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> {
|
|||
BorrowKind::Mut { .. } => {
|
||||
self.requires_unsafe(expr.span, MutationOfLayoutConstrainedField)
|
||||
}
|
||||
BorrowKind::Fake | BorrowKind::Shared => {}
|
||||
BorrowKind::Fake(_) | BorrowKind::Shared => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue