Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 367c014

Browse files
committed
rename AddressOf -> RawBorrow inside the compiler
1 parent 9d2f469 commit 367c014

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,
@@ -2477,7 +2477,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
24772477
self.check_operand(right, location);
24782478
}
24792479

2480-
Rvalue::AddressOf(..)
2480+
Rvalue::RawPtr(..)
24812481
| Rvalue::ThreadLocalRef(..)
24822482
| Rvalue::Len(..)
24832483
| Rvalue::Discriminant(..)
@@ -2494,7 +2494,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
24942494
| Rvalue::ThreadLocalRef(_)
24952495
| Rvalue::Repeat(..)
24962496
| Rvalue::Ref(..)
2497-
| Rvalue::AddressOf(..)
2497+
| Rvalue::RawPtr(..)
24982498
| Rvalue::Len(..)
24992499
| Rvalue::Cast(..)
25002500
| 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
@@ -582,7 +582,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
582582
mir::Rvalue::CopyForDeref(place) => {
583583
self.codegen_operand(bx, &mir::Operand::Copy(place))
584584
}
585-
mir::Rvalue::AddressOf(mutability, place) => {
585+
mir::Rvalue::RawPtr(mutability, place) => {
586586
let mk_ptr =
587587
move |tcx: TyCtxt<'tcx>, ty: Ty<'tcx>| Ty::new_ptr(tcx, ty, mutability);
588588
self.codegen_place_to_pointer(bx, place, mk_ptr)
@@ -811,7 +811,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
811811
cg_value.len(bx.cx())
812812
}
813813

814-
/// Codegen an `Rvalue::AddressOf` or `Rvalue::Ref`
814+
/// Codegen an `Rvalue::RawPtr` or `Rvalue::Ref`
815815
fn codegen_place_to_pointer(
816816
&mut self,
817817
bx: &mut Bx,
@@ -1083,7 +1083,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
10831083
}
10841084
mir::Rvalue::Ref(..) |
10851085
mir::Rvalue::CopyForDeref(..) |
1086-
mir::Rvalue::AddressOf(..) |
1086+
mir::Rvalue::RawPtr(..) |
10871087
mir::Rvalue::Len(..) |
10881088
mir::Rvalue::Cast(..) | // (*)
10891089
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
@@ -430,13 +430,13 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
430430
return;
431431
}
432432
}
433-
Rvalue::AddressOf(mutbl, place) => {
433+
Rvalue::RawPtr(mutbl, place) => {
434434
if let Some(reborrowed_place_ref) = place_as_reborrow(self.tcx, self.body, place) {
435435
let ctx = match mutbl {
436436
Mutability::Not => {
437-
PlaceContext::NonMutatingUse(NonMutatingUseContext::AddressOf)
437+
PlaceContext::NonMutatingUse(NonMutatingUseContext::RawBorrow)
438438
}
439-
Mutability::Mut => PlaceContext::MutatingUse(MutatingUseContext::AddressOf),
439+
Mutability::Mut => PlaceContext::MutatingUse(MutatingUseContext::RawBorrow),
440440
};
441441
self.visit_local(reborrowed_place_ref.local, ctx, location);
442442
self.visit_projection(reborrowed_place_ref, ctx, location);
@@ -471,7 +471,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
471471
}
472472

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

494494
Rvalue::Ref(_, BorrowKind::Shared | BorrowKind::Fake(_), place)
495-
| Rvalue::AddressOf(Mutability::Not, place) => {
495+
| Rvalue::RawPtr(Mutability::Not, place) => {
496496
let borrowed_place_has_mut_interior = qualifs::in_place::<HasMutInterior, _>(
497497
self.ccx,
498498
&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)