bug!
more uses of these in runtime stuff
This commit is contained in:
parent
4630d1b23b
commit
e04e35133f
3 changed files with 18 additions and 18 deletions
|
@ -677,21 +677,22 @@ fn codegen_stmt<'tcx>(
|
||||||
CastKind::PointerCoercion(PointerCoercion::UnsafeFnPointer),
|
CastKind::PointerCoercion(PointerCoercion::UnsafeFnPointer),
|
||||||
ref operand,
|
ref operand,
|
||||||
to_ty,
|
to_ty,
|
||||||
)
|
|
||||||
| Rvalue::Cast(
|
|
||||||
CastKind::PointerCoercion(PointerCoercion::MutToConstPointer),
|
|
||||||
ref operand,
|
|
||||||
to_ty,
|
|
||||||
)
|
|
||||||
| Rvalue::Cast(
|
|
||||||
CastKind::PointerCoercion(PointerCoercion::ArrayToPointer),
|
|
||||||
ref operand,
|
|
||||||
to_ty,
|
|
||||||
) => {
|
) => {
|
||||||
let to_layout = fx.layout_of(fx.monomorphize(to_ty));
|
let to_layout = fx.layout_of(fx.monomorphize(to_ty));
|
||||||
let operand = codegen_operand(fx, operand);
|
let operand = codegen_operand(fx, operand);
|
||||||
lval.write_cvalue(fx, operand.cast_pointer_to(to_layout));
|
lval.write_cvalue(fx, operand.cast_pointer_to(to_layout));
|
||||||
}
|
}
|
||||||
|
Rvalue::Cast(
|
||||||
|
CastKind::PointerCoercion(
|
||||||
|
PointerCoercion::MutToConstPointer | PointerCoercion::ArrayToPointer,
|
||||||
|
),
|
||||||
|
..,
|
||||||
|
) => {
|
||||||
|
bug!(
|
||||||
|
"{:?} is for borrowck, and should never appear in codegen",
|
||||||
|
to_place_and_rval.1
|
||||||
|
);
|
||||||
|
}
|
||||||
Rvalue::Cast(
|
Rvalue::Cast(
|
||||||
CastKind::IntToInt
|
CastKind::IntToInt
|
||||||
| CastKind::FloatToFloat
|
| CastKind::FloatToFloat
|
||||||
|
|
|
@ -456,8 +456,12 @@ 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::PointerCoercion(PointerCoercion::MutToConstPointer)
|
mir::CastKind::PointerCoercion(
|
||||||
| mir::CastKind::PtrToPtr
|
PointerCoercion::MutToConstPointer | PointerCoercion::ArrayToPointer,
|
||||||
|
) => {
|
||||||
|
bug!("{kind:?} is for borrowck, and should never appear in codegen");
|
||||||
|
}
|
||||||
|
mir::CastKind::PtrToPtr
|
||||||
if bx.cx().is_backend_scalar_pair(operand.layout) =>
|
if bx.cx().is_backend_scalar_pair(operand.layout) =>
|
||||||
{
|
{
|
||||||
if let OperandValue::Pair(data_ptr, meta) = operand.val {
|
if let OperandValue::Pair(data_ptr, meta) = operand.val {
|
||||||
|
@ -477,9 +481,6 @@ 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::PointerCoercion(
|
|
||||||
PointerCoercion::MutToConstPointer | PointerCoercion::ArrayToPointer,
|
|
||||||
)
|
|
||||||
| mir::CastKind::IntToInt
|
| mir::CastKind::IntToInt
|
||||||
| mir::CastKind::FloatToInt
|
| mir::CastKind::FloatToInt
|
||||||
| mir::CastKind::FloatToFloat
|
| mir::CastKind::FloatToFloat
|
||||||
|
|
|
@ -70,9 +70,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
|
||||||
CastKind::PointerCoercion(
|
CastKind::PointerCoercion(
|
||||||
PointerCoercion::MutToConstPointer | PointerCoercion::ArrayToPointer,
|
PointerCoercion::MutToConstPointer | PointerCoercion::ArrayToPointer,
|
||||||
) => {
|
) => {
|
||||||
// These are NOPs, but can be wide pointers.
|
bug!("{cast_kind:?} casts are for borrowck only, not runtime MIR");
|
||||||
let v = self.read_immediate(src)?;
|
|
||||||
self.write_immediate(*v, dest)?;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CastKind::PointerCoercion(PointerCoercion::ReifyFnPointer) => {
|
CastKind::PointerCoercion(PointerCoercion::ReifyFnPointer) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue