rename AddressOf -> RawBorrow inside the compiler
This commit is contained in:
parent
b8464961a2
commit
35709be02d
51 changed files with 92 additions and 92 deletions
|
@ -1038,7 +1038,7 @@ impl<'tcx> Debug for Rvalue<'tcx> {
|
|||
|
||||
CopyForDeref(ref place) => write!(fmt, "deref_copy {place:#?}"),
|
||||
|
||||
AddressOf(mutability, ref place) => {
|
||||
RawPtr(mutability, ref place) => {
|
||||
write!(fmt, "&raw {mut_str} {place:?}", mut_str = mutability.ptr_str())
|
||||
}
|
||||
|
||||
|
|
|
@ -423,7 +423,7 @@ impl<'tcx> Rvalue<'tcx> {
|
|||
| Rvalue::Repeat(_, _)
|
||||
| Rvalue::Ref(_, _, _)
|
||||
| Rvalue::ThreadLocalRef(_)
|
||||
| Rvalue::AddressOf(_, _)
|
||||
| Rvalue::RawPtr(_, _)
|
||||
| Rvalue::Len(_)
|
||||
| Rvalue::Cast(
|
||||
CastKind::IntToInt
|
||||
|
|
|
@ -1293,14 +1293,14 @@ pub enum Rvalue<'tcx> {
|
|||
/// nature of this operation?
|
||||
ThreadLocalRef(DefId),
|
||||
|
||||
/// Creates a pointer with the indicated mutability to the place.
|
||||
/// Creates a raw pointer with the indicated mutability to the place.
|
||||
///
|
||||
/// This is generated by pointer casts like `&v as *const _` or raw address of expressions like
|
||||
/// `&raw v` or `addr_of!(v)`.
|
||||
/// This is generated by pointer casts like `&v as *const _` or raw borrow expressions like
|
||||
/// `&raw const v`.
|
||||
///
|
||||
/// Like with references, the semantics of this operation are heavily dependent on the aliasing
|
||||
/// model.
|
||||
AddressOf(Mutability, Place<'tcx>),
|
||||
RawPtr(Mutability, Place<'tcx>),
|
||||
|
||||
/// Yields the length of the place, as a `usize`.
|
||||
///
|
||||
|
|
|
@ -170,7 +170,7 @@ impl<'tcx> Rvalue<'tcx> {
|
|||
let place_ty = place.ty(local_decls, tcx).ty;
|
||||
Ty::new_ref(tcx, reg, place_ty, bk.to_mutbl_lossy())
|
||||
}
|
||||
Rvalue::AddressOf(mutability, ref place) => {
|
||||
Rvalue::RawPtr(mutability, ref place) => {
|
||||
let place_ty = place.ty(local_decls, tcx).ty;
|
||||
Ty::new_ptr(tcx, place_ty, mutability)
|
||||
}
|
||||
|
|
|
@ -682,13 +682,13 @@ macro_rules! make_mir_visitor {
|
|||
);
|
||||
}
|
||||
|
||||
Rvalue::AddressOf(m, path) => {
|
||||
Rvalue::RawPtr(m, path) => {
|
||||
let ctx = match m {
|
||||
Mutability::Mut => PlaceContext::MutatingUse(
|
||||
MutatingUseContext::AddressOf
|
||||
MutatingUseContext::RawBorrow
|
||||
),
|
||||
Mutability::Not => PlaceContext::NonMutatingUse(
|
||||
NonMutatingUseContext::AddressOf
|
||||
NonMutatingUseContext::RawBorrow
|
||||
),
|
||||
};
|
||||
self.visit_place(path, ctx, location);
|
||||
|
@ -1299,8 +1299,8 @@ pub enum NonMutatingUseContext {
|
|||
/// FIXME: do we need to distinguish shallow and deep fake borrows? In fact, do we need to
|
||||
/// distinguish fake and normal deep borrows?
|
||||
FakeBorrow,
|
||||
/// AddressOf for *const pointer.
|
||||
AddressOf,
|
||||
/// `&raw const`.
|
||||
RawBorrow,
|
||||
/// PlaceMention statement.
|
||||
///
|
||||
/// This statement is executed as a check that the `Place` is live without reading from it,
|
||||
|
@ -1333,8 +1333,8 @@ pub enum MutatingUseContext {
|
|||
Drop,
|
||||
/// Mutable borrow.
|
||||
Borrow,
|
||||
/// AddressOf for *mut pointer.
|
||||
AddressOf,
|
||||
/// `&raw mut`.
|
||||
RawBorrow,
|
||||
/// Used as base for another place, e.g., `x` in `x.y`. Could potentially mutate the place.
|
||||
/// For example, the projection `x.y` is marked as a mutation in these cases:
|
||||
/// ```ignore (illustrative)
|
||||
|
@ -1386,8 +1386,8 @@ impl PlaceContext {
|
|||
pub fn is_address_of(&self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
PlaceContext::NonMutatingUse(NonMutatingUseContext::AddressOf)
|
||||
| PlaceContext::MutatingUse(MutatingUseContext::AddressOf)
|
||||
PlaceContext::NonMutatingUse(NonMutatingUseContext::RawBorrow)
|
||||
| PlaceContext::MutatingUse(MutatingUseContext::RawBorrow)
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -407,7 +407,7 @@ pub enum ExprKind<'tcx> {
|
|||
arg: ExprId,
|
||||
},
|
||||
/// A `&raw [const|mut] $place_expr` raw borrow resulting in type `*[const|mut] T`.
|
||||
AddressOf {
|
||||
RawBorrow {
|
||||
mutability: hir::Mutability,
|
||||
arg: ExprId,
|
||||
},
|
||||
|
|
|
@ -92,7 +92,7 @@ pub fn walk_expr<'thir, 'tcx: 'thir, V: Visitor<'thir, 'tcx>>(
|
|||
}
|
||||
VarRef { id: _ } | UpvarRef { closure_def_id: _, var_hir_id: _ } => {}
|
||||
Borrow { arg, borrow_kind: _ } => visitor.visit_expr(&visitor.thir()[arg]),
|
||||
AddressOf { arg, mutability: _ } => visitor.visit_expr(&visitor.thir()[arg]),
|
||||
RawBorrow { arg, mutability: _ } => visitor.visit_expr(&visitor.thir()[arg]),
|
||||
Break { value, label: _ } => {
|
||||
if let Some(value) = value {
|
||||
visitor.visit_expr(&visitor.thir()[value])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue