Auto merge of #113376 - Nilstrieb:pointer-coercions-are-not-casts-because-that-sounds-way-to-general-aaaa, r=oli-obk
Rename `adjustment::PointerCast` and variants using it to `PointerCoercion` It makes it sounds like the `ExprKind` and `Rvalue` are supposed to represent all pointer related casts, when in reality their just used to share a little enum variants. Make it clear there these are only coercions and that people who see this and think "why are so many pointer related casts not in these variants" aren't insane. This enum was added in #59987. I'm not sure whether the variant sharing is actually worth it, but this at least makes it less confusing. r? oli-obk
This commit is contained in:
commit
9bb6fbe261
85 changed files with 214 additions and 185 deletions
|
@ -9,7 +9,7 @@ use rustc_middle::mir::{
|
||||||
Body, CallSource, CastKind, ConstraintCategory, FakeReadCause, Local, LocalInfo, Location,
|
Body, CallSource, CastKind, ConstraintCategory, FakeReadCause, Local, LocalInfo, Location,
|
||||||
Operand, Place, Rvalue, Statement, StatementKind, TerminatorKind,
|
Operand, Place, Rvalue, Statement, StatementKind, TerminatorKind,
|
||||||
};
|
};
|
||||||
use rustc_middle::ty::adjustment::PointerCast;
|
use rustc_middle::ty::adjustment::PointerCoercion;
|
||||||
use rustc_middle::ty::{self, RegionVid, TyCtxt};
|
use rustc_middle::ty::{self, RegionVid, TyCtxt};
|
||||||
use rustc_span::symbol::{kw, Symbol};
|
use rustc_span::symbol::{kw, Symbol};
|
||||||
use rustc_span::{sym, DesugaringKind, Span};
|
use rustc_span::{sym, DesugaringKind, Span};
|
||||||
|
@ -584,7 +584,11 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
},
|
},
|
||||||
// If we see an unsized cast, then if it is our data we should check
|
// If we see an unsized cast, then if it is our data we should check
|
||||||
// whether it is being cast to a trait object.
|
// whether it is being cast to a trait object.
|
||||||
Rvalue::Cast(CastKind::Pointer(PointerCast::Unsize), operand, ty) => {
|
Rvalue::Cast(
|
||||||
|
CastKind::PointerCoercion(PointerCoercion::Unsize),
|
||||||
|
operand,
|
||||||
|
ty,
|
||||||
|
) => {
|
||||||
match operand {
|
match operand {
|
||||||
Operand::Copy(place) | Operand::Move(place) => {
|
Operand::Copy(place) | Operand::Move(place) => {
|
||||||
if let Some(from) = place.as_local() {
|
if let Some(from) = place.as_local() {
|
||||||
|
|
|
@ -28,7 +28,7 @@ use rustc_middle::mir::AssertKind;
|
||||||
use rustc_middle::mir::*;
|
use rustc_middle::mir::*;
|
||||||
use rustc_middle::traits::query::NoSolution;
|
use rustc_middle::traits::query::NoSolution;
|
||||||
use rustc_middle::traits::ObligationCause;
|
use rustc_middle::traits::ObligationCause;
|
||||||
use rustc_middle::ty::adjustment::PointerCast;
|
use rustc_middle::ty::adjustment::PointerCoercion;
|
||||||
use rustc_middle::ty::cast::CastTy;
|
use rustc_middle::ty::cast::CastTy;
|
||||||
use rustc_middle::ty::subst::{SubstsRef, UserSubsts};
|
use rustc_middle::ty::subst::{SubstsRef, UserSubsts};
|
||||||
use rustc_middle::ty::visit::TypeVisitableExt;
|
use rustc_middle::ty::visit::TypeVisitableExt;
|
||||||
|
@ -1908,7 +1908,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||||
self.check_operand(op, location);
|
self.check_operand(op, location);
|
||||||
|
|
||||||
match cast_kind {
|
match cast_kind {
|
||||||
CastKind::Pointer(PointerCast::ReifyFnPointer) => {
|
CastKind::PointerCoercion(PointerCoercion::ReifyFnPointer) => {
|
||||||
let fn_sig = op.ty(body, tcx).fn_sig(tcx);
|
let fn_sig = op.ty(body, tcx).fn_sig(tcx);
|
||||||
|
|
||||||
// The type that we see in the fcx is like
|
// The type that we see in the fcx is like
|
||||||
|
@ -1937,7 +1937,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CastKind::Pointer(PointerCast::ClosureFnPointer(unsafety)) => {
|
CastKind::PointerCoercion(PointerCoercion::ClosureFnPointer(unsafety)) => {
|
||||||
let sig = match op.ty(body, tcx).kind() {
|
let sig = match op.ty(body, tcx).kind() {
|
||||||
ty::Closure(_, substs) => substs.as_closure().sig(),
|
ty::Closure(_, substs) => substs.as_closure().sig(),
|
||||||
_ => bug!(),
|
_ => bug!(),
|
||||||
|
@ -1962,7 +1962,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CastKind::Pointer(PointerCast::UnsafeFnPointer) => {
|
CastKind::PointerCoercion(PointerCoercion::UnsafeFnPointer) => {
|
||||||
let fn_sig = op.ty(body, tcx).fn_sig(tcx);
|
let fn_sig = op.ty(body, tcx).fn_sig(tcx);
|
||||||
|
|
||||||
// The type that we see in the fcx is like
|
// The type that we see in the fcx is like
|
||||||
|
@ -1991,7 +1991,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CastKind::Pointer(PointerCast::Unsize) => {
|
CastKind::PointerCoercion(PointerCoercion::Unsize) => {
|
||||||
let &ty = ty;
|
let &ty = ty;
|
||||||
let trait_ref = ty::TraitRef::from_lang_item(
|
let trait_ref = ty::TraitRef::from_lang_item(
|
||||||
tcx,
|
tcx,
|
||||||
|
@ -2038,7 +2038,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
CastKind::Pointer(PointerCast::MutToConstPointer) => {
|
CastKind::PointerCoercion(PointerCoercion::MutToConstPointer) => {
|
||||||
let ty::RawPtr(ty::TypeAndMut {
|
let ty::RawPtr(ty::TypeAndMut {
|
||||||
ty: ty_from,
|
ty: ty_from,
|
||||||
mutbl: hir::Mutability::Mut,
|
mutbl: hir::Mutability::Mut,
|
||||||
|
@ -2080,7 +2080,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CastKind::Pointer(PointerCast::ArrayToPointer) => {
|
CastKind::PointerCoercion(PointerCoercion::ArrayToPointer) => {
|
||||||
let ty_from = op.ty(body, tcx);
|
let ty_from = op.ty(body, tcx);
|
||||||
|
|
||||||
let opt_ty_elem_mut = match ty_from.kind() {
|
let opt_ty_elem_mut = match ty_from.kind() {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
use rustc_ast::InlineAsmOptions;
|
use rustc_ast::InlineAsmOptions;
|
||||||
use rustc_index::IndexVec;
|
use rustc_index::IndexVec;
|
||||||
use rustc_middle::ty::adjustment::PointerCast;
|
use rustc_middle::ty::adjustment::PointerCoercion;
|
||||||
use rustc_middle::ty::layout::FnAbiOf;
|
use rustc_middle::ty::layout::FnAbiOf;
|
||||||
use rustc_middle::ty::print::with_no_trimmed_paths;
|
use rustc_middle::ty::print::with_no_trimmed_paths;
|
||||||
|
|
||||||
|
@ -571,7 +571,7 @@ fn codegen_stmt<'tcx>(
|
||||||
lval.write_cvalue(fx, res);
|
lval.write_cvalue(fx, res);
|
||||||
}
|
}
|
||||||
Rvalue::Cast(
|
Rvalue::Cast(
|
||||||
CastKind::Pointer(PointerCast::ReifyFnPointer),
|
CastKind::PointerCoercion(PointerCoercion::ReifyFnPointer),
|
||||||
ref operand,
|
ref operand,
|
||||||
to_ty,
|
to_ty,
|
||||||
) => {
|
) => {
|
||||||
|
@ -596,17 +596,17 @@ fn codegen_stmt<'tcx>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Rvalue::Cast(
|
Rvalue::Cast(
|
||||||
CastKind::Pointer(PointerCast::UnsafeFnPointer),
|
CastKind::PointerCoercion(PointerCoercion::UnsafeFnPointer),
|
||||||
ref operand,
|
ref operand,
|
||||||
to_ty,
|
to_ty,
|
||||||
)
|
)
|
||||||
| Rvalue::Cast(
|
| Rvalue::Cast(
|
||||||
CastKind::Pointer(PointerCast::MutToConstPointer),
|
CastKind::PointerCoercion(PointerCoercion::MutToConstPointer),
|
||||||
ref operand,
|
ref operand,
|
||||||
to_ty,
|
to_ty,
|
||||||
)
|
)
|
||||||
| Rvalue::Cast(
|
| Rvalue::Cast(
|
||||||
CastKind::Pointer(PointerCast::ArrayToPointer),
|
CastKind::PointerCoercion(PointerCoercion::ArrayToPointer),
|
||||||
ref operand,
|
ref operand,
|
||||||
to_ty,
|
to_ty,
|
||||||
) => {
|
) => {
|
||||||
|
@ -662,7 +662,7 @@ fn codegen_stmt<'tcx>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Rvalue::Cast(
|
Rvalue::Cast(
|
||||||
CastKind::Pointer(PointerCast::ClosureFnPointer(_)),
|
CastKind::PointerCoercion(PointerCoercion::ClosureFnPointer(_)),
|
||||||
ref operand,
|
ref operand,
|
||||||
_to_ty,
|
_to_ty,
|
||||||
) => {
|
) => {
|
||||||
|
@ -684,7 +684,11 @@ fn codegen_stmt<'tcx>(
|
||||||
_ => bug!("{} cannot be cast to a fn ptr", operand.layout().ty),
|
_ => bug!("{} cannot be cast to a fn ptr", operand.layout().ty),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Rvalue::Cast(CastKind::Pointer(PointerCast::Unsize), ref operand, _to_ty) => {
|
Rvalue::Cast(
|
||||||
|
CastKind::PointerCoercion(PointerCoercion::Unsize),
|
||||||
|
ref operand,
|
||||||
|
_to_ty,
|
||||||
|
) => {
|
||||||
let operand = codegen_operand(fx, operand);
|
let operand = codegen_operand(fx, operand);
|
||||||
crate::unsize::coerce_unsized_into(fx, operand, lval);
|
crate::unsize::coerce_unsized_into(fx, operand, lval);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//! Codegen of the [`PointerCast::Unsize`] operation.
|
//! Codegen of the [`PointerCoercion::Unsize`] operation.
|
||||||
//!
|
//!
|
||||||
//! [`PointerCast::Unsize`]: `rustc_middle::ty::adjustment::PointerCast::Unsize`
|
//! [`PointerCoercion::Unsize`]: `rustc_middle::ty::adjustment::PointerCoercion::Unsize`
|
||||||
|
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ use rustc_middle::mir;
|
||||||
use rustc_middle::mir::Operand;
|
use rustc_middle::mir::Operand;
|
||||||
use rustc_middle::ty::cast::{CastTy, IntTy};
|
use rustc_middle::ty::cast::{CastTy, IntTy};
|
||||||
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf, TyAndLayout};
|
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf, TyAndLayout};
|
||||||
use rustc_middle::ty::{self, adjustment::PointerCast, Instance, Ty, TyCtxt};
|
use rustc_middle::ty::{self, adjustment::PointerCoercion, Instance, Ty, TyCtxt};
|
||||||
use rustc_session::config::OptLevel;
|
use rustc_session::config::OptLevel;
|
||||||
use rustc_span::source_map::{Span, DUMMY_SP};
|
use rustc_span::source_map::{Span, DUMMY_SP};
|
||||||
use rustc_target::abi::{self, FIRST_VARIANT};
|
use rustc_target::abi::{self, FIRST_VARIANT};
|
||||||
|
@ -32,7 +32,11 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||||
cg_operand.val.store(bx, dest);
|
cg_operand.val.store(bx, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
mir::Rvalue::Cast(mir::CastKind::Pointer(PointerCast::Unsize), ref source, _) => {
|
mir::Rvalue::Cast(
|
||||||
|
mir::CastKind::PointerCoercion(PointerCoercion::Unsize),
|
||||||
|
ref source,
|
||||||
|
_,
|
||||||
|
) => {
|
||||||
// The destination necessarily contains a fat pointer, so if
|
// The destination necessarily contains a fat pointer, so if
|
||||||
// it's a scalar pair, it's a fat pointer or newtype thereof.
|
// it's a scalar pair, it's a fat pointer or newtype thereof.
|
||||||
if bx.cx().is_backend_scalar_pair(dest.layout) {
|
if bx.cx().is_backend_scalar_pair(dest.layout) {
|
||||||
|
@ -411,7 +415,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||||
let lladdr = bx.ptrtoint(llptr, llcast_ty);
|
let lladdr = bx.ptrtoint(llptr, llcast_ty);
|
||||||
OperandValue::Immediate(lladdr)
|
OperandValue::Immediate(lladdr)
|
||||||
}
|
}
|
||||||
mir::CastKind::Pointer(PointerCast::ReifyFnPointer) => {
|
mir::CastKind::PointerCoercion(PointerCoercion::ReifyFnPointer) => {
|
||||||
match *operand.layout.ty.kind() {
|
match *operand.layout.ty.kind() {
|
||||||
ty::FnDef(def_id, substs) => {
|
ty::FnDef(def_id, substs) => {
|
||||||
let instance = ty::Instance::resolve_for_fn_ptr(
|
let instance = ty::Instance::resolve_for_fn_ptr(
|
||||||
|
@ -427,7 +431,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||||
_ => bug!("{} cannot be reified to a fn ptr", operand.layout.ty),
|
_ => bug!("{} cannot be reified to a fn ptr", operand.layout.ty),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mir::CastKind::Pointer(PointerCast::ClosureFnPointer(_)) => {
|
mir::CastKind::PointerCoercion(PointerCoercion::ClosureFnPointer(_)) => {
|
||||||
match *operand.layout.ty.kind() {
|
match *operand.layout.ty.kind() {
|
||||||
ty::Closure(def_id, substs) => {
|
ty::Closure(def_id, substs) => {
|
||||||
let instance = Instance::resolve_closure(
|
let instance = Instance::resolve_closure(
|
||||||
|
@ -443,11 +447,11 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||||
_ => bug!("{} cannot be cast to a fn ptr", operand.layout.ty),
|
_ => bug!("{} cannot be cast to a fn ptr", operand.layout.ty),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mir::CastKind::Pointer(PointerCast::UnsafeFnPointer) => {
|
mir::CastKind::PointerCoercion(PointerCoercion::UnsafeFnPointer) => {
|
||||||
// This is a no-op at the LLVM level.
|
// This is a no-op at the LLVM level.
|
||||||
operand.val
|
operand.val
|
||||||
}
|
}
|
||||||
mir::CastKind::Pointer(PointerCast::Unsize) => {
|
mir::CastKind::PointerCoercion(PointerCoercion::Unsize) => {
|
||||||
assert!(bx.cx().is_backend_scalar_pair(cast));
|
assert!(bx.cx().is_backend_scalar_pair(cast));
|
||||||
let (lldata, llextra) = match operand.val {
|
let (lldata, llextra) = match operand.val {
|
||||||
OperandValue::Pair(lldata, llextra) => {
|
OperandValue::Pair(lldata, llextra) => {
|
||||||
|
@ -470,7 +474,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||||
base::unsize_ptr(bx, lldata, operand.layout.ty, cast.ty, llextra);
|
base::unsize_ptr(bx, lldata, operand.layout.ty, cast.ty, llextra);
|
||||||
OperandValue::Pair(lldata, llextra)
|
OperandValue::Pair(lldata, llextra)
|
||||||
}
|
}
|
||||||
mir::CastKind::Pointer(PointerCast::MutToConstPointer)
|
mir::CastKind::PointerCoercion(PointerCoercion::MutToConstPointer)
|
||||||
| mir::CastKind::PtrToPtr
|
| mir::CastKind::PtrToPtr
|
||||||
if bx.cx().is_backend_scalar_pair(operand.layout) =>
|
if bx.cx().is_backend_scalar_pair(operand.layout) =>
|
||||||
{
|
{
|
||||||
|
@ -504,8 +508,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||||
base::cast_to_dyn_star(bx, lldata, operand.layout, cast.ty, llextra);
|
base::cast_to_dyn_star(bx, lldata, operand.layout, cast.ty, llextra);
|
||||||
OperandValue::Pair(lldata, llextra)
|
OperandValue::Pair(lldata, llextra)
|
||||||
}
|
}
|
||||||
mir::CastKind::Pointer(
|
mir::CastKind::PointerCoercion(
|
||||||
PointerCast::MutToConstPointer | PointerCast::ArrayToPointer,
|
PointerCoercion::MutToConstPointer | PointerCoercion::ArrayToPointer,
|
||||||
)
|
)
|
||||||
| mir::CastKind::IntToInt
|
| mir::CastKind::IntToInt
|
||||||
| mir::CastKind::FloatToInt
|
| mir::CastKind::FloatToInt
|
||||||
|
|
|
@ -4,7 +4,7 @@ use rustc_apfloat::ieee::{Double, Single};
|
||||||
use rustc_apfloat::{Float, FloatConvert};
|
use rustc_apfloat::{Float, FloatConvert};
|
||||||
use rustc_middle::mir::interpret::{InterpResult, PointerArithmetic, Scalar};
|
use rustc_middle::mir::interpret::{InterpResult, PointerArithmetic, Scalar};
|
||||||
use rustc_middle::mir::CastKind;
|
use rustc_middle::mir::CastKind;
|
||||||
use rustc_middle::ty::adjustment::PointerCast;
|
use rustc_middle::ty::adjustment::PointerCoercion;
|
||||||
use rustc_middle::ty::layout::{IntegerExt, LayoutOf, TyAndLayout};
|
use rustc_middle::ty::layout::{IntegerExt, LayoutOf, TyAndLayout};
|
||||||
use rustc_middle::ty::{self, FloatTy, Ty, TypeAndMut};
|
use rustc_middle::ty::{self, FloatTy, Ty, TypeAndMut};
|
||||||
use rustc_target::abi::Integer;
|
use rustc_target::abi::Integer;
|
||||||
|
@ -24,51 +24,52 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||||
cast_ty: Ty<'tcx>,
|
cast_ty: Ty<'tcx>,
|
||||||
dest: &PlaceTy<'tcx, M::Provenance>,
|
dest: &PlaceTy<'tcx, M::Provenance>,
|
||||||
) -> InterpResult<'tcx> {
|
) -> InterpResult<'tcx> {
|
||||||
use rustc_middle::mir::CastKind::*;
|
|
||||||
// FIXME: In which cases should we trigger UB when the source is uninit?
|
// FIXME: In which cases should we trigger UB when the source is uninit?
|
||||||
match cast_kind {
|
match cast_kind {
|
||||||
Pointer(PointerCast::Unsize) => {
|
CastKind::PointerCoercion(PointerCoercion::Unsize) => {
|
||||||
let cast_ty = self.layout_of(cast_ty)?;
|
let cast_ty = self.layout_of(cast_ty)?;
|
||||||
self.unsize_into(src, cast_ty, dest)?;
|
self.unsize_into(src, cast_ty, dest)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
PointerExposeAddress => {
|
CastKind::PointerExposeAddress => {
|
||||||
let src = self.read_immediate(src)?;
|
let src = self.read_immediate(src)?;
|
||||||
let res = self.pointer_expose_address_cast(&src, cast_ty)?;
|
let res = self.pointer_expose_address_cast(&src, cast_ty)?;
|
||||||
self.write_immediate(res, dest)?;
|
self.write_immediate(res, dest)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
PointerFromExposedAddress => {
|
CastKind::PointerFromExposedAddress => {
|
||||||
let src = self.read_immediate(src)?;
|
let src = self.read_immediate(src)?;
|
||||||
let res = self.pointer_from_exposed_address_cast(&src, cast_ty)?;
|
let res = self.pointer_from_exposed_address_cast(&src, cast_ty)?;
|
||||||
self.write_immediate(res, dest)?;
|
self.write_immediate(res, dest)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntToInt | IntToFloat => {
|
CastKind::IntToInt | CastKind::IntToFloat => {
|
||||||
let src = self.read_immediate(src)?;
|
let src = self.read_immediate(src)?;
|
||||||
let res = self.int_to_int_or_float(&src, cast_ty)?;
|
let res = self.int_to_int_or_float(&src, cast_ty)?;
|
||||||
self.write_immediate(res, dest)?;
|
self.write_immediate(res, dest)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
FloatToFloat | FloatToInt => {
|
CastKind::FloatToFloat | CastKind::FloatToInt => {
|
||||||
let src = self.read_immediate(src)?;
|
let src = self.read_immediate(src)?;
|
||||||
let res = self.float_to_float_or_int(&src, cast_ty)?;
|
let res = self.float_to_float_or_int(&src, cast_ty)?;
|
||||||
self.write_immediate(res, dest)?;
|
self.write_immediate(res, dest)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
FnPtrToPtr | PtrToPtr => {
|
CastKind::FnPtrToPtr | CastKind::PtrToPtr => {
|
||||||
let src = self.read_immediate(&src)?;
|
let src = self.read_immediate(&src)?;
|
||||||
let res = self.ptr_to_ptr(&src, cast_ty)?;
|
let res = self.ptr_to_ptr(&src, cast_ty)?;
|
||||||
self.write_immediate(res, dest)?;
|
self.write_immediate(res, dest)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pointer(PointerCast::MutToConstPointer | PointerCast::ArrayToPointer) => {
|
CastKind::PointerCoercion(
|
||||||
|
PointerCoercion::MutToConstPointer | PointerCoercion::ArrayToPointer,
|
||||||
|
) => {
|
||||||
// These are NOPs, but can be wide pointers.
|
// These are NOPs, but can be wide pointers.
|
||||||
let v = self.read_immediate(src)?;
|
let v = self.read_immediate(src)?;
|
||||||
self.write_immediate(*v, dest)?;
|
self.write_immediate(*v, dest)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pointer(PointerCast::ReifyFnPointer) => {
|
CastKind::PointerCoercion(PointerCoercion::ReifyFnPointer) => {
|
||||||
// All reifications must be monomorphic, bail out otherwise.
|
// All reifications must be monomorphic, bail out otherwise.
|
||||||
ensure_monomorphic_enough(*self.tcx, src.layout.ty)?;
|
ensure_monomorphic_enough(*self.tcx, src.layout.ty)?;
|
||||||
|
|
||||||
|
@ -90,7 +91,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Pointer(PointerCast::UnsafeFnPointer) => {
|
CastKind::PointerCoercion(PointerCoercion::UnsafeFnPointer) => {
|
||||||
let src = self.read_immediate(src)?;
|
let src = self.read_immediate(src)?;
|
||||||
match cast_ty.kind() {
|
match cast_ty.kind() {
|
||||||
ty::FnPtr(_) => {
|
ty::FnPtr(_) => {
|
||||||
|
@ -101,7 +102,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Pointer(PointerCast::ClosureFnPointer(_)) => {
|
CastKind::PointerCoercion(PointerCoercion::ClosureFnPointer(_)) => {
|
||||||
// All reifications must be monomorphic, bail out otherwise.
|
// All reifications must be monomorphic, bail out otherwise.
|
||||||
ensure_monomorphic_enough(*self.tcx, src.layout.ty)?;
|
ensure_monomorphic_enough(*self.tcx, src.layout.ty)?;
|
||||||
|
|
||||||
|
@ -122,7 +123,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DynStar => {
|
CastKind::DynStar => {
|
||||||
if let ty::Dynamic(data, _, ty::DynStar) = cast_ty.kind() {
|
if let ty::Dynamic(data, _, ty::DynStar) = cast_ty.kind() {
|
||||||
// Initial cast from sized to dyn trait
|
// Initial cast from sized to dyn trait
|
||||||
let vtable = self.get_vtable_ptr(src.layout.ty, data.principal())?;
|
let vtable = self.get_vtable_ptr(src.layout.ty, data.principal())?;
|
||||||
|
@ -136,7 +137,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Transmute => {
|
CastKind::Transmute => {
|
||||||
assert!(src.layout.is_sized());
|
assert!(src.layout.is_sized());
|
||||||
assert!(dest.layout.is_sized());
|
assert!(dest.layout.is_sized());
|
||||||
if src.layout.size != dest.layout.size {
|
if src.layout.size != dest.layout.size {
|
||||||
|
|
|
@ -9,7 +9,7 @@ use rustc_infer::traits::{ImplSource, Obligation, ObligationCause};
|
||||||
use rustc_middle::mir::visit::{MutatingUseContext, NonMutatingUseContext, PlaceContext, Visitor};
|
use rustc_middle::mir::visit::{MutatingUseContext, NonMutatingUseContext, PlaceContext, Visitor};
|
||||||
use rustc_middle::mir::*;
|
use rustc_middle::mir::*;
|
||||||
use rustc_middle::ty::subst::{GenericArgKind, InternalSubsts};
|
use rustc_middle::ty::subst::{GenericArgKind, InternalSubsts};
|
||||||
use rustc_middle::ty::{self, adjustment::PointerCast, Instance, InstanceDef, Ty, TyCtxt};
|
use rustc_middle::ty::{self, adjustment::PointerCoercion, Instance, InstanceDef, Ty, TyCtxt};
|
||||||
use rustc_middle::ty::{TraitRef, TypeVisitableExt};
|
use rustc_middle::ty::{TraitRef, TypeVisitableExt};
|
||||||
use rustc_mir_dataflow::{self, Analysis};
|
use rustc_mir_dataflow::{self, Analysis};
|
||||||
use rustc_span::{sym, Span, Symbol};
|
use rustc_span::{sym, Span, Symbol};
|
||||||
|
@ -521,12 +521,12 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Rvalue::Cast(
|
Rvalue::Cast(
|
||||||
CastKind::Pointer(
|
CastKind::PointerCoercion(
|
||||||
PointerCast::MutToConstPointer
|
PointerCoercion::MutToConstPointer
|
||||||
| PointerCast::ArrayToPointer
|
| PointerCoercion::ArrayToPointer
|
||||||
| PointerCast::UnsafeFnPointer
|
| PointerCoercion::UnsafeFnPointer
|
||||||
| PointerCast::ClosureFnPointer(_)
|
| PointerCoercion::ClosureFnPointer(_)
|
||||||
| PointerCast::ReifyFnPointer,
|
| PointerCoercion::ReifyFnPointer,
|
||||||
),
|
),
|
||||||
_,
|
_,
|
||||||
_,
|
_,
|
||||||
|
@ -534,7 +534,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
|
||||||
// These are all okay; they only change the type, not the data.
|
// These are all okay; they only change the type, not the data.
|
||||||
}
|
}
|
||||||
|
|
||||||
Rvalue::Cast(CastKind::Pointer(PointerCast::Unsize), _, _) => {
|
Rvalue::Cast(CastKind::PointerCoercion(PointerCoercion::Unsize), _, _) => {
|
||||||
// Unsizing is implemented for CTFE.
|
// Unsizing is implemented for CTFE.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -650,7 +650,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
|
||||||
// FIXME: Add Checks for these
|
// FIXME: Add Checks for these
|
||||||
CastKind::PointerFromExposedAddress
|
CastKind::PointerFromExposedAddress
|
||||||
| CastKind::PointerExposeAddress
|
| CastKind::PointerExposeAddress
|
||||||
| CastKind::Pointer(_) => {}
|
| CastKind::PointerCoercion(_) => {}
|
||||||
CastKind::IntToInt | CastKind::IntToFloat => {
|
CastKind::IntToInt | CastKind::IntToFloat => {
|
||||||
let input_valid = op_ty.is_integral() || op_ty.is_char() || op_ty.is_bool();
|
let input_valid = op_ty.is_integral() || op_ty.is_char() || op_ty.is_bool();
|
||||||
let target_valid = target_type.is_numeric() || target_type.is_char();
|
let target_valid = target_type.is_numeric() || target_type.is_char();
|
||||||
|
|
|
@ -47,7 +47,7 @@ use rustc_infer::infer::{Coercion, DefineOpaqueTypes, InferOk, InferResult};
|
||||||
use rustc_infer::traits::{Obligation, PredicateObligation};
|
use rustc_infer::traits::{Obligation, PredicateObligation};
|
||||||
use rustc_middle::lint::in_external_macro;
|
use rustc_middle::lint::in_external_macro;
|
||||||
use rustc_middle::ty::adjustment::{
|
use rustc_middle::ty::adjustment::{
|
||||||
Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability, PointerCast,
|
Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability, PointerCoercion,
|
||||||
};
|
};
|
||||||
use rustc_middle::ty::error::TypeError;
|
use rustc_middle::ty::error::TypeError;
|
||||||
use rustc_middle::ty::relate::RelateResult;
|
use rustc_middle::ty::relate::RelateResult;
|
||||||
|
@ -592,7 +592,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
|
||||||
};
|
};
|
||||||
let coerce_target = self.next_ty_var(origin);
|
let coerce_target = self.next_ty_var(origin);
|
||||||
let mut coercion = self.unify_and(coerce_target, target, |target| {
|
let mut coercion = self.unify_and(coerce_target, target, |target| {
|
||||||
let unsize = Adjustment { kind: Adjust::Pointer(PointerCast::Unsize), target };
|
let unsize = Adjustment { kind: Adjust::Pointer(PointerCoercion::Unsize), target };
|
||||||
match reborrow {
|
match reborrow {
|
||||||
None => vec![unsize],
|
None => vec![unsize],
|
||||||
Some((ref deref, ref autoref)) => vec![deref.clone(), autoref.clone(), unsize],
|
Some((ref deref, ref autoref)) => vec![deref.clone(), autoref.clone(), unsize],
|
||||||
|
@ -849,7 +849,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
|
||||||
a,
|
a,
|
||||||
fn_ty_a,
|
fn_ty_a,
|
||||||
b,
|
b,
|
||||||
simple(Adjust::Pointer(PointerCast::UnsafeFnPointer)),
|
simple(Adjust::Pointer(PointerCoercion::UnsafeFnPointer)),
|
||||||
identity,
|
identity,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -893,16 +893,16 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
|
||||||
|unsafe_ty| {
|
|unsafe_ty| {
|
||||||
vec![
|
vec![
|
||||||
Adjustment {
|
Adjustment {
|
||||||
kind: Adjust::Pointer(PointerCast::ReifyFnPointer),
|
kind: Adjust::Pointer(PointerCoercion::ReifyFnPointer),
|
||||||
target: a_fn_pointer,
|
target: a_fn_pointer,
|
||||||
},
|
},
|
||||||
Adjustment {
|
Adjustment {
|
||||||
kind: Adjust::Pointer(PointerCast::UnsafeFnPointer),
|
kind: Adjust::Pointer(PointerCoercion::UnsafeFnPointer),
|
||||||
target: unsafe_ty,
|
target: unsafe_ty,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
simple(Adjust::Pointer(PointerCast::ReifyFnPointer)),
|
simple(Adjust::Pointer(PointerCoercion::ReifyFnPointer)),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
obligations.extend(o2);
|
obligations.extend(o2);
|
||||||
|
@ -952,7 +952,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
|
||||||
self.unify_and(
|
self.unify_and(
|
||||||
pointer_ty,
|
pointer_ty,
|
||||||
b,
|
b,
|
||||||
simple(Adjust::Pointer(PointerCast::ClosureFnPointer(unsafety))),
|
simple(Adjust::Pointer(PointerCoercion::ClosureFnPointer(unsafety))),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
_ => self.unify_and(a, b, identity),
|
_ => self.unify_and(a, b, identity),
|
||||||
|
@ -987,7 +987,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
} else if mt_a.mutbl != mutbl_b {
|
} else if mt_a.mutbl != mutbl_b {
|
||||||
self.unify_and(a_unsafe, b, simple(Adjust::Pointer(PointerCast::MutToConstPointer)))
|
self.unify_and(a_unsafe, b, simple(Adjust::Pointer(PointerCoercion::MutToConstPointer)))
|
||||||
} else {
|
} else {
|
||||||
self.unify_and(a_unsafe, b, identity)
|
self.unify_and(a_unsafe, b, identity)
|
||||||
}
|
}
|
||||||
|
@ -1187,13 +1187,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
// Reify both sides and return the reified fn pointer type.
|
// Reify both sides and return the reified fn pointer type.
|
||||||
let fn_ptr = Ty::new_fn_ptr(self.tcx, sig);
|
let fn_ptr = Ty::new_fn_ptr(self.tcx, sig);
|
||||||
let prev_adjustment = match prev_ty.kind() {
|
let prev_adjustment = match prev_ty.kind() {
|
||||||
ty::Closure(..) => Adjust::Pointer(PointerCast::ClosureFnPointer(a_sig.unsafety())),
|
ty::Closure(..) => {
|
||||||
ty::FnDef(..) => Adjust::Pointer(PointerCast::ReifyFnPointer),
|
Adjust::Pointer(PointerCoercion::ClosureFnPointer(a_sig.unsafety()))
|
||||||
|
}
|
||||||
|
ty::FnDef(..) => Adjust::Pointer(PointerCoercion::ReifyFnPointer),
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
let next_adjustment = match new_ty.kind() {
|
let next_adjustment = match new_ty.kind() {
|
||||||
ty::Closure(..) => Adjust::Pointer(PointerCast::ClosureFnPointer(b_sig.unsafety())),
|
ty::Closure(..) => {
|
||||||
ty::FnDef(..) => Adjust::Pointer(PointerCast::ReifyFnPointer),
|
Adjust::Pointer(PointerCoercion::ClosureFnPointer(b_sig.unsafety()))
|
||||||
|
}
|
||||||
|
ty::FnDef(..) => Adjust::Pointer(PointerCoercion::ReifyFnPointer),
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
for expr in exprs.iter().map(|e| e.as_coercion_site()) {
|
for expr in exprs.iter().map(|e| e.as_coercion_site()) {
|
||||||
|
|
|
@ -10,7 +10,7 @@ use rustc_hir_analysis::astconv::generics::{
|
||||||
use rustc_hir_analysis::astconv::{AstConv, CreateSubstsForGenericArgsCtxt, IsMethodCall};
|
use rustc_hir_analysis::astconv::{AstConv, CreateSubstsForGenericArgsCtxt, IsMethodCall};
|
||||||
use rustc_infer::infer::{self, DefineOpaqueTypes, InferOk};
|
use rustc_infer::infer::{self, DefineOpaqueTypes, InferOk};
|
||||||
use rustc_middle::traits::{ObligationCauseCode, UnifyReceiverContext};
|
use rustc_middle::traits::{ObligationCauseCode, UnifyReceiverContext};
|
||||||
use rustc_middle::ty::adjustment::{Adjust, Adjustment, PointerCast};
|
use rustc_middle::ty::adjustment::{Adjust, Adjustment, PointerCoercion};
|
||||||
use rustc_middle::ty::adjustment::{AllowTwoPhase, AutoBorrow, AutoBorrowMutability};
|
use rustc_middle::ty::adjustment::{AllowTwoPhase, AutoBorrow, AutoBorrowMutability};
|
||||||
use rustc_middle::ty::fold::TypeFoldable;
|
use rustc_middle::ty::fold::TypeFoldable;
|
||||||
use rustc_middle::ty::subst::{self, SubstsRef};
|
use rustc_middle::ty::subst::{self, SubstsRef};
|
||||||
|
@ -212,8 +212,10 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
|
||||||
region,
|
region,
|
||||||
ty::TypeAndMut { mutbl: mutbl.into(), ty: unsized_ty },
|
ty::TypeAndMut { mutbl: mutbl.into(), ty: unsized_ty },
|
||||||
);
|
);
|
||||||
adjustments
|
adjustments.push(Adjustment {
|
||||||
.push(Adjustment { kind: Adjust::Pointer(PointerCast::Unsize), target });
|
kind: Adjust::Pointer(PointerCoercion::Unsize),
|
||||||
|
target,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(probe::AutorefOrPtrAdjustment::ToConstPtr) => {
|
Some(probe::AutorefOrPtrAdjustment::ToConstPtr) => {
|
||||||
|
@ -226,7 +228,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
|
||||||
};
|
};
|
||||||
|
|
||||||
adjustments.push(Adjustment {
|
adjustments.push(Adjustment {
|
||||||
kind: Adjust::Pointer(PointerCast::MutToConstPointer),
|
kind: Adjust::Pointer(PointerCoercion::MutToConstPointer),
|
||||||
target,
|
target,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ use rustc_hir as hir;
|
||||||
use rustc_hir_analysis::autoderef::Autoderef;
|
use rustc_hir_analysis::autoderef::Autoderef;
|
||||||
use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
|
use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
|
||||||
use rustc_infer::infer::InferOk;
|
use rustc_infer::infer::InferOk;
|
||||||
use rustc_middle::ty::adjustment::{Adjust, Adjustment, OverloadedDeref, PointerCast};
|
use rustc_middle::ty::adjustment::{Adjust, Adjustment, OverloadedDeref, PointerCoercion};
|
||||||
use rustc_middle::ty::adjustment::{AllowTwoPhase, AutoBorrow, AutoBorrowMutability};
|
use rustc_middle::ty::adjustment::{AllowTwoPhase, AutoBorrow, AutoBorrowMutability};
|
||||||
use rustc_middle::ty::{self, Ty};
|
use rustc_middle::ty::{self, Ty};
|
||||||
use rustc_span::symbol::{sym, Ident};
|
use rustc_span::symbol::{sym, Ident};
|
||||||
|
@ -173,7 +173,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
if unsize {
|
if unsize {
|
||||||
adjustments.push(Adjustment {
|
adjustments.push(Adjustment {
|
||||||
kind: Adjust::Pointer(PointerCast::Unsize),
|
kind: Adjust::Pointer(PointerCoercion::Unsize),
|
||||||
target: method.sig.inputs()[0],
|
target: method.sig.inputs()[0],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -441,7 +441,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
if let [
|
if let [
|
||||||
..,
|
..,
|
||||||
Adjustment { kind: Adjust::Borrow(AutoBorrow::Ref(..)), .. },
|
Adjustment { kind: Adjust::Borrow(AutoBorrow::Ref(..)), .. },
|
||||||
Adjustment { kind: Adjust::Pointer(PointerCast::Unsize), ref mut target },
|
Adjustment { kind: Adjust::Pointer(PointerCoercion::Unsize), ref mut target },
|
||||||
] = adjustments[..]
|
] = adjustments[..]
|
||||||
{
|
{
|
||||||
*target = method.sig.inputs()[0];
|
*target = method.sig.inputs()[0];
|
||||||
|
|
|
@ -11,7 +11,7 @@ use rustc_hir::intravisit::{self, Visitor};
|
||||||
use rustc_infer::infer::error_reporting::TypeAnnotationNeeded::E0282;
|
use rustc_infer::infer::error_reporting::TypeAnnotationNeeded::E0282;
|
||||||
use rustc_middle::hir::place::Place as HirPlace;
|
use rustc_middle::hir::place::Place as HirPlace;
|
||||||
use rustc_middle::mir::FakeReadCause;
|
use rustc_middle::mir::FakeReadCause;
|
||||||
use rustc_middle::ty::adjustment::{Adjust, Adjustment, PointerCast};
|
use rustc_middle::ty::adjustment::{Adjust, Adjustment, PointerCoercion};
|
||||||
use rustc_middle::ty::fold::{TypeFoldable, TypeFolder, TypeSuperFoldable};
|
use rustc_middle::ty::fold::{TypeFoldable, TypeFolder, TypeSuperFoldable};
|
||||||
use rustc_middle::ty::visit::{TypeSuperVisitable, TypeVisitable, TypeVisitableExt};
|
use rustc_middle::ty::visit::{TypeSuperVisitable, TypeVisitable, TypeVisitableExt};
|
||||||
use rustc_middle::ty::{self, ClosureSizeProfileData, Ty, TyCtxt};
|
use rustc_middle::ty::{self, ClosureSizeProfileData, Ty, TyCtxt};
|
||||||
|
@ -251,7 +251,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
|
||||||
// Since this is "after" the other adjustment to be
|
// Since this is "after" the other adjustment to be
|
||||||
// discarded, we do an extra `pop()`
|
// discarded, we do an extra `pop()`
|
||||||
if let Some(Adjustment {
|
if let Some(Adjustment {
|
||||||
kind: Adjust::Pointer(PointerCast::Unsize), ..
|
kind: Adjust::Pointer(PointerCoercion::Unsize), ..
|
||||||
}) = a.pop()
|
}) = a.pop()
|
||||||
{
|
{
|
||||||
// So the borrow discard actually happens here
|
// So the borrow discard actually happens here
|
||||||
|
|
|
@ -2014,7 +2014,7 @@ impl<'tcx> Rvalue<'tcx> {
|
||||||
| CastKind::IntToFloat
|
| CastKind::IntToFloat
|
||||||
| CastKind::FnPtrToPtr
|
| CastKind::FnPtrToPtr
|
||||||
| CastKind::PtrToPtr
|
| CastKind::PtrToPtr
|
||||||
| CastKind::Pointer(_)
|
| CastKind::PointerCoercion(_)
|
||||||
| CastKind::PointerFromExposedAddress
|
| CastKind::PointerFromExposedAddress
|
||||||
| CastKind::DynStar
|
| CastKind::DynStar
|
||||||
| CastKind::Transmute,
|
| CastKind::Transmute,
|
||||||
|
|
|
@ -7,7 +7,7 @@ use super::{BasicBlock, Constant, Local, SwitchTargets, UserTypeProjection};
|
||||||
|
|
||||||
use crate::mir::coverage::{CodeRegion, CoverageKind};
|
use crate::mir::coverage::{CodeRegion, CoverageKind};
|
||||||
use crate::traits::Reveal;
|
use crate::traits::Reveal;
|
||||||
use crate::ty::adjustment::PointerCast;
|
use crate::ty::adjustment::PointerCoercion;
|
||||||
use crate::ty::subst::SubstsRef;
|
use crate::ty::subst::SubstsRef;
|
||||||
use crate::ty::{self, List, Ty};
|
use crate::ty::{self, List, Ty};
|
||||||
use crate::ty::{Region, UserTypeAnnotationIndex};
|
use crate::ty::{Region, UserTypeAnnotationIndex};
|
||||||
|
@ -1230,9 +1230,9 @@ pub enum CastKind {
|
||||||
/// An address-to-pointer cast that picks up an exposed provenance.
|
/// An address-to-pointer cast that picks up an exposed provenance.
|
||||||
/// See the docs on `from_exposed_addr` for more details.
|
/// See the docs on `from_exposed_addr` for more details.
|
||||||
PointerFromExposedAddress,
|
PointerFromExposedAddress,
|
||||||
/// All sorts of pointer-to-pointer casts. Note that reference-to-raw-ptr casts are
|
/// Pointer related casts that are done by coercions. Note that reference-to-raw-ptr casts are
|
||||||
/// translated into `&raw mut/const *r`, i.e., they are not actually casts.
|
/// translated into `&raw mut/const *r`, i.e., they are not actually casts.
|
||||||
Pointer(PointerCast),
|
PointerCoercion(PointerCoercion),
|
||||||
/// Cast into a dyn* object.
|
/// Cast into a dyn* object.
|
||||||
DynStar,
|
DynStar,
|
||||||
IntToInt,
|
IntToInt,
|
||||||
|
|
|
@ -18,7 +18,7 @@ use rustc_index::IndexVec;
|
||||||
use rustc_middle::middle::region;
|
use rustc_middle::middle::region;
|
||||||
use rustc_middle::mir::interpret::AllocId;
|
use rustc_middle::mir::interpret::AllocId;
|
||||||
use rustc_middle::mir::{self, BinOp, BorrowKind, FakeReadCause, Mutability, UnOp};
|
use rustc_middle::mir::{self, BinOp, BorrowKind, FakeReadCause, Mutability, UnOp};
|
||||||
use rustc_middle::ty::adjustment::PointerCast;
|
use rustc_middle::ty::adjustment::PointerCoercion;
|
||||||
use rustc_middle::ty::subst::SubstsRef;
|
use rustc_middle::ty::subst::SubstsRef;
|
||||||
use rustc_middle::ty::{self, AdtDef, FnSig, List, Ty, UpvarSubsts};
|
use rustc_middle::ty::{self, AdtDef, FnSig, List, Ty, UpvarSubsts};
|
||||||
use rustc_middle::ty::{CanonicalUserType, CanonicalUserTypeAnnotation};
|
use rustc_middle::ty::{CanonicalUserType, CanonicalUserTypeAnnotation};
|
||||||
|
@ -329,9 +329,10 @@ pub enum ExprKind<'tcx> {
|
||||||
NeverToAny {
|
NeverToAny {
|
||||||
source: ExprId,
|
source: ExprId,
|
||||||
},
|
},
|
||||||
/// A pointer cast. More information can be found in [`PointerCast`].
|
/// A pointer coercion. More information can be found in [`PointerCoercion`].
|
||||||
Pointer {
|
/// Pointer casts that cannot be done by coercions are represented by [`ExprKind::Cast`].
|
||||||
cast: PointerCast,
|
PointerCoercion {
|
||||||
|
cast: PointerCoercion,
|
||||||
source: ExprId,
|
source: ExprId,
|
||||||
},
|
},
|
||||||
/// A `loop` expression.
|
/// A `loop` expression.
|
||||||
|
|
|
@ -65,7 +65,7 @@ pub fn walk_expr<'a, 'tcx: 'a, V: Visitor<'a, 'tcx>>(visitor: &mut V, expr: &Exp
|
||||||
Cast { source } => visitor.visit_expr(&visitor.thir()[source]),
|
Cast { source } => visitor.visit_expr(&visitor.thir()[source]),
|
||||||
Use { source } => visitor.visit_expr(&visitor.thir()[source]),
|
Use { source } => visitor.visit_expr(&visitor.thir()[source]),
|
||||||
NeverToAny { source } => visitor.visit_expr(&visitor.thir()[source]),
|
NeverToAny { source } => visitor.visit_expr(&visitor.thir()[source]),
|
||||||
Pointer { source, cast: _ } => visitor.visit_expr(&visitor.thir()[source]),
|
PointerCoercion { source, cast: _ } => visitor.visit_expr(&visitor.thir()[source]),
|
||||||
Let { expr, .. } => {
|
Let { expr, .. } => {
|
||||||
visitor.visit_expr(&visitor.thir()[expr]);
|
visitor.visit_expr(&visitor.thir()[expr]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ use rustc_span::Span;
|
||||||
use rustc_target::abi::FieldIdx;
|
use rustc_target::abi::FieldIdx;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, TyEncodable, TyDecodable, Hash, HashStable)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, TyEncodable, TyDecodable, Hash, HashStable)]
|
||||||
pub enum PointerCast {
|
pub enum PointerCoercion {
|
||||||
/// Go from a fn-item type to a fn-pointer type.
|
/// Go from a fn-item type to a fn-pointer type.
|
||||||
ReifyFnPointer,
|
ReifyFnPointer,
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ pub enum Adjust<'tcx> {
|
||||||
/// Take the address and produce either a `&` or `*` pointer.
|
/// Take the address and produce either a `&` or `*` pointer.
|
||||||
Borrow(AutoBorrow<'tcx>),
|
Borrow(AutoBorrow<'tcx>),
|
||||||
|
|
||||||
Pointer(PointerCast),
|
Pointer(PointerCoercion),
|
||||||
|
|
||||||
/// Cast into a dyn* object.
|
/// Cast into a dyn* object.
|
||||||
DynStar,
|
DynStar,
|
||||||
|
|
|
@ -332,7 +332,7 @@ TrivialTypeTraversalAndLiftImpls! {
|
||||||
crate::ty::IntVarValue,
|
crate::ty::IntVarValue,
|
||||||
crate::ty::ParamConst,
|
crate::ty::ParamConst,
|
||||||
crate::ty::ParamTy,
|
crate::ty::ParamTy,
|
||||||
crate::ty::adjustment::PointerCast,
|
crate::ty::adjustment::PointerCoercion,
|
||||||
crate::ty::RegionVid,
|
crate::ty::RegionVid,
|
||||||
crate::ty::UniverseIndex,
|
crate::ty::UniverseIndex,
|
||||||
crate::ty::Variance,
|
crate::ty::Variance,
|
||||||
|
|
|
@ -535,7 +535,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||||
| ExprKind::Cast { .. }
|
| ExprKind::Cast { .. }
|
||||||
| ExprKind::Use { .. }
|
| ExprKind::Use { .. }
|
||||||
| ExprKind::NeverToAny { .. }
|
| ExprKind::NeverToAny { .. }
|
||||||
| ExprKind::Pointer { .. }
|
| ExprKind::PointerCoercion { .. }
|
||||||
| ExprKind::Repeat { .. }
|
| ExprKind::Repeat { .. }
|
||||||
| ExprKind::Borrow { .. }
|
| ExprKind::Borrow { .. }
|
||||||
| ExprKind::AddressOf { .. }
|
| ExprKind::AddressOf { .. }
|
||||||
|
|
|
@ -300,7 +300,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||||
let cast_kind = mir_cast_kind(ty, expr.ty);
|
let cast_kind = mir_cast_kind(ty, expr.ty);
|
||||||
block.and(Rvalue::Cast(cast_kind, source, expr.ty))
|
block.and(Rvalue::Cast(cast_kind, source, expr.ty))
|
||||||
}
|
}
|
||||||
ExprKind::Pointer { cast, source } => {
|
ExprKind::PointerCoercion { cast, source } => {
|
||||||
let source = unpack!(
|
let source = unpack!(
|
||||||
block = this.as_operand(
|
block = this.as_operand(
|
||||||
block,
|
block,
|
||||||
|
@ -310,7 +310,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||||
NeedsTemporary::No
|
NeedsTemporary::No
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
block.and(Rvalue::Cast(CastKind::Pointer(cast), source, expr.ty))
|
block.and(Rvalue::Cast(CastKind::PointerCoercion(cast), source, expr.ty))
|
||||||
}
|
}
|
||||||
ExprKind::Array { ref fields } => {
|
ExprKind::Array { ref fields } => {
|
||||||
// (*) We would (maybe) be closer to codegen if we
|
// (*) We would (maybe) be closer to codegen if we
|
||||||
|
|
|
@ -63,7 +63,7 @@ impl Category {
|
||||||
| ExprKind::Binary { .. }
|
| ExprKind::Binary { .. }
|
||||||
| ExprKind::Box { .. }
|
| ExprKind::Box { .. }
|
||||||
| ExprKind::Cast { .. }
|
| ExprKind::Cast { .. }
|
||||||
| ExprKind::Pointer { .. }
|
| ExprKind::PointerCoercion { .. }
|
||||||
| ExprKind::Repeat { .. }
|
| ExprKind::Repeat { .. }
|
||||||
| ExprKind::Assign { .. }
|
| ExprKind::Assign { .. }
|
||||||
| ExprKind::AssignOp { .. }
|
| ExprKind::AssignOp { .. }
|
||||||
|
|
|
@ -556,7 +556,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||||
| ExprKind::Binary { .. }
|
| ExprKind::Binary { .. }
|
||||||
| ExprKind::Box { .. }
|
| ExprKind::Box { .. }
|
||||||
| ExprKind::Cast { .. }
|
| ExprKind::Cast { .. }
|
||||||
| ExprKind::Pointer { .. }
|
| ExprKind::PointerCoercion { .. }
|
||||||
| ExprKind::Repeat { .. }
|
| ExprKind::Repeat { .. }
|
||||||
| ExprKind::Array { .. }
|
| ExprKind::Array { .. }
|
||||||
| ExprKind::Tuple { .. }
|
| ExprKind::Tuple { .. }
|
||||||
|
|
|
@ -16,7 +16,7 @@ use rustc_middle::mir::*;
|
||||||
use rustc_middle::thir::*;
|
use rustc_middle::thir::*;
|
||||||
use rustc_middle::ty::util::IntTypeExt;
|
use rustc_middle::ty::util::IntTypeExt;
|
||||||
use rustc_middle::ty::GenericArg;
|
use rustc_middle::ty::GenericArg;
|
||||||
use rustc_middle::ty::{self, adjustment::PointerCast, Ty, TyCtxt};
|
use rustc_middle::ty::{self, adjustment::PointerCoercion, Ty, TyCtxt};
|
||||||
use rustc_span::def_id::DefId;
|
use rustc_span::def_id::DefId;
|
||||||
use rustc_span::symbol::{sym, Symbol};
|
use rustc_span::symbol::{sym, Symbol};
|
||||||
use rustc_span::Span;
|
use rustc_span::Span;
|
||||||
|
@ -423,7 +423,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||||
source_info,
|
source_info,
|
||||||
temp,
|
temp,
|
||||||
Rvalue::Cast(
|
Rvalue::Cast(
|
||||||
CastKind::Pointer(PointerCast::Unsize),
|
CastKind::PointerCoercion(PointerCoercion::Unsize),
|
||||||
Operand::Copy(val),
|
Operand::Copy(val),
|
||||||
ty,
|
ty,
|
||||||
),
|
),
|
||||||
|
@ -436,7 +436,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||||
block,
|
block,
|
||||||
source_info,
|
source_info,
|
||||||
slice,
|
slice,
|
||||||
Rvalue::Cast(CastKind::Pointer(PointerCast::Unsize), expect, ty),
|
Rvalue::Cast(
|
||||||
|
CastKind::PointerCoercion(PointerCoercion::Unsize),
|
||||||
|
expect,
|
||||||
|
ty,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
expect = Operand::Move(slice);
|
expect = Operand::Move(slice);
|
||||||
}
|
}
|
||||||
|
|
|
@ -303,7 +303,7 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> {
|
||||||
| ExprKind::NeverToAny { .. }
|
| ExprKind::NeverToAny { .. }
|
||||||
| ExprKind::PlaceTypeAscription { .. }
|
| ExprKind::PlaceTypeAscription { .. }
|
||||||
| ExprKind::ValueTypeAscription { .. }
|
| ExprKind::ValueTypeAscription { .. }
|
||||||
| ExprKind::Pointer { .. }
|
| ExprKind::PointerCoercion { .. }
|
||||||
| ExprKind::Repeat { .. }
|
| ExprKind::Repeat { .. }
|
||||||
| ExprKind::StaticRef { .. }
|
| ExprKind::StaticRef { .. }
|
||||||
| ExprKind::ThreadLocalRef { .. }
|
| ExprKind::ThreadLocalRef { .. }
|
||||||
|
|
|
@ -13,7 +13,7 @@ use rustc_middle::middle::region;
|
||||||
use rustc_middle::mir::{self, BinOp, BorrowKind, UnOp};
|
use rustc_middle::mir::{self, BinOp, BorrowKind, UnOp};
|
||||||
use rustc_middle::thir::*;
|
use rustc_middle::thir::*;
|
||||||
use rustc_middle::ty::adjustment::{
|
use rustc_middle::ty::adjustment::{
|
||||||
Adjust, Adjustment, AutoBorrow, AutoBorrowMutability, PointerCast,
|
Adjust, Adjustment, AutoBorrow, AutoBorrowMutability, PointerCoercion,
|
||||||
};
|
};
|
||||||
use rustc_middle::ty::subst::InternalSubsts;
|
use rustc_middle::ty::subst::InternalSubsts;
|
||||||
use rustc_middle::ty::{
|
use rustc_middle::ty::{
|
||||||
|
@ -125,11 +125,16 @@ impl<'tcx> Cx<'tcx> {
|
||||||
};
|
};
|
||||||
|
|
||||||
let kind = match adjustment.kind {
|
let kind = match adjustment.kind {
|
||||||
Adjust::Pointer(PointerCast::Unsize) => {
|
Adjust::Pointer(PointerCoercion::Unsize) => {
|
||||||
adjust_span(&mut expr);
|
adjust_span(&mut expr);
|
||||||
ExprKind::Pointer { cast: PointerCast::Unsize, source: self.thir.exprs.push(expr) }
|
ExprKind::PointerCoercion {
|
||||||
|
cast: PointerCoercion::Unsize,
|
||||||
|
source: self.thir.exprs.push(expr),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Adjust::Pointer(cast) => {
|
||||||
|
ExprKind::PointerCoercion { cast, source: self.thir.exprs.push(expr) }
|
||||||
}
|
}
|
||||||
Adjust::Pointer(cast) => ExprKind::Pointer { cast, source: self.thir.exprs.push(expr) },
|
|
||||||
Adjust::NeverToAny if adjustment.target.is_never() => return expr,
|
Adjust::NeverToAny if adjustment.target.is_never() => return expr,
|
||||||
Adjust::NeverToAny => ExprKind::NeverToAny { source: self.thir.exprs.push(expr) },
|
Adjust::NeverToAny => ExprKind::NeverToAny { source: self.thir.exprs.push(expr) },
|
||||||
Adjust::Deref(None) => {
|
Adjust::Deref(None) => {
|
||||||
|
@ -192,9 +197,9 @@ impl<'tcx> Cx<'tcx> {
|
||||||
// Special cased so that we can type check that the element
|
// Special cased so that we can type check that the element
|
||||||
// type of the source matches the pointed to type of the
|
// type of the source matches the pointed to type of the
|
||||||
// destination.
|
// destination.
|
||||||
ExprKind::Pointer {
|
ExprKind::PointerCoercion {
|
||||||
source: self.mirror_expr(source),
|
source: self.mirror_expr(source),
|
||||||
cast: PointerCast::ArrayToPointer,
|
cast: PointerCoercion::ArrayToPointer,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// check whether this is casting an enum variant discriminant
|
// check whether this is casting an enum variant discriminant
|
||||||
|
|
|
@ -301,7 +301,7 @@ impl<'a, 'tcx> ThirPrinter<'a, 'tcx> {
|
||||||
self.print_expr(*source, depth_lvl + 2);
|
self.print_expr(*source, depth_lvl + 2);
|
||||||
print_indented!(self, "}", depth_lvl);
|
print_indented!(self, "}", depth_lvl);
|
||||||
}
|
}
|
||||||
Pointer { cast, source } => {
|
PointerCoercion { cast, source } => {
|
||||||
print_indented!(self, "Pointer {", depth_lvl);
|
print_indented!(self, "Pointer {", depth_lvl);
|
||||||
print_indented!(self, format!("cast: {:?}", cast), depth_lvl + 1);
|
print_indented!(self, format!("cast: {:?}", cast), depth_lvl + 1);
|
||||||
print_indented!(self, "source:", depth_lvl + 1);
|
print_indented!(self, "source:", depth_lvl + 1);
|
||||||
|
|
|
@ -41,7 +41,7 @@ fn compute_slice_length<'tcx>(
|
||||||
for (local, rvalue, _) in ssa.assignments(body) {
|
for (local, rvalue, _) in ssa.assignments(body) {
|
||||||
match rvalue {
|
match rvalue {
|
||||||
Rvalue::Cast(
|
Rvalue::Cast(
|
||||||
CastKind::Pointer(ty::adjustment::PointerCast::Unsize),
|
CastKind::PointerCoercion(ty::adjustment::PointerCoercion::Unsize),
|
||||||
operand,
|
operand,
|
||||||
cast_ty,
|
cast_ty,
|
||||||
) => {
|
) => {
|
||||||
|
|
|
@ -176,7 +176,7 @@ use rustc_middle::mir::mono::{InstantiationMode, MonoItem};
|
||||||
use rustc_middle::mir::visit::Visitor as MirVisitor;
|
use rustc_middle::mir::visit::Visitor as MirVisitor;
|
||||||
use rustc_middle::mir::{self, Local, Location};
|
use rustc_middle::mir::{self, Local, Location};
|
||||||
use rustc_middle::query::TyCtxtAt;
|
use rustc_middle::query::TyCtxtAt;
|
||||||
use rustc_middle::ty::adjustment::{CustomCoerceUnsized, PointerCast};
|
use rustc_middle::ty::adjustment::{CustomCoerceUnsized, PointerCoercion};
|
||||||
use rustc_middle::ty::print::with_no_trimmed_paths;
|
use rustc_middle::ty::print::with_no_trimmed_paths;
|
||||||
use rustc_middle::ty::subst::{GenericArgKind, InternalSubsts};
|
use rustc_middle::ty::subst::{GenericArgKind, InternalSubsts};
|
||||||
use rustc_middle::ty::{
|
use rustc_middle::ty::{
|
||||||
|
@ -617,7 +617,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirUsedCollector<'a, 'tcx> {
|
||||||
// have to instantiate all methods of the trait being cast to, so we
|
// have to instantiate all methods of the trait being cast to, so we
|
||||||
// can build the appropriate vtable.
|
// can build the appropriate vtable.
|
||||||
mir::Rvalue::Cast(
|
mir::Rvalue::Cast(
|
||||||
mir::CastKind::Pointer(PointerCast::Unsize),
|
mir::CastKind::PointerCoercion(PointerCoercion::Unsize),
|
||||||
ref operand,
|
ref operand,
|
||||||
target_ty,
|
target_ty,
|
||||||
)
|
)
|
||||||
|
@ -643,7 +643,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirUsedCollector<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mir::Rvalue::Cast(
|
mir::Rvalue::Cast(
|
||||||
mir::CastKind::Pointer(PointerCast::ReifyFnPointer),
|
mir::CastKind::PointerCoercion(PointerCoercion::ReifyFnPointer),
|
||||||
ref operand,
|
ref operand,
|
||||||
_,
|
_,
|
||||||
) => {
|
) => {
|
||||||
|
@ -652,7 +652,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirUsedCollector<'a, 'tcx> {
|
||||||
visit_fn_use(self.tcx, fn_ty, false, span, &mut self.output);
|
visit_fn_use(self.tcx, fn_ty, false, span, &mut self.output);
|
||||||
}
|
}
|
||||||
mir::Rvalue::Cast(
|
mir::Rvalue::Cast(
|
||||||
mir::CastKind::Pointer(PointerCast::ClosureFnPointer(_)),
|
mir::CastKind::PointerCoercion(PointerCoercion::ClosureFnPointer(_)),
|
||||||
ref operand,
|
ref operand,
|
||||||
_,
|
_,
|
||||||
) => {
|
) => {
|
||||||
|
|
|
@ -221,7 +221,7 @@ fn recurse_build<'tcx>(
|
||||||
maybe_supported_error(GenericConstantTooComplexSub::AdtNotSupported(node.span))?
|
maybe_supported_error(GenericConstantTooComplexSub::AdtNotSupported(node.span))?
|
||||||
}
|
}
|
||||||
// dont know if this is correct
|
// dont know if this is correct
|
||||||
ExprKind::Pointer { .. } => {
|
ExprKind::PointerCoercion { .. } => {
|
||||||
error(GenericConstantTooComplexSub::PointerNotSupported(node.span))?
|
error(GenericConstantTooComplexSub::PointerNotSupported(node.span))?
|
||||||
}
|
}
|
||||||
ExprKind::Yield { .. } => {
|
ExprKind::Yield { .. } => {
|
||||||
|
@ -324,7 +324,7 @@ impl<'a, 'tcx> IsThirPolymorphic<'a, 'tcx> {
|
||||||
| thir::ExprKind::Cast { .. }
|
| thir::ExprKind::Cast { .. }
|
||||||
| thir::ExprKind::Use { .. }
|
| thir::ExprKind::Use { .. }
|
||||||
| thir::ExprKind::NeverToAny { .. }
|
| thir::ExprKind::NeverToAny { .. }
|
||||||
| thir::ExprKind::Pointer { .. }
|
| thir::ExprKind::PointerCoercion { .. }
|
||||||
| thir::ExprKind::Loop { .. }
|
| thir::ExprKind::Loop { .. }
|
||||||
| thir::ExprKind::Let { .. }
|
| thir::ExprKind::Let { .. }
|
||||||
| thir::ExprKind::Match { .. }
|
| thir::ExprKind::Match { .. }
|
||||||
|
|
|
@ -9,7 +9,7 @@ use rustc_hir::{
|
||||||
Body, Expr, ExprKind, GenericArg, Impl, ImplItemKind, Item, ItemKind, Node, PathSegment, QPath, TyKind,
|
Body, Expr, ExprKind, GenericArg, Impl, ImplItemKind, Item, ItemKind, Node, PathSegment, QPath, TyKind,
|
||||||
};
|
};
|
||||||
use rustc_lint::{LateContext, LateLintPass};
|
use rustc_lint::{LateContext, LateLintPass};
|
||||||
use rustc_middle::ty::adjustment::{Adjust, PointerCast};
|
use rustc_middle::ty::adjustment::{Adjust, PointerCoercion};
|
||||||
use rustc_middle::ty::{self, Adt, AdtDef, SubstsRef, Ty, TypeckResults};
|
use rustc_middle::ty::{self, Adt, AdtDef, SubstsRef, Ty, TypeckResults};
|
||||||
use rustc_session::{declare_tool_lint, impl_lint_pass};
|
use rustc_session::{declare_tool_lint, impl_lint_pass};
|
||||||
use rustc_span::sym;
|
use rustc_span::sym;
|
||||||
|
@ -116,7 +116,7 @@ fn check_struct<'tcx>(
|
||||||
let is_default_without_adjusts = |expr| {
|
let is_default_without_adjusts = |expr| {
|
||||||
is_default_equivalent(cx, expr)
|
is_default_equivalent(cx, expr)
|
||||||
&& typeck_results.expr_adjustments(expr).iter().all(|adj| {
|
&& typeck_results.expr_adjustments(expr).iter().all(|adj| {
|
||||||
!matches!(adj.kind, Adjust::Pointer(PointerCast::Unsize)
|
!matches!(adj.kind, Adjust::Pointer(PointerCoercion::Unsize)
|
||||||
if contains_trait_object(adj.target))
|
if contains_trait_object(adj.target))
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,7 +14,7 @@ use rustc_hir as hir;
|
||||||
use rustc_hir::intravisit::FnKind;
|
use rustc_hir::intravisit::FnKind;
|
||||||
use rustc_hir::{BindingAnnotation, Body, FnDecl, Impl, ItemKind, MutTy, Mutability, Node, PatKind};
|
use rustc_hir::{BindingAnnotation, Body, FnDecl, Impl, ItemKind, MutTy, Mutability, Node, PatKind};
|
||||||
use rustc_lint::{LateContext, LateLintPass};
|
use rustc_lint::{LateContext, LateLintPass};
|
||||||
use rustc_middle::ty::adjustment::{Adjust, PointerCast};
|
use rustc_middle::ty::adjustment::{Adjust, PointerCoercion};
|
||||||
use rustc_middle::ty::layout::LayoutOf;
|
use rustc_middle::ty::layout::LayoutOf;
|
||||||
use rustc_middle::ty::{self, RegionKind};
|
use rustc_middle::ty::{self, RegionKind};
|
||||||
use rustc_session::{declare_tool_lint, impl_lint_pass};
|
use rustc_session::{declare_tool_lint, impl_lint_pass};
|
||||||
|
@ -195,7 +195,7 @@ impl<'tcx> PassByRefOrValue {
|
||||||
.adjustments()
|
.adjustments()
|
||||||
.items()
|
.items()
|
||||||
.flat_map(|(_, a)| a)
|
.flat_map(|(_, a)| a)
|
||||||
.any(|a| matches!(a.kind, Adjust::Pointer(PointerCast::UnsafeFnPointer)))
|
.any(|a| matches!(a.kind, Adjust::Pointer(PointerCoercion::UnsafeFnPointer)))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ use rustc_middle::mir::{
|
||||||
};
|
};
|
||||||
use rustc_middle::traits::{ImplSource, ObligationCause};
|
use rustc_middle::traits::{ImplSource, ObligationCause};
|
||||||
use rustc_middle::ty::subst::GenericArgKind;
|
use rustc_middle::ty::subst::GenericArgKind;
|
||||||
use rustc_middle::ty::{self, adjustment::PointerCast, Ty, TyCtxt};
|
use rustc_middle::ty::{self, adjustment::PointerCoercion, Ty, TyCtxt};
|
||||||
use rustc_middle::ty::{BoundConstness, TraitRef};
|
use rustc_middle::ty::{BoundConstness, TraitRef};
|
||||||
use rustc_semver::RustcVersion;
|
use rustc_semver::RustcVersion;
|
||||||
use rustc_span::symbol::sym;
|
use rustc_span::symbol::sym;
|
||||||
|
@ -119,18 +119,18 @@ fn check_rvalue<'tcx>(
|
||||||
| CastKind::FloatToFloat
|
| CastKind::FloatToFloat
|
||||||
| CastKind::FnPtrToPtr
|
| CastKind::FnPtrToPtr
|
||||||
| CastKind::PtrToPtr
|
| CastKind::PtrToPtr
|
||||||
| CastKind::Pointer(PointerCast::MutToConstPointer | PointerCast::ArrayToPointer),
|
| CastKind::PointerCoercion(PointerCoercion::MutToConstPointer | PointerCoercion::ArrayToPointer),
|
||||||
operand,
|
operand,
|
||||||
_,
|
_,
|
||||||
) => check_operand(tcx, operand, span, body),
|
) => check_operand(tcx, operand, span, body),
|
||||||
Rvalue::Cast(
|
Rvalue::Cast(
|
||||||
CastKind::Pointer(
|
CastKind::PointerCoercion(
|
||||||
PointerCast::UnsafeFnPointer | PointerCast::ClosureFnPointer(_) | PointerCast::ReifyFnPointer,
|
PointerCoercion::UnsafeFnPointer | PointerCoercion::ClosureFnPointer(_) | PointerCoercion::ReifyFnPointer,
|
||||||
),
|
),
|
||||||
_,
|
_,
|
||||||
_,
|
_,
|
||||||
) => Err((span, "function pointer casts are not allowed in const fn".into())),
|
) => Err((span, "function pointer casts are not allowed in const fn".into())),
|
||||||
Rvalue::Cast(CastKind::Pointer(PointerCast::Unsize), op, cast_ty) => {
|
Rvalue::Cast(CastKind::PointerCoercion(PointerCoercion::Unsize), op, cast_ty) => {
|
||||||
let pointee_ty = if let Some(deref_ty) = cast_ty.builtin_deref(true) {
|
let pointee_ty = if let Some(deref_ty) = cast_ty.builtin_deref(true) {
|
||||||
deref_ty.ty
|
deref_ty.ty
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -150,7 +150,7 @@ fn address_of_reborrow() -> () {
|
||||||
StorageLive(_9);
|
StorageLive(_9);
|
||||||
StorageLive(_10);
|
StorageLive(_10);
|
||||||
_10 = &raw const (*_1);
|
_10 = &raw const (*_1);
|
||||||
_9 = move _10 as *const dyn std::marker::Send (Pointer(Unsize));
|
_9 = move _10 as *const dyn std::marker::Send (PointerCoercion(Unsize));
|
||||||
StorageDead(_10);
|
StorageDead(_10);
|
||||||
AscribeUserType(_9, o, UserTypeProjection { base: UserType(1), projs: [] });
|
AscribeUserType(_9, o, UserTypeProjection { base: UserType(1), projs: [] });
|
||||||
_8 = _9;
|
_8 = _9;
|
||||||
|
@ -159,13 +159,13 @@ fn address_of_reborrow() -> () {
|
||||||
StorageLive(_11);
|
StorageLive(_11);
|
||||||
StorageLive(_12);
|
StorageLive(_12);
|
||||||
_12 = &raw const (*_1);
|
_12 = &raw const (*_1);
|
||||||
_11 = move _12 as *const [i32] (Pointer(Unsize));
|
_11 = move _12 as *const [i32] (PointerCoercion(Unsize));
|
||||||
StorageDead(_12);
|
StorageDead(_12);
|
||||||
StorageDead(_11);
|
StorageDead(_11);
|
||||||
StorageLive(_13);
|
StorageLive(_13);
|
||||||
StorageLive(_14);
|
StorageLive(_14);
|
||||||
_14 = &raw const (*_1);
|
_14 = &raw const (*_1);
|
||||||
_13 = move _14 as *const i32 (Pointer(ArrayToPointer));
|
_13 = move _14 as *const i32 (PointerCoercion(ArrayToPointer));
|
||||||
StorageDead(_14);
|
StorageDead(_14);
|
||||||
StorageDead(_13);
|
StorageDead(_13);
|
||||||
StorageLive(_15);
|
StorageLive(_15);
|
||||||
|
@ -179,14 +179,14 @@ fn address_of_reborrow() -> () {
|
||||||
StorageLive(_17);
|
StorageLive(_17);
|
||||||
StorageLive(_18);
|
StorageLive(_18);
|
||||||
_18 = &raw const (*_1);
|
_18 = &raw const (*_1);
|
||||||
_17 = move _18 as *const dyn std::marker::Send (Pointer(Unsize));
|
_17 = move _18 as *const dyn std::marker::Send (PointerCoercion(Unsize));
|
||||||
StorageDead(_18);
|
StorageDead(_18);
|
||||||
FakeRead(ForLet(None), _17);
|
FakeRead(ForLet(None), _17);
|
||||||
AscribeUserType(_17, o, UserTypeProjection { base: UserType(7), projs: [] });
|
AscribeUserType(_17, o, UserTypeProjection { base: UserType(7), projs: [] });
|
||||||
StorageLive(_19);
|
StorageLive(_19);
|
||||||
StorageLive(_20);
|
StorageLive(_20);
|
||||||
_20 = &raw const (*_1);
|
_20 = &raw const (*_1);
|
||||||
_19 = move _20 as *const [i32] (Pointer(Unsize));
|
_19 = move _20 as *const [i32] (PointerCoercion(Unsize));
|
||||||
StorageDead(_20);
|
StorageDead(_20);
|
||||||
FakeRead(ForLet(None), _19);
|
FakeRead(ForLet(None), _19);
|
||||||
AscribeUserType(_19, o, UserTypeProjection { base: UserType(9), projs: [] });
|
AscribeUserType(_19, o, UserTypeProjection { base: UserType(9), projs: [] });
|
||||||
|
@ -204,7 +204,7 @@ fn address_of_reborrow() -> () {
|
||||||
StorageLive(_25);
|
StorageLive(_25);
|
||||||
StorageLive(_26);
|
StorageLive(_26);
|
||||||
_26 = &raw const (*_3);
|
_26 = &raw const (*_3);
|
||||||
_25 = move _26 as *const dyn std::marker::Send (Pointer(Unsize));
|
_25 = move _26 as *const dyn std::marker::Send (PointerCoercion(Unsize));
|
||||||
StorageDead(_26);
|
StorageDead(_26);
|
||||||
AscribeUserType(_25, o, UserTypeProjection { base: UserType(11), projs: [] });
|
AscribeUserType(_25, o, UserTypeProjection { base: UserType(11), projs: [] });
|
||||||
_24 = _25;
|
_24 = _25;
|
||||||
|
@ -213,7 +213,7 @@ fn address_of_reborrow() -> () {
|
||||||
StorageLive(_27);
|
StorageLive(_27);
|
||||||
StorageLive(_28);
|
StorageLive(_28);
|
||||||
_28 = &raw const (*_3);
|
_28 = &raw const (*_3);
|
||||||
_27 = move _28 as *const [i32] (Pointer(Unsize));
|
_27 = move _28 as *const [i32] (PointerCoercion(Unsize));
|
||||||
StorageDead(_28);
|
StorageDead(_28);
|
||||||
StorageDead(_27);
|
StorageDead(_27);
|
||||||
StorageLive(_29);
|
StorageLive(_29);
|
||||||
|
@ -227,14 +227,14 @@ fn address_of_reborrow() -> () {
|
||||||
StorageLive(_31);
|
StorageLive(_31);
|
||||||
StorageLive(_32);
|
StorageLive(_32);
|
||||||
_32 = &raw const (*_3);
|
_32 = &raw const (*_3);
|
||||||
_31 = move _32 as *const dyn std::marker::Send (Pointer(Unsize));
|
_31 = move _32 as *const dyn std::marker::Send (PointerCoercion(Unsize));
|
||||||
StorageDead(_32);
|
StorageDead(_32);
|
||||||
FakeRead(ForLet(None), _31);
|
FakeRead(ForLet(None), _31);
|
||||||
AscribeUserType(_31, o, UserTypeProjection { base: UserType(17), projs: [] });
|
AscribeUserType(_31, o, UserTypeProjection { base: UserType(17), projs: [] });
|
||||||
StorageLive(_33);
|
StorageLive(_33);
|
||||||
StorageLive(_34);
|
StorageLive(_34);
|
||||||
_34 = &raw const (*_3);
|
_34 = &raw const (*_3);
|
||||||
_33 = move _34 as *const [i32] (Pointer(Unsize));
|
_33 = move _34 as *const [i32] (PointerCoercion(Unsize));
|
||||||
StorageDead(_34);
|
StorageDead(_34);
|
||||||
FakeRead(ForLet(None), _33);
|
FakeRead(ForLet(None), _33);
|
||||||
AscribeUserType(_33, o, UserTypeProjection { base: UserType(19), projs: [] });
|
AscribeUserType(_33, o, UserTypeProjection { base: UserType(19), projs: [] });
|
||||||
|
@ -252,7 +252,7 @@ fn address_of_reborrow() -> () {
|
||||||
StorageLive(_39);
|
StorageLive(_39);
|
||||||
StorageLive(_40);
|
StorageLive(_40);
|
||||||
_40 = &raw mut (*_3);
|
_40 = &raw mut (*_3);
|
||||||
_39 = move _40 as *mut dyn std::marker::Send (Pointer(Unsize));
|
_39 = move _40 as *mut dyn std::marker::Send (PointerCoercion(Unsize));
|
||||||
StorageDead(_40);
|
StorageDead(_40);
|
||||||
AscribeUserType(_39, o, UserTypeProjection { base: UserType(21), projs: [] });
|
AscribeUserType(_39, o, UserTypeProjection { base: UserType(21), projs: [] });
|
||||||
_38 = _39;
|
_38 = _39;
|
||||||
|
@ -261,7 +261,7 @@ fn address_of_reborrow() -> () {
|
||||||
StorageLive(_41);
|
StorageLive(_41);
|
||||||
StorageLive(_42);
|
StorageLive(_42);
|
||||||
_42 = &raw mut (*_3);
|
_42 = &raw mut (*_3);
|
||||||
_41 = move _42 as *mut [i32] (Pointer(Unsize));
|
_41 = move _42 as *mut [i32] (PointerCoercion(Unsize));
|
||||||
StorageDead(_42);
|
StorageDead(_42);
|
||||||
StorageDead(_41);
|
StorageDead(_41);
|
||||||
StorageLive(_43);
|
StorageLive(_43);
|
||||||
|
@ -275,14 +275,14 @@ fn address_of_reborrow() -> () {
|
||||||
StorageLive(_45);
|
StorageLive(_45);
|
||||||
StorageLive(_46);
|
StorageLive(_46);
|
||||||
_46 = &raw mut (*_3);
|
_46 = &raw mut (*_3);
|
||||||
_45 = move _46 as *mut dyn std::marker::Send (Pointer(Unsize));
|
_45 = move _46 as *mut dyn std::marker::Send (PointerCoercion(Unsize));
|
||||||
StorageDead(_46);
|
StorageDead(_46);
|
||||||
FakeRead(ForLet(None), _45);
|
FakeRead(ForLet(None), _45);
|
||||||
AscribeUserType(_45, o, UserTypeProjection { base: UserType(27), projs: [] });
|
AscribeUserType(_45, o, UserTypeProjection { base: UserType(27), projs: [] });
|
||||||
StorageLive(_47);
|
StorageLive(_47);
|
||||||
StorageLive(_48);
|
StorageLive(_48);
|
||||||
_48 = &raw mut (*_3);
|
_48 = &raw mut (*_3);
|
||||||
_47 = move _48 as *mut [i32] (Pointer(Unsize));
|
_47 = move _48 as *mut [i32] (PointerCoercion(Unsize));
|
||||||
StorageDead(_48);
|
StorageDead(_48);
|
||||||
FakeRead(ForLet(None), _47);
|
FakeRead(ForLet(None), _47);
|
||||||
AscribeUserType(_47, o, UserTypeProjection { base: UserType(29), projs: [] });
|
AscribeUserType(_47, o, UserTypeProjection { base: UserType(29), projs: [] });
|
||||||
|
|
|
@ -39,7 +39,7 @@ fn main() -> () {
|
||||||
StorageLive(_3);
|
StorageLive(_3);
|
||||||
StorageLive(_4);
|
StorageLive(_4);
|
||||||
_4 = _1;
|
_4 = _1;
|
||||||
_3 = move _4 as *const Test (Pointer(MutToConstPointer));
|
_3 = move _4 as *const Test (PointerCoercion(MutToConstPointer));
|
||||||
StorageDead(_4);
|
StorageDead(_4);
|
||||||
_2 = Test::x(move _3) -> [return: bb2, unwind: bb4];
|
_2 = Test::x(move _3) -> [return: bb2, unwind: bb4];
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ fn main() -> () {
|
||||||
StorageLive(_11);
|
StorageLive(_11);
|
||||||
StorageLive(_12);
|
StorageLive(_12);
|
||||||
_12 = (*(*(*(*_5))));
|
_12 = (*(*(*(*_5))));
|
||||||
_11 = move _12 as *const Test (Pointer(MutToConstPointer));
|
_11 = move _12 as *const Test (PointerCoercion(MutToConstPointer));
|
||||||
StorageDead(_12);
|
StorageDead(_12);
|
||||||
_10 = Test::x(move _11) -> [return: bb3, unwind: bb4];
|
_10 = Test::x(move _11) -> [return: bb3, unwind: bb4];
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,7 @@ static XXX: &Foo = {
|
||||||
StorageDead(_7);
|
StorageDead(_7);
|
||||||
_5 = &_6;
|
_5 = &_6;
|
||||||
_4 = &(*_5);
|
_4 = &(*_5);
|
||||||
_3 = move _4 as &[(u32, u32)] (Pointer(Unsize));
|
_3 = move _4 as &[(u32, u32)] (PointerCoercion(Unsize));
|
||||||
StorageDead(_4);
|
StorageDead(_4);
|
||||||
_2 = Foo { tup: const "hi", data: move _3 };
|
_2 = Foo { tup: const "hi", data: move _3 };
|
||||||
StorageDead(_3);
|
StorageDead(_3);
|
||||||
|
|
|
@ -8,7 +8,7 @@ fn roundtrip(_1: *const u8) -> *const u8 {
|
||||||
bb0: {
|
bb0: {
|
||||||
StorageLive(_2);
|
StorageLive(_2);
|
||||||
_2 = _1 as *mut u8 (PtrToPtr);
|
_2 = _1 as *mut u8 (PtrToPtr);
|
||||||
_0 = move _2 as *const u8 (Pointer(MutToConstPointer));
|
_0 = move _2 as *const u8 (PointerCoercion(MutToConstPointer));
|
||||||
StorageDead(_2);
|
StorageDead(_2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
- _2 = &_3;
|
- _2 = &_3;
|
||||||
+ _6 = const _;
|
+ _6 = const _;
|
||||||
+ _2 = &(*_6);
|
+ _2 = &(*_6);
|
||||||
_1 = move _2 as &[&i32] (Pointer(Unsize));
|
_1 = move _2 as &[&i32] (PointerCoercion(Unsize));
|
||||||
- StorageDead(_4);
|
- StorageDead(_4);
|
||||||
StorageDead(_2);
|
StorageDead(_2);
|
||||||
_0 = core::slice::<impl [&i32]>::as_ptr(move _1) -> [return: bb1, unwind: bb2];
|
_0 = core::slice::<impl [&i32]>::as_ptr(move _1) -> [return: bb1, unwind: bb2];
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
- _2 = &_3;
|
- _2 = &_3;
|
||||||
+ _6 = const _;
|
+ _6 = const _;
|
||||||
+ _2 = &(*_6);
|
+ _2 = &(*_6);
|
||||||
_1 = move _2 as &[&i32] (Pointer(Unsize));
|
_1 = move _2 as &[&i32] (PointerCoercion(Unsize));
|
||||||
- StorageDead(_4);
|
- StorageDead(_4);
|
||||||
StorageDead(_2);
|
StorageDead(_2);
|
||||||
_0 = core::slice::<impl [&i32]>::as_ptr(move _1) -> [return: bb1, unwind: bb2];
|
_0 = core::slice::<impl [&i32]>::as_ptr(move _1) -> [return: bb1, unwind: bb2];
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
_9 = const _;
|
_9 = const _;
|
||||||
_3 = &(*_9);
|
_3 = &(*_9);
|
||||||
_2 = &raw const (*_3);
|
_2 = &raw const (*_3);
|
||||||
_1 = move _2 as *const [i32] (Pointer(Unsize));
|
_1 = move _2 as *const [i32] (PointerCoercion(Unsize));
|
||||||
StorageDead(_2);
|
StorageDead(_2);
|
||||||
StorageDead(_3);
|
StorageDead(_3);
|
||||||
StorageLive(_5);
|
StorageLive(_5);
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
_9 = const _;
|
_9 = const _;
|
||||||
_3 = &(*_9);
|
_3 = &(*_9);
|
||||||
_2 = &raw const (*_3);
|
_2 = &raw const (*_3);
|
||||||
_1 = move _2 as *const [i32] (Pointer(Unsize));
|
_1 = move _2 as *const [i32] (PointerCoercion(Unsize));
|
||||||
StorageDead(_2);
|
StorageDead(_2);
|
||||||
StorageDead(_3);
|
StorageDead(_3);
|
||||||
StorageLive(_5);
|
StorageLive(_5);
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
_9 = const _;
|
_9 = const _;
|
||||||
_3 = &(*_9);
|
_3 = &(*_9);
|
||||||
_2 = &raw const (*_3);
|
_2 = &raw const (*_3);
|
||||||
_1 = move _2 as *const [i32] (Pointer(Unsize));
|
_1 = move _2 as *const [i32] (PointerCoercion(Unsize));
|
||||||
StorageDead(_2);
|
StorageDead(_2);
|
||||||
StorageDead(_3);
|
StorageDead(_3);
|
||||||
StorageLive(_5);
|
StorageLive(_5);
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
_9 = const _;
|
_9 = const _;
|
||||||
_3 = &(*_9);
|
_3 = &(*_9);
|
||||||
_2 = &raw const (*_3);
|
_2 = &raw const (*_3);
|
||||||
_1 = move _2 as *const [i32] (Pointer(Unsize));
|
_1 = move _2 as *const [i32] (PointerCoercion(Unsize));
|
||||||
StorageDead(_2);
|
StorageDead(_2);
|
||||||
StorageDead(_3);
|
StorageDead(_3);
|
||||||
StorageLive(_5);
|
StorageLive(_5);
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
StorageLive(_1);
|
StorageLive(_1);
|
||||||
StorageLive(_2);
|
StorageLive(_2);
|
||||||
StorageLive(_3);
|
StorageLive(_3);
|
||||||
_3 = main as fn() (Pointer(ReifyFnPointer));
|
_3 = main as fn() (PointerCoercion(ReifyFnPointer));
|
||||||
_2 = move _3 as usize (PointerExposeAddress);
|
_2 = move _3 as usize (PointerExposeAddress);
|
||||||
StorageDead(_3);
|
StorageDead(_3);
|
||||||
_1 = move _2 as *const fn() (PointerFromExposedAddress);
|
_1 = move _2 as *const fn() (PointerFromExposedAddress);
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
_9 = const _;
|
_9 = const _;
|
||||||
_4 = _9;
|
_4 = _9;
|
||||||
_3 = _4;
|
_3 = _4;
|
||||||
_2 = move _3 as &[u32] (Pointer(Unsize));
|
_2 = move _3 as &[u32] (PointerCoercion(Unsize));
|
||||||
StorageDead(_3);
|
StorageDead(_3);
|
||||||
StorageLive(_6);
|
StorageLive(_6);
|
||||||
_6 = const 1_usize;
|
_6 = const 1_usize;
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
_9 = const _;
|
_9 = const _;
|
||||||
_4 = _9;
|
_4 = _9;
|
||||||
_3 = _4;
|
_3 = _4;
|
||||||
_2 = move _3 as &[u32] (Pointer(Unsize));
|
_2 = move _3 as &[u32] (PointerCoercion(Unsize));
|
||||||
StorageDead(_3);
|
StorageDead(_3);
|
||||||
StorageLive(_6);
|
StorageLive(_6);
|
||||||
_6 = const 1_usize;
|
_6 = const 1_usize;
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
_9 = const _;
|
_9 = const _;
|
||||||
_4 = _9;
|
_4 = _9;
|
||||||
_3 = _4;
|
_3 = _4;
|
||||||
_2 = move _3 as &[u32] (Pointer(Unsize));
|
_2 = move _3 as &[u32] (PointerCoercion(Unsize));
|
||||||
StorageDead(_3);
|
StorageDead(_3);
|
||||||
StorageLive(_6);
|
StorageLive(_6);
|
||||||
_6 = const 1_usize;
|
_6 = const 1_usize;
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
_9 = const _;
|
_9 = const _;
|
||||||
_4 = _9;
|
_4 = _9;
|
||||||
_3 = _4;
|
_3 = _4;
|
||||||
_2 = move _3 as &[u32] (Pointer(Unsize));
|
_2 = move _3 as &[u32] (PointerCoercion(Unsize));
|
||||||
StorageDead(_3);
|
StorageDead(_3);
|
||||||
StorageLive(_6);
|
StorageLive(_6);
|
||||||
_6 = const 1_usize;
|
_6 = const 1_usize;
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
StorageLive(_6);
|
StorageLive(_6);
|
||||||
StorageLive(_7);
|
StorageLive(_7);
|
||||||
_7 = &_2;
|
_7 = &_2;
|
||||||
_6 = move _7 as &[i32] (Pointer(Unsize));
|
_6 = move _7 as &[i32] (PointerCoercion(Unsize));
|
||||||
StorageDead(_7);
|
StorageDead(_7);
|
||||||
_5 = core::slice::<impl [i32]>::len(move _6) -> [return: bb1, unwind unreachable];
|
_5 = core::slice::<impl [i32]>::len(move _6) -> [return: bb1, unwind unreachable];
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
StorageLive(_6);
|
StorageLive(_6);
|
||||||
StorageLive(_7);
|
StorageLive(_7);
|
||||||
_7 = &_2;
|
_7 = &_2;
|
||||||
_6 = move _7 as &[i32] (Pointer(Unsize));
|
_6 = move _7 as &[i32] (PointerCoercion(Unsize));
|
||||||
StorageDead(_7);
|
StorageDead(_7);
|
||||||
_5 = core::slice::<impl [i32]>::len(move _6) -> [return: bb1, unwind continue];
|
_5 = core::slice::<impl [i32]>::len(move _6) -> [return: bb1, unwind continue];
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
_4 = &(*_2);
|
_4 = &(*_2);
|
||||||
- _0 = try_execute_query::<<Q as Query>::C>(move _4) -> [return: bb2, unwind unreachable];
|
- _0 = try_execute_query::<<Q as Query>::C>(move _4) -> [return: bb2, unwind unreachable];
|
||||||
+ StorageLive(_5);
|
+ StorageLive(_5);
|
||||||
+ _5 = _4 as &dyn Cache<V = <Q as Query>::V> (Pointer(Unsize));
|
+ _5 = _4 as &dyn Cache<V = <Q as Query>::V> (PointerCoercion(Unsize));
|
||||||
+ _0 = <dyn Cache<V = <Q as Query>::V> as Cache>::store_nocache(_5) -> [return: bb2, unwind unreachable];
|
+ _0 = <dyn Cache<V = <Q as Query>::V> as Cache>::store_nocache(_5) -> [return: bb2, unwind unreachable];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
_4 = &(*_2);
|
_4 = &(*_2);
|
||||||
- _0 = try_execute_query::<<Q as Query>::C>(move _4) -> [return: bb2, unwind continue];
|
- _0 = try_execute_query::<<Q as Query>::C>(move _4) -> [return: bb2, unwind continue];
|
||||||
+ StorageLive(_5);
|
+ StorageLive(_5);
|
||||||
+ _5 = _4 as &dyn Cache<V = <Q as Query>::V> (Pointer(Unsize));
|
+ _5 = _4 as &dyn Cache<V = <Q as Query>::V> (PointerCoercion(Unsize));
|
||||||
+ _0 = <dyn Cache<V = <Q as Query>::V> as Cache>::store_nocache(_5) -> [return: bb2, unwind continue];
|
+ _0 = <dyn Cache<V = <Q as Query>::V> as Cache>::store_nocache(_5) -> [return: bb2, unwind continue];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
StorageLive(_2);
|
StorageLive(_2);
|
||||||
StorageLive(_3);
|
StorageLive(_3);
|
||||||
_3 = &(*_1);
|
_3 = &(*_1);
|
||||||
_2 = move _3 as &dyn Cache<V = <C as Cache>::V> (Pointer(Unsize));
|
_2 = move _3 as &dyn Cache<V = <C as Cache>::V> (PointerCoercion(Unsize));
|
||||||
StorageDead(_3);
|
StorageDead(_3);
|
||||||
- _0 = mk_cycle::<<C as Cache>::V>(move _2) -> [return: bb1, unwind unreachable];
|
- _0 = mk_cycle::<<C as Cache>::V>(move _2) -> [return: bb1, unwind unreachable];
|
||||||
+ _0 = <dyn Cache<V = <C as Cache>::V> as Cache>::store_nocache(_2) -> [return: bb1, unwind unreachable];
|
+ _0 = <dyn Cache<V = <C as Cache>::V> as Cache>::store_nocache(_2) -> [return: bb1, unwind unreachable];
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
StorageLive(_2);
|
StorageLive(_2);
|
||||||
StorageLive(_3);
|
StorageLive(_3);
|
||||||
_3 = &(*_1);
|
_3 = &(*_1);
|
||||||
_2 = move _3 as &dyn Cache<V = <C as Cache>::V> (Pointer(Unsize));
|
_2 = move _3 as &dyn Cache<V = <C as Cache>::V> (PointerCoercion(Unsize));
|
||||||
StorageDead(_3);
|
StorageDead(_3);
|
||||||
- _0 = mk_cycle::<<C as Cache>::V>(move _2) -> [return: bb1, unwind continue];
|
- _0 = mk_cycle::<<C as Cache>::V>(move _2) -> [return: bb1, unwind continue];
|
||||||
+ _0 = <dyn Cache<V = <C as Cache>::V> as Cache>::store_nocache(_2) -> [return: bb1, unwind continue];
|
+ _0 = <dyn Cache<V = <C as Cache>::V> as Cache>::store_nocache(_2) -> [return: bb1, unwind continue];
|
||||||
|
|
|
@ -164,7 +164,7 @@
|
||||||
+ StorageDead(_17);
|
+ StorageDead(_17);
|
||||||
+ StorageLive(_19);
|
+ StorageLive(_19);
|
||||||
+ StorageLive(_20);
|
+ StorageLive(_20);
|
||||||
+ _19 = _16 as *const u8 (Pointer(MutToConstPointer));
|
+ _19 = _16 as *const u8 (PointerCoercion(MutToConstPointer));
|
||||||
+ _15 = NonNull::<u8> { pointer: _19 };
|
+ _15 = NonNull::<u8> { pointer: _19 };
|
||||||
+ StorageDead(_20);
|
+ StorageDead(_20);
|
||||||
+ StorageDead(_19);
|
+ StorageDead(_19);
|
||||||
|
|
|
@ -181,7 +181,7 @@
|
||||||
+ StorageDead(_17);
|
+ StorageDead(_17);
|
||||||
+ StorageLive(_19);
|
+ StorageLive(_19);
|
||||||
+ StorageLive(_20);
|
+ StorageLive(_20);
|
||||||
+ _19 = _16 as *const u8 (Pointer(MutToConstPointer));
|
+ _19 = _16 as *const u8 (PointerCoercion(MutToConstPointer));
|
||||||
+ _15 = NonNull::<u8> { pointer: _19 };
|
+ _15 = NonNull::<u8> { pointer: _19 };
|
||||||
+ StorageDead(_20);
|
+ StorageDead(_20);
|
||||||
+ StorageDead(_19);
|
+ StorageDead(_19);
|
||||||
|
|
|
@ -13,7 +13,7 @@ fn test2(_1: &dyn X) -> bool {
|
||||||
StorageLive(_2);
|
StorageLive(_2);
|
||||||
StorageLive(_3);
|
StorageLive(_3);
|
||||||
_3 = &(*_1);
|
_3 = &(*_1);
|
||||||
_2 = move _3 as &dyn X (Pointer(Unsize));
|
_2 = move _3 as &dyn X (PointerCoercion(Unsize));
|
||||||
StorageDead(_3);
|
StorageDead(_3);
|
||||||
_0 = <dyn X as X>::y(_2) -> [return: bb1, unwind unreachable];
|
_0 = <dyn X as X>::y(_2) -> [return: bb1, unwind unreachable];
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ fn test2(_1: &dyn X) -> bool {
|
||||||
StorageLive(_2);
|
StorageLive(_2);
|
||||||
StorageLive(_3);
|
StorageLive(_3);
|
||||||
_3 = &(*_1);
|
_3 = &(*_1);
|
||||||
_2 = move _3 as &dyn X (Pointer(Unsize));
|
_2 = move _3 as &dyn X (PointerCoercion(Unsize));
|
||||||
StorageDead(_3);
|
StorageDead(_3);
|
||||||
_0 = <dyn X as X>::y(_2) -> [return: bb1, unwind continue];
|
_0 = <dyn X as X>::y(_2) -> [return: bb1, unwind continue];
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
StorageLive(_5);
|
StorageLive(_5);
|
||||||
_5 = [_1, _1, _1];
|
_5 = [_1, _1, _1];
|
||||||
_4 = &_5;
|
_4 = &_5;
|
||||||
_2 = _4 as &[T] (Pointer(Unsize));
|
_2 = _4 as &[T] (PointerCoercion(Unsize));
|
||||||
_9 = Len((*_2));
|
_9 = Len((*_2));
|
||||||
_10 = const 3_usize;
|
_10 = const 3_usize;
|
||||||
- _11 = Eq(move _9, const 3_usize);
|
- _11 = Eq(move _9, const 3_usize);
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
StorageLive(_5);
|
StorageLive(_5);
|
||||||
_5 = [_1, _1, _1];
|
_5 = [_1, _1, _1];
|
||||||
_4 = &_5;
|
_4 = &_5;
|
||||||
_2 = _4 as &[T] (Pointer(Unsize));
|
_2 = _4 as &[T] (PointerCoercion(Unsize));
|
||||||
_9 = Len((*_2));
|
_9 = Len((*_2));
|
||||||
_10 = const 3_usize;
|
_10 = const 3_usize;
|
||||||
- _11 = Eq(move _9, const 3_usize);
|
- _11 = Eq(move _9, const 3_usize);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
StorageLive(_6);
|
StorageLive(_6);
|
||||||
StorageLive(_7);
|
StorageLive(_7);
|
||||||
_7 = &(*_2);
|
_7 = &(*_2);
|
||||||
_6 = move _7 as &[u8] (Pointer(Unsize));
|
_6 = move _7 as &[u8] (PointerCoercion(Unsize));
|
||||||
StorageDead(_7);
|
StorageDead(_7);
|
||||||
- _5 = Len((*_6));
|
- _5 = Len((*_6));
|
||||||
+ _5 = const N;
|
+ _5 = const N;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
StorageLive(_6);
|
StorageLive(_6);
|
||||||
StorageLive(_7);
|
StorageLive(_7);
|
||||||
_7 = &(*_2);
|
_7 = &(*_2);
|
||||||
_6 = move _7 as &[u8] (Pointer(Unsize));
|
_6 = move _7 as &[u8] (PointerCoercion(Unsize));
|
||||||
StorageDead(_7);
|
StorageDead(_7);
|
||||||
- _5 = Len((*_6));
|
- _5 = Len((*_6));
|
||||||
+ _5 = const N;
|
+ _5 = const N;
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
StorageLive(_6);
|
StorageLive(_6);
|
||||||
StorageLive(_7);
|
StorageLive(_7);
|
||||||
_7 = &(*_2);
|
_7 = &(*_2);
|
||||||
_6 = move _7 as &[u8] (Pointer(Unsize));
|
_6 = move _7 as &[u8] (PointerCoercion(Unsize));
|
||||||
StorageDead(_7);
|
StorageDead(_7);
|
||||||
- _5 = Len((*_6));
|
- _5 = Len((*_6));
|
||||||
+ _5 = const N;
|
+ _5 = const N;
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
StorageLive(_6);
|
StorageLive(_6);
|
||||||
StorageLive(_7);
|
StorageLive(_7);
|
||||||
_7 = &(*_2);
|
_7 = &(*_2);
|
||||||
_6 = move _7 as &[u8] (Pointer(Unsize));
|
_6 = move _7 as &[u8] (PointerCoercion(Unsize));
|
||||||
StorageDead(_7);
|
StorageDead(_7);
|
||||||
- _5 = Len((*_6));
|
- _5 = Len((*_6));
|
||||||
+ _5 = const N;
|
+ _5 = const N;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
StorageLive(_2);
|
StorageLive(_2);
|
||||||
StorageLive(_3);
|
StorageLive(_3);
|
||||||
_3 = &(*_1);
|
_3 = &(*_1);
|
||||||
_2 = move _3 as &[u8] (Pointer(Unsize));
|
_2 = move _3 as &[u8] (PointerCoercion(Unsize));
|
||||||
StorageDead(_3);
|
StorageDead(_3);
|
||||||
- _0 = Len((*_2));
|
- _0 = Len((*_2));
|
||||||
+ _0 = const N;
|
+ _0 = const N;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
StorageLive(_2);
|
StorageLive(_2);
|
||||||
StorageLive(_3);
|
StorageLive(_3);
|
||||||
_3 = &(*_1);
|
_3 = &(*_1);
|
||||||
_2 = move _3 as &[u8] (Pointer(Unsize));
|
_2 = move _3 as &[u8] (PointerCoercion(Unsize));
|
||||||
StorageDead(_3);
|
StorageDead(_3);
|
||||||
- _0 = Len((*_2));
|
- _0 = Len((*_2));
|
||||||
+ _0 = const N;
|
+ _0 = const N;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
StorageLive(_2);
|
StorageLive(_2);
|
||||||
StorageLive(_3);
|
StorageLive(_3);
|
||||||
_3 = &_1;
|
_3 = &_1;
|
||||||
_2 = move _3 as &[u8] (Pointer(Unsize));
|
_2 = move _3 as &[u8] (PointerCoercion(Unsize));
|
||||||
StorageDead(_3);
|
StorageDead(_3);
|
||||||
- _0 = Len((*_2));
|
- _0 = Len((*_2));
|
||||||
+ _0 = const N;
|
+ _0 = const N;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
StorageLive(_2);
|
StorageLive(_2);
|
||||||
StorageLive(_3);
|
StorageLive(_3);
|
||||||
_3 = &_1;
|
_3 = &_1;
|
||||||
_2 = move _3 as &[u8] (Pointer(Unsize));
|
_2 = move _3 as &[u8] (PointerCoercion(Unsize));
|
||||||
StorageDead(_3);
|
StorageDead(_3);
|
||||||
- _0 = Len((*_2));
|
- _0 = Len((*_2));
|
||||||
+ _0 = const N;
|
+ _0 = const N;
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
StorageLive(_4);
|
StorageLive(_4);
|
||||||
_4 = &_1;
|
_4 = &_1;
|
||||||
_3 = &(*_4);
|
_3 = &(*_4);
|
||||||
_2 = move _3 as &[u8] (Pointer(Unsize));
|
_2 = move _3 as &[u8] (PointerCoercion(Unsize));
|
||||||
StorageDead(_3);
|
StorageDead(_3);
|
||||||
StorageDead(_4);
|
StorageDead(_4);
|
||||||
StorageLive(_5);
|
StorageLive(_5);
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
StorageLive(_4);
|
StorageLive(_4);
|
||||||
_4 = &_1;
|
_4 = &_1;
|
||||||
_3 = &(*_4);
|
_3 = &(*_4);
|
||||||
_2 = move _3 as &[u8] (Pointer(Unsize));
|
_2 = move _3 as &[u8] (PointerCoercion(Unsize));
|
||||||
StorageDead(_3);
|
StorageDead(_3);
|
||||||
StorageDead(_4);
|
StorageDead(_4);
|
||||||
StorageLive(_5);
|
StorageLive(_5);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
StorageLive(_4);
|
StorageLive(_4);
|
||||||
_4 = &mut _1;
|
_4 = &mut _1;
|
||||||
_3 = &mut (*_4);
|
_3 = &mut (*_4);
|
||||||
_2 = move _3 as &mut [u8] (Pointer(Unsize));
|
_2 = move _3 as &mut [u8] (PointerCoercion(Unsize));
|
||||||
StorageDead(_3);
|
StorageDead(_3);
|
||||||
StorageDead(_4);
|
StorageDead(_4);
|
||||||
StorageLive(_5);
|
StorageLive(_5);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
StorageLive(_4);
|
StorageLive(_4);
|
||||||
_4 = &mut _1;
|
_4 = &mut _1;
|
||||||
_3 = &mut (*_4);
|
_3 = &mut (*_4);
|
||||||
_2 = move _3 as &mut [u8] (Pointer(Unsize));
|
_2 = move _3 as &mut [u8] (PointerCoercion(Unsize));
|
||||||
StorageDead(_3);
|
StorageDead(_3);
|
||||||
StorageDead(_4);
|
StorageDead(_4);
|
||||||
StorageLive(_5);
|
StorageLive(_5);
|
||||||
|
|
|
@ -78,7 +78,7 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
|
||||||
StorageLive(_12);
|
StorageLive(_12);
|
||||||
StorageLive(_11);
|
StorageLive(_11);
|
||||||
StorageLive(_10);
|
StorageLive(_10);
|
||||||
_10 = _9 as *const () (Pointer(MutToConstPointer));
|
_10 = _9 as *const () (PointerCoercion(MutToConstPointer));
|
||||||
_11 = ptr::metadata::PtrComponents::<[u32]> { data_address: move _10, metadata: _6 };
|
_11 = ptr::metadata::PtrComponents::<[u32]> { data_address: move _10, metadata: _6 };
|
||||||
StorageDead(_10);
|
StorageDead(_10);
|
||||||
_12 = ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _11 };
|
_12 = ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _11 };
|
||||||
|
|
|
@ -78,7 +78,7 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
|
||||||
StorageLive(_12);
|
StorageLive(_12);
|
||||||
StorageLive(_11);
|
StorageLive(_11);
|
||||||
StorageLive(_10);
|
StorageLive(_10);
|
||||||
_10 = _9 as *const () (Pointer(MutToConstPointer));
|
_10 = _9 as *const () (PointerCoercion(MutToConstPointer));
|
||||||
_11 = ptr::metadata::PtrComponents::<[u32]> { data_address: move _10, metadata: _6 };
|
_11 = ptr::metadata::PtrComponents::<[u32]> { data_address: move _10, metadata: _6 };
|
||||||
StorageDead(_10);
|
StorageDead(_10);
|
||||||
_12 = ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _11 };
|
_12 = ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _11 };
|
||||||
|
|
|
@ -131,7 +131,7 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
|
||||||
_9 = _4 as *mut T (PtrToPtr);
|
_9 = _4 as *mut T (PtrToPtr);
|
||||||
StorageLive(_10);
|
StorageLive(_10);
|
||||||
StorageLive(_24);
|
StorageLive(_24);
|
||||||
_10 = _9 as *const T (Pointer(MutToConstPointer));
|
_10 = _9 as *const T (PointerCoercion(MutToConstPointer));
|
||||||
_11 = NonNull::<T> { pointer: _10 };
|
_11 = NonNull::<T> { pointer: _10 };
|
||||||
StorageDead(_24);
|
StorageDead(_24);
|
||||||
StorageDead(_10);
|
StorageDead(_10);
|
||||||
|
|
|
@ -131,7 +131,7 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
|
||||||
_9 = _4 as *mut T (PtrToPtr);
|
_9 = _4 as *mut T (PtrToPtr);
|
||||||
StorageLive(_10);
|
StorageLive(_10);
|
||||||
StorageLive(_24);
|
StorageLive(_24);
|
||||||
_10 = _9 as *const T (Pointer(MutToConstPointer));
|
_10 = _9 as *const T (PointerCoercion(MutToConstPointer));
|
||||||
_11 = NonNull::<T> { pointer: _10 };
|
_11 = NonNull::<T> { pointer: _10 };
|
||||||
StorageDead(_24);
|
StorageDead(_24);
|
||||||
StorageDead(_10);
|
StorageDead(_10);
|
||||||
|
|
|
@ -121,7 +121,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
|
||||||
_9 = _4 as *mut T (PtrToPtr);
|
_9 = _4 as *mut T (PtrToPtr);
|
||||||
StorageLive(_10);
|
StorageLive(_10);
|
||||||
StorageLive(_22);
|
StorageLive(_22);
|
||||||
_10 = _9 as *const T (Pointer(MutToConstPointer));
|
_10 = _9 as *const T (PointerCoercion(MutToConstPointer));
|
||||||
_11 = NonNull::<T> { pointer: _10 };
|
_11 = NonNull::<T> { pointer: _10 };
|
||||||
StorageDead(_22);
|
StorageDead(_22);
|
||||||
StorageDead(_10);
|
StorageDead(_10);
|
||||||
|
|
|
@ -121,7 +121,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () {
|
||||||
_9 = _4 as *mut T (PtrToPtr);
|
_9 = _4 as *mut T (PtrToPtr);
|
||||||
StorageLive(_10);
|
StorageLive(_10);
|
||||||
StorageLive(_22);
|
StorageLive(_22);
|
||||||
_10 = _9 as *const T (Pointer(MutToConstPointer));
|
_10 = _9 as *const T (PointerCoercion(MutToConstPointer));
|
||||||
_11 = NonNull::<T> { pointer: _10 };
|
_11 = NonNull::<T> { pointer: _10 };
|
||||||
StorageDead(_22);
|
StorageDead(_22);
|
||||||
StorageDead(_10);
|
StorageDead(_10);
|
||||||
|
|
|
@ -133,7 +133,7 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
|
||||||
_9 = _4 as *mut T (PtrToPtr);
|
_9 = _4 as *mut T (PtrToPtr);
|
||||||
StorageLive(_10);
|
StorageLive(_10);
|
||||||
StorageLive(_24);
|
StorageLive(_24);
|
||||||
_10 = _9 as *const T (Pointer(MutToConstPointer));
|
_10 = _9 as *const T (PointerCoercion(MutToConstPointer));
|
||||||
_11 = NonNull::<T> { pointer: _10 };
|
_11 = NonNull::<T> { pointer: _10 };
|
||||||
StorageDead(_24);
|
StorageDead(_24);
|
||||||
StorageDead(_10);
|
StorageDead(_10);
|
||||||
|
|
|
@ -133,7 +133,7 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
|
||||||
_9 = _4 as *mut T (PtrToPtr);
|
_9 = _4 as *mut T (PtrToPtr);
|
||||||
StorageLive(_10);
|
StorageLive(_10);
|
||||||
StorageLive(_24);
|
StorageLive(_24);
|
||||||
_10 = _9 as *const T (Pointer(MutToConstPointer));
|
_10 = _9 as *const T (PointerCoercion(MutToConstPointer));
|
||||||
_11 = NonNull::<T> { pointer: _10 };
|
_11 = NonNull::<T> { pointer: _10 };
|
||||||
StorageDead(_24);
|
StorageDead(_24);
|
||||||
StorageDead(_10);
|
StorageDead(_10);
|
||||||
|
|
|
@ -69,7 +69,7 @@ fn array_casts() -> () {
|
||||||
StorageLive(_4);
|
StorageLive(_4);
|
||||||
_4 = &mut _1;
|
_4 = &mut _1;
|
||||||
_3 = &raw mut (*_4);
|
_3 = &raw mut (*_4);
|
||||||
_2 = move _3 as *mut usize (Pointer(ArrayToPointer));
|
_2 = move _3 as *mut usize (PointerCoercion(ArrayToPointer));
|
||||||
StorageDead(_3);
|
StorageDead(_3);
|
||||||
StorageDead(_4);
|
StorageDead(_4);
|
||||||
StorageLive(_5);
|
StorageLive(_5);
|
||||||
|
@ -92,7 +92,7 @@ fn array_casts() -> () {
|
||||||
StorageLive(_11);
|
StorageLive(_11);
|
||||||
_11 = &_8;
|
_11 = &_8;
|
||||||
_10 = &raw const (*_11);
|
_10 = &raw const (*_11);
|
||||||
_9 = move _10 as *const usize (Pointer(ArrayToPointer));
|
_9 = move _10 as *const usize (PointerCoercion(ArrayToPointer));
|
||||||
StorageDead(_10);
|
StorageDead(_10);
|
||||||
StorageDead(_11);
|
StorageDead(_11);
|
||||||
StorageLive(_12);
|
StorageLive(_12);
|
||||||
|
|
|
@ -69,7 +69,7 @@ fn array_casts() -> () {
|
||||||
StorageLive(_4);
|
StorageLive(_4);
|
||||||
_4 = &mut _1;
|
_4 = &mut _1;
|
||||||
_3 = &raw mut (*_4);
|
_3 = &raw mut (*_4);
|
||||||
_2 = move _3 as *mut usize (Pointer(ArrayToPointer));
|
_2 = move _3 as *mut usize (PointerCoercion(ArrayToPointer));
|
||||||
StorageDead(_3);
|
StorageDead(_3);
|
||||||
StorageDead(_4);
|
StorageDead(_4);
|
||||||
StorageLive(_5);
|
StorageLive(_5);
|
||||||
|
@ -92,7 +92,7 @@ fn array_casts() -> () {
|
||||||
StorageLive(_11);
|
StorageLive(_11);
|
||||||
_11 = &_8;
|
_11 = &_8;
|
||||||
_10 = &raw const (*_11);
|
_10 = &raw const (*_11);
|
||||||
_9 = move _10 as *const usize (Pointer(ArrayToPointer));
|
_9 = move _10 as *const usize (PointerCoercion(ArrayToPointer));
|
||||||
StorageDead(_10);
|
StorageDead(_10);
|
||||||
StorageDead(_11);
|
StorageDead(_11);
|
||||||
StorageLive(_12);
|
StorageLive(_12);
|
||||||
|
|
|
@ -105,7 +105,7 @@ fn main() -> () {
|
||||||
StorageLive(_14);
|
StorageLive(_14);
|
||||||
_14 = [closure@main::{closure#0}];
|
_14 = [closure@main::{closure#0}];
|
||||||
Retag(_14);
|
Retag(_14);
|
||||||
_13 = move _14 as for<'a> fn(&'a i32) -> &'a i32 (Pointer(ClosureFnPointer(Normal)));
|
_13 = move _14 as for<'a> fn(&'a i32) -> &'a i32 (PointerCoercion(ClosureFnPointer(Normal)));
|
||||||
StorageDead(_14);
|
StorageDead(_14);
|
||||||
StorageLive(_15);
|
StorageLive(_15);
|
||||||
StorageLive(_16);
|
StorageLive(_16);
|
||||||
|
|
|
@ -105,7 +105,7 @@ fn main() -> () {
|
||||||
StorageLive(_14);
|
StorageLive(_14);
|
||||||
_14 = [closure@main::{closure#0}];
|
_14 = [closure@main::{closure#0}];
|
||||||
Retag(_14);
|
Retag(_14);
|
||||||
_13 = move _14 as for<'a> fn(&'a i32) -> &'a i32 (Pointer(ClosureFnPointer(Normal)));
|
_13 = move _14 as for<'a> fn(&'a i32) -> &'a i32 (PointerCoercion(ClosureFnPointer(Normal)));
|
||||||
StorageDead(_14);
|
StorageDead(_14);
|
||||||
StorageLive(_15);
|
StorageLive(_15);
|
||||||
StorageLive(_16);
|
StorageLive(_16);
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
- StorageLive(_4);
|
- StorageLive(_4);
|
||||||
- _4 = &_1;
|
- _4 = &_1;
|
||||||
- _3 = &(*_4);
|
- _3 = &(*_4);
|
||||||
- _2 = move _3 as &[u8] (Pointer(Unsize));
|
- _2 = move _3 as &[u8] (PointerCoercion(Unsize));
|
||||||
- StorageDead(_3);
|
- StorageDead(_3);
|
||||||
- StorageDead(_4);
|
- StorageDead(_4);
|
||||||
- StorageDead(_2);
|
- StorageDead(_2);
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
bb1: {
|
bb1: {
|
||||||
_3 = move _4 as std::boxed::Box<dyn std::fmt::Display> (Pointer(Unsize));
|
_3 = move _4 as std::boxed::Box<dyn std::fmt::Display> (PointerCoercion(Unsize));
|
||||||
StorageDead(_4);
|
StorageDead(_4);
|
||||||
_2 = Result::<Box<dyn std::fmt::Display>, <T as Err>::Err>::Ok(move _3);
|
_2 = Result::<Box<dyn std::fmt::Display>, <T as Err>::Err>::Ok(move _3);
|
||||||
StorageDead(_3);
|
StorageDead(_3);
|
||||||
|
@ -95,7 +95,7 @@
|
||||||
_26 = const _;
|
_26 = const _;
|
||||||
_14 = &(*_26);
|
_14 = &(*_26);
|
||||||
_13 = &(*_14);
|
_13 = &(*_14);
|
||||||
_12 = move _13 as &[&str] (Pointer(Unsize));
|
_12 = move _13 as &[&str] (PointerCoercion(Unsize));
|
||||||
StorageDead(_13);
|
StorageDead(_13);
|
||||||
StorageLive(_16);
|
StorageLive(_16);
|
||||||
StorageLive(_17);
|
StorageLive(_17);
|
||||||
|
@ -126,7 +126,7 @@
|
||||||
StorageDead(_20);
|
StorageDead(_20);
|
||||||
_18 = &_19;
|
_18 = &_19;
|
||||||
_17 = &(*_18);
|
_17 = &(*_18);
|
||||||
_16 = move _17 as &[core::fmt::rt::Argument<'_>] (Pointer(Unsize));
|
_16 = move _17 as &[core::fmt::rt::Argument<'_>] (PointerCoercion(Unsize));
|
||||||
StorageDead(_17);
|
StorageDead(_17);
|
||||||
_11 = Arguments::<'_>::new_v1(move _12, move _16) -> [return: bb5, unwind unreachable];
|
_11 = Arguments::<'_>::new_v1(move _12, move _16) -> [return: bb5, unwind unreachable];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue