Skip to content

Commit d170b6b

Browse files
committed
Sync from rust 1459b3128e288a85fcc4dd1fee7ada2cdcf28794
2 parents ae0a22c + 7ac6cc9 commit d170b6b

File tree

3 files changed

+9
-24
lines changed

3 files changed

+9
-24
lines changed

src/base.rs

+8-11
Original file line numberDiff line numberDiff line change
@@ -336,17 +336,10 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
336336
crate::abi::codegen_return(fx);
337337
}
338338
TerminatorKind::Assert { cond, expected, msg, target, cleanup: _ } => {
339-
if !fx.tcx.sess.overflow_checks() {
340-
let overflow_not_to_check = match msg {
341-
AssertKind::OverflowNeg(..) => true,
342-
AssertKind::Overflow(op, ..) => op.is_checkable(),
343-
_ => false,
344-
};
345-
if overflow_not_to_check {
346-
let target = fx.get_block(*target);
347-
fx.bcx.ins().jump(target, &[]);
348-
continue;
349-
}
339+
if !fx.tcx.sess.overflow_checks() && msg.is_optional_overflow_check() {
340+
let target = fx.get_block(*target);
341+
fx.bcx.ins().jump(target, &[]);
342+
continue;
350343
}
351344
let cond = codegen_operand(fx, cond).load_scalar(fx);
352345

@@ -706,6 +699,10 @@ fn codegen_stmt<'tcx>(
706699
let operand = codegen_operand(fx, operand);
707700
operand.coerce_dyn_star(fx, lval);
708701
}
702+
Rvalue::Cast(CastKind::Transmute, ref operand, _to_ty) => {
703+
let operand = codegen_operand(fx, operand);
704+
lval.write_cvalue_transmute(fx, operand);
705+
}
709706
Rvalue::Discriminant(place) => {
710707
let place = codegen_place(fx, place);
711708
let value = place.to_cvalue(fx);

src/intrinsics/mod.rs

-10
Original file line numberDiff line numberDiff line change
@@ -557,16 +557,6 @@ fn codegen_regular_intrinsic_call<'tcx>(
557557
fx.bcx.ins().band(ptr, mask);
558558
}
559559

560-
sym::transmute => {
561-
intrinsic_args!(fx, args => (from); intrinsic);
562-
563-
if ret.layout().abi.is_uninhabited() {
564-
crate::base::codegen_panic(fx, "Transmuting to uninhabited type.", source_info);
565-
return;
566-
}
567-
568-
ret.write_cvalue_transmute(fx, from);
569-
}
570560
sym::write_bytes | sym::volatile_set_memory => {
571561
intrinsic_args!(fx, args => (dst, val, count); intrinsic);
572562
let val = val.load_scalar(fx);

src/vtable.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ pub(crate) fn get_ptr_and_method_ref<'tcx>(
4848
) -> (Pointer, Value) {
4949
let (ptr, vtable) = 'block: {
5050
if let Abi::Scalar(_) = arg.layout().abi {
51-
'descend_newtypes: while !arg.layout().ty.is_unsafe_ptr()
52-
&& !arg.layout().ty.is_region_ptr()
53-
{
51+
'descend_newtypes: while !arg.layout().ty.is_unsafe_ptr() && !arg.layout().ty.is_ref() {
5452
for i in 0..arg.layout().fields.count() {
5553
let field = arg.value_field(fx, mir::Field::new(i));
5654
if !field.layout().is_zst() {

0 commit comments

Comments
 (0)