1
Fork 0

Rollup merge of #97626 - RalfJung:expose, r=tmiasko

rename PointerAddress → PointerExposeAddress

`PointerAddress` sounds a bit too much like `ptr.addr()`, but this corresponds to `ptr.expose_addr()`.

r? `@tmiasko`
This commit is contained in:
Yuki Okushi 2022-06-02 06:44:29 +09:00 committed by GitHub
commit b78c118b09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 23 additions and 18 deletions

View file

@ -31,9 +31,9 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
self.unsize_into(src, cast_ty, dest)?;
}
PointerAddress => {
PointerExposeAddress => {
let src = self.read_immediate(src)?;
let res = self.pointer_address_cast(&src, cast_ty)?;
let res = self.pointer_expose_address_cast(&src, cast_ty)?;
self.write_immediate(res, dest)?;
}
@ -184,7 +184,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
Ok(self.cast_from_int_like(scalar, src.layout, cast_ty)?.into())
}
pub fn pointer_address_cast(
pub fn pointer_expose_address_cast(
&mut self,
src: &ImmTy<'tcx, M::PointerTag>,
cast_ty: Ty<'tcx>,

View file

@ -542,7 +542,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
// in the type of any local, which also excludes casts).
}
Rvalue::Cast(CastKind::PointerAddress, _, _) => {
Rvalue::Cast(CastKind::PointerExposeAddress, _, _) => {
self.check_op(ops::RawPtrToIntCast);
}

View file

@ -502,7 +502,7 @@ impl<'tcx> Validator<'_, 'tcx> {
Rvalue::ThreadLocalRef(_) => return Err(Unpromotable),
// ptr-to-int casts are not possible in consts and thus not promotable
Rvalue::Cast(CastKind::PointerAddress, _, _) => return Err(Unpromotable),
Rvalue::Cast(CastKind::PointerExposeAddress, _, _) => return Err(Unpromotable),
// int-to-ptr casts are fine, they just use the integer value at pointer type.
Rvalue::Cast(_, operand, _) => {