rename AddressOf -> RawBorrow inside the compiler
This commit is contained in:
parent
b8464961a2
commit
35709be02d
51 changed files with 92 additions and 92 deletions
|
@ -244,8 +244,8 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
|
|||
ExprKind::Borrow { borrow_kind, arg } => Ok(
|
||||
Rvalue::Ref(self.tcx.lifetimes.re_erased, *borrow_kind, self.parse_place(*arg)?)
|
||||
),
|
||||
ExprKind::AddressOf { mutability, arg } => Ok(
|
||||
Rvalue::AddressOf(*mutability, self.parse_place(*arg)?)
|
||||
ExprKind::RawBorrow { mutability, arg } => Ok(
|
||||
Rvalue::RawPtr(*mutability, self.parse_place(*arg)?)
|
||||
),
|
||||
ExprKind::Binary { op, lhs, rhs } => Ok(
|
||||
Rvalue::BinaryOp(*op, Box::new((self.parse_operand(*lhs)?, self.parse_operand(*rhs)?)))
|
||||
|
|
|
@ -542,7 +542,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
| ExprKind::PointerCoercion { .. }
|
||||
| ExprKind::Repeat { .. }
|
||||
| ExprKind::Borrow { .. }
|
||||
| ExprKind::AddressOf { .. }
|
||||
| ExprKind::RawBorrow { .. }
|
||||
| ExprKind::Match { .. }
|
||||
| ExprKind::If { .. }
|
||||
| ExprKind::Loop { .. }
|
||||
|
|
|
@ -512,7 +512,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
| ExprKind::NeverToAny { .. }
|
||||
| ExprKind::Use { .. }
|
||||
| ExprKind::Borrow { .. }
|
||||
| ExprKind::AddressOf { .. }
|
||||
| ExprKind::RawBorrow { .. }
|
||||
| ExprKind::Adt { .. }
|
||||
| ExprKind::Loop { .. }
|
||||
| ExprKind::LogicalOp { .. }
|
||||
|
|
|
@ -51,7 +51,7 @@ impl Category {
|
|||
| ExprKind::Use { .. }
|
||||
| ExprKind::Adt { .. }
|
||||
| ExprKind::Borrow { .. }
|
||||
| ExprKind::AddressOf { .. }
|
||||
| ExprKind::RawBorrow { .. }
|
||||
| ExprKind::Yield { .. }
|
||||
| ExprKind::Call { .. }
|
||||
| ExprKind::InlineAsm { .. } => Some(Category::Rvalue(RvalueFunc::Into)),
|
||||
|
|
|
@ -303,12 +303,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
this.cfg.push_assign(block, source_info, destination, borrow);
|
||||
block.unit()
|
||||
}
|
||||
ExprKind::AddressOf { mutability, arg } => {
|
||||
ExprKind::RawBorrow { mutability, arg } => {
|
||||
let place = match mutability {
|
||||
hir::Mutability::Not => this.as_read_only_place(block, arg),
|
||||
hir::Mutability::Mut => this.as_place(block, arg),
|
||||
};
|
||||
let address_of = Rvalue::AddressOf(mutability, unpack!(block = place));
|
||||
let address_of = Rvalue::RawPtr(mutability, unpack!(block = place));
|
||||
this.cfg.push_assign(block, source_info, destination, address_of);
|
||||
block.unit()
|
||||
}
|
||||
|
|
|
@ -397,7 +397,7 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> {
|
|||
| ExprKind::Scope { .. }
|
||||
| ExprKind::Cast { .. } => {}
|
||||
|
||||
ExprKind::AddressOf { .. }
|
||||
ExprKind::RawBorrow { .. }
|
||||
| ExprKind::Adt { .. }
|
||||
| ExprKind::Array { .. }
|
||||
| ExprKind::Binary { .. }
|
||||
|
@ -498,7 +498,7 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
}
|
||||
ExprKind::AddressOf { arg, .. } => {
|
||||
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
|
||||
|
|
|
@ -143,7 +143,7 @@ impl<'tcx> Cx<'tcx> {
|
|||
arg: self.thir.exprs.push(expr),
|
||||
},
|
||||
Adjust::Borrow(AutoBorrow::RawPtr(mutability)) => {
|
||||
ExprKind::AddressOf { mutability, arg: self.thir.exprs.push(expr) }
|
||||
ExprKind::RawBorrow { mutability, arg: self.thir.exprs.push(expr) }
|
||||
}
|
||||
Adjust::DynStar => ExprKind::Cast { source: self.thir.exprs.push(expr) },
|
||||
};
|
||||
|
@ -396,7 +396,7 @@ impl<'tcx> Cx<'tcx> {
|
|||
}
|
||||
|
||||
hir::ExprKind::AddrOf(hir::BorrowKind::Raw, mutability, arg) => {
|
||||
ExprKind::AddressOf { mutability, arg: self.mirror_expr(arg) }
|
||||
ExprKind::RawBorrow { mutability, arg: self.mirror_expr(arg) }
|
||||
}
|
||||
|
||||
hir::ExprKind::Block(blk, _) => ExprKind::Block { block: self.mirror_block(blk) },
|
||||
|
|
|
@ -325,7 +325,7 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> {
|
|||
Assign { .. } | AssignOp { .. } | InlineAsm { .. } | Let { .. } => true,
|
||||
|
||||
// These evaluate to a value.
|
||||
AddressOf { .. }
|
||||
RawBorrow { .. }
|
||||
| Adt { .. }
|
||||
| Array { .. }
|
||||
| Binary { .. }
|
||||
|
|
|
@ -379,8 +379,8 @@ impl<'a, 'tcx> ThirPrinter<'a, 'tcx> {
|
|||
self.print_expr(*arg, depth_lvl + 2);
|
||||
print_indented!(self, ")", depth_lvl);
|
||||
}
|
||||
AddressOf { mutability, arg } => {
|
||||
print_indented!(self, "AddressOf {", depth_lvl);
|
||||
RawBorrow { mutability, arg } => {
|
||||
print_indented!(self, "RawBorrow {", depth_lvl);
|
||||
print_indented!(self, format!("mutability: {:?}", mutability), depth_lvl + 1);
|
||||
print_indented!(self, "arg:", depth_lvl + 1);
|
||||
self.print_expr(*arg, depth_lvl + 2);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue