Skip to content

Commit 35709be

Browse files
committed
rename AddressOf -> RawBorrow inside the compiler
1 parent b846496 commit 35709be

File tree

51 files changed

+92
-92
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+92
-92
lines changed

compiler/rustc_borrowck/src/def_use.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ pub fn categorize(context: PlaceContext) -> Option<DefUse> {
5555
PlaceContext::NonMutatingUse(NonMutatingUseContext::PlaceMention) |
5656
PlaceContext::NonUse(NonUseContext::AscribeUserTy(_)) |
5757

58-
PlaceContext::MutatingUse(MutatingUseContext::AddressOf) |
59-
PlaceContext::NonMutatingUse(NonMutatingUseContext::AddressOf) |
58+
PlaceContext::MutatingUse(MutatingUseContext::RawBorrow) |
59+
PlaceContext::NonMutatingUse(NonMutatingUseContext::RawBorrow) |
6060
PlaceContext::NonMutatingUse(NonMutatingUseContext::Inspect) |
6161
PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy) |
6262
PlaceContext::NonMutatingUse(NonMutatingUseContext::Move) |

compiler/rustc_borrowck/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,7 @@ impl<'mir, 'tcx> MirBorrowckCtxt<'_, 'mir, '_, 'tcx> {
12421242
);
12431243
}
12441244

1245-
&Rvalue::AddressOf(mutability, place) => {
1245+
&Rvalue::RawPtr(mutability, place) => {
12461246
let access_kind = match mutability {
12471247
Mutability::Mut => (
12481248
Deep,

compiler/rustc_borrowck/src/polonius/loan_invalidations.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ impl<'cx, 'tcx> LoanInvalidationsGenerator<'cx, 'tcx> {
269269
self.access_place(location, place, access_kind, LocalMutationIsAllowed::No);
270270
}
271271

272-
&Rvalue::AddressOf(mutability, place) => {
272+
&Rvalue::RawPtr(mutability, place) => {
273273
let access_kind = match mutability {
274274
Mutability::Mut => (
275275
Deep,

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
756756
PlaceContext::MutatingUse(_) => ty::Invariant,
757757
PlaceContext::NonUse(StorageDead | StorageLive | VarDebugInfo) => ty::Invariant,
758758
PlaceContext::NonMutatingUse(
759-
Inspect | Copy | Move | PlaceMention | SharedBorrow | FakeBorrow | AddressOf
759+
Inspect | Copy | Move | PlaceMention | SharedBorrow | FakeBorrow | RawBorrow
760760
| Projection,
761761
) => ty::Covariant,
762762
PlaceContext::NonUse(AscribeUserTy(variance)) => variance,
@@ -2468,7 +2468,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
24682468
self.check_operand(right, location);
24692469
}
24702470

2471-
Rvalue::AddressOf(..)
2471+
Rvalue::RawPtr(..)
24722472
| Rvalue::ThreadLocalRef(..)
24732473
| Rvalue::Len(..)
24742474
| Rvalue::Discriminant(..)
@@ -2485,7 +2485,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
24852485
| Rvalue::ThreadLocalRef(_)
24862486
| Rvalue::Repeat(..)
24872487
| Rvalue::Ref(..)
2488-
| Rvalue::AddressOf(..)
2488+
| Rvalue::RawPtr(..)
24892489
| Rvalue::Len(..)
24902490
| Rvalue::Cast(..)
24912491
| Rvalue::ShallowInitBox(..)

compiler/rustc_codegen_cranelift/src/analyze.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub(crate) fn analyze(fx: &FunctionCx<'_, '_, '_>) -> IndexVec<Local, SsaKind> {
2525
for stmt in bb.statements.iter() {
2626
match &stmt.kind {
2727
Assign(place_and_rval) => match &place_and_rval.1 {
28-
Rvalue::Ref(_, _, place) | Rvalue::AddressOf(_, place) => {
28+
Rvalue::Ref(_, _, place) | Rvalue::RawPtr(_, place) => {
2929
flag_map[place.local] = SsaKind::NotSsa;
3030
}
3131
_ => {}

compiler/rustc_codegen_cranelift/src/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ fn codegen_stmt<'tcx>(
595595
let val = cplace.to_cvalue(fx);
596596
lval.write_cvalue(fx, val)
597597
}
598-
Rvalue::Ref(_, _, place) | Rvalue::AddressOf(_, place) => {
598+
Rvalue::Ref(_, _, place) | Rvalue::RawPtr(_, place) => {
599599
let place = codegen_place(fx, place);
600600
let ref_ = place.place_ref(fx, lval.layout());
601601
lval.write_cvalue(fx, ref_);

compiler/rustc_codegen_ssa/src/mir/analyze.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,14 @@ impl<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
220220
| MutatingUseContext::SetDiscriminant
221221
| MutatingUseContext::AsmOutput
222222
| MutatingUseContext::Borrow
223-
| MutatingUseContext::AddressOf
223+
| MutatingUseContext::RawBorrow
224224
| MutatingUseContext::Projection,
225225
)
226226
| PlaceContext::NonMutatingUse(
227227
NonMutatingUseContext::Inspect
228228
| NonMutatingUseContext::SharedBorrow
229229
| NonMutatingUseContext::FakeBorrow
230-
| NonMutatingUseContext::AddressOf
230+
| NonMutatingUseContext::RawBorrow
231231
| NonMutatingUseContext::Projection,
232232
) => {
233233
self.locals[local] = LocalKind::Memory;

compiler/rustc_codegen_ssa/src/mir/rvalue.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
584584
mir::Rvalue::CopyForDeref(place) => {
585585
self.codegen_operand(bx, &mir::Operand::Copy(place))
586586
}
587-
mir::Rvalue::AddressOf(mutability, place) => {
587+
mir::Rvalue::RawPtr(mutability, place) => {
588588
let mk_ptr =
589589
move |tcx: TyCtxt<'tcx>, ty: Ty<'tcx>| Ty::new_ptr(tcx, ty, mutability);
590590
self.codegen_place_to_pointer(bx, place, mk_ptr)
@@ -813,7 +813,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
813813
cg_value.len(bx.cx())
814814
}
815815

816-
/// Codegen an `Rvalue::AddressOf` or `Rvalue::Ref`
816+
/// Codegen an `Rvalue::RawPtr` or `Rvalue::Ref`
817817
fn codegen_place_to_pointer(
818818
&mut self,
819819
bx: &mut Bx,
@@ -1085,7 +1085,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
10851085
}
10861086
mir::Rvalue::Ref(..) |
10871087
mir::Rvalue::CopyForDeref(..) |
1088-
mir::Rvalue::AddressOf(..) |
1088+
mir::Rvalue::RawPtr(..) |
10891089
mir::Rvalue::Len(..) |
10901090
mir::Rvalue::Cast(..) | // (*)
10911091
mir::Rvalue::ShallowInitBox(..) | // (*)

compiler/rustc_const_eval/src/check_consts/check.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -431,13 +431,13 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
431431
return;
432432
}
433433
}
434-
Rvalue::AddressOf(mutbl, place) => {
434+
Rvalue::RawPtr(mutbl, place) => {
435435
if let Some(reborrowed_place_ref) = place_as_reborrow(self.tcx, self.body, place) {
436436
let ctx = match mutbl {
437437
Mutability::Not => {
438-
PlaceContext::NonMutatingUse(NonMutatingUseContext::AddressOf)
438+
PlaceContext::NonMutatingUse(NonMutatingUseContext::RawBorrow)
439439
}
440-
Mutability::Mut => PlaceContext::MutatingUse(MutatingUseContext::AddressOf),
440+
Mutability::Mut => PlaceContext::MutatingUse(MutatingUseContext::RawBorrow),
441441
};
442442
self.visit_local(reborrowed_place_ref.local, ctx, location);
443443
self.visit_projection(reborrowed_place_ref, ctx, location);
@@ -472,7 +472,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
472472
}
473473

474474
Rvalue::Ref(_, BorrowKind::Mut { .. }, place)
475-
| Rvalue::AddressOf(Mutability::Mut, place) => {
475+
| Rvalue::RawPtr(Mutability::Mut, place) => {
476476
// Inside mutable statics, we allow arbitrary mutable references.
477477
// We've allowed `static mut FOO = &mut [elements];` for a long time (the exact
478478
// reasons why are lost to history), and there is no reason to restrict that to
@@ -493,7 +493,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
493493
}
494494

495495
Rvalue::Ref(_, BorrowKind::Shared | BorrowKind::Fake(_), place)
496-
| Rvalue::AddressOf(Mutability::Not, place) => {
496+
| Rvalue::RawPtr(Mutability::Not, place) => {
497497
let borrowed_place_has_mut_interior = qualifs::in_place::<HasMutInterior, _>(
498498
self.ccx,
499499
&mut |local| self.qualifs.has_mut_interior(self.ccx, local, location),

compiler/rustc_const_eval/src/check_consts/qualifs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ where
291291
in_operand::<Q, _>(cx, in_local, lhs) || in_operand::<Q, _>(cx, in_local, rhs)
292292
}
293293

294-
Rvalue::Ref(_, _, place) | Rvalue::AddressOf(_, place) => {
294+
Rvalue::Ref(_, _, place) | Rvalue::RawPtr(_, place) => {
295295
// Special-case reborrows to be more like a copy of the reference.
296296
if let Some((place_base, ProjectionElem::Deref)) = place.as_ref().last_projection() {
297297
let base_ty = place_base.ty(cx.body, cx.tcx).ty;

0 commit comments

Comments
 (0)