+ fx.bcx.ins().jump(target, &[]);
+
+ fx.bcx.switch_to_block(failure);
+
+ let location = fx.get_caller_location(bb_data.terminator().source_info.span).load_scalar(fx);
+
+ let args;
+ let lang_item = match msg {
+ AssertKind::BoundsCheck { ref len, ref index } => {
+ let len = trans_operand(fx, len).load_scalar(fx);
+ let index = trans_operand(fx, index).load_scalar(fx);
+ args = [index, len, location];
+ rustc_hir::lang_items::PanicBoundsCheckFnLangItem
+ }
+ _ => {
+ let msg_str = msg.description();
+ let msg_ptr = fx.anonymous_str("assert", msg_str);
+ let msg_len = fx.bcx.ins().iconst(fx.pointer_type, i64::try_from(msg_str.len()).unwrap());
+ args = [msg_ptr, msg_len, location];
+ rustc_hir::lang_items::PanicFnLangItem
+ }
+ };
+
+ let def_id = fx.codegen_cx.tcx.lang_items().require(lang_item).unwrap_or_else(|s| {
+ fx.codegen_cx.tcx.sess.span_fatal(bb_data.terminator().source_info.span, &s)
+ });
+
+ let instance = Instance::mono(fx.codegen_cx.tcx, def_id).polymorphize(fx.codegen_cx.tcx);
+ let symbol_name = fx.codegen_cx.tcx.symbol_name(instance).name;
+
+ fx.lib_call(&*symbol_name, vec![fx.pointer_type, fx.pointer_type, fx.pointer_type], vec![], &args);
+
+ crate::trap::trap_unreachable(fx, "panic lang item returned");