Sync from rust 1459b3128e288a85fcc4dd1fee7ada2cdcf28794
This commit is contained in:
commit
d170b6bf80
19
src/base.rs
19
src/base.rs
@ -336,17 +336,10 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
|
||||
crate::abi::codegen_return(fx);
|
||||
}
|
||||
TerminatorKind::Assert { cond, expected, msg, target, cleanup: _ } => {
|
||||
if !fx.tcx.sess.overflow_checks() {
|
||||
let overflow_not_to_check = match msg {
|
||||
AssertKind::OverflowNeg(..) => true,
|
||||
AssertKind::Overflow(op, ..) => op.is_checkable(),
|
||||
_ => false,
|
||||
};
|
||||
if overflow_not_to_check {
|
||||
let target = fx.get_block(*target);
|
||||
fx.bcx.ins().jump(target, &[]);
|
||||
continue;
|
||||
}
|
||||
if !fx.tcx.sess.overflow_checks() && msg.is_optional_overflow_check() {
|
||||
let target = fx.get_block(*target);
|
||||
fx.bcx.ins().jump(target, &[]);
|
||||
continue;
|
||||
}
|
||||
let cond = codegen_operand(fx, cond).load_scalar(fx);
|
||||
|
||||
@ -706,6 +699,10 @@ fn codegen_stmt<'tcx>(
|
||||
let operand = codegen_operand(fx, operand);
|
||||
operand.coerce_dyn_star(fx, lval);
|
||||
}
|
||||
Rvalue::Cast(CastKind::Transmute, ref operand, _to_ty) => {
|
||||
let operand = codegen_operand(fx, operand);
|
||||
lval.write_cvalue_transmute(fx, operand);
|
||||
}
|
||||
Rvalue::Discriminant(place) => {
|
||||
let place = codegen_place(fx, place);
|
||||
let value = place.to_cvalue(fx);
|
||||
|
@ -557,16 +557,6 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
||||
fx.bcx.ins().band(ptr, mask);
|
||||
}
|
||||
|
||||
sym::transmute => {
|
||||
intrinsic_args!(fx, args => (from); intrinsic);
|
||||
|
||||
if ret.layout().abi.is_uninhabited() {
|
||||
crate::base::codegen_panic(fx, "Transmuting to uninhabited type.", source_info);
|
||||
return;
|
||||
}
|
||||
|
||||
ret.write_cvalue_transmute(fx, from);
|
||||
}
|
||||
sym::write_bytes | sym::volatile_set_memory => {
|
||||
intrinsic_args!(fx, args => (dst, val, count); intrinsic);
|
||||
let val = val.load_scalar(fx);
|
||||
|
@ -48,9 +48,7 @@ pub(crate) fn get_ptr_and_method_ref<'tcx>(
|
||||
) -> (Pointer, Value) {
|
||||
let (ptr, vtable) = 'block: {
|
||||
if let Abi::Scalar(_) = arg.layout().abi {
|
||||
'descend_newtypes: while !arg.layout().ty.is_unsafe_ptr()
|
||||
&& !arg.layout().ty.is_region_ptr()
|
||||
{
|
||||
'descend_newtypes: while !arg.layout().ty.is_unsafe_ptr() && !arg.layout().ty.is_ref() {
|
||||
for i in 0..arg.layout().fields.count() {
|
||||
let field = arg.value_field(fx, mir::Field::new(i));
|
||||
if !field.layout().is_zst() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user