diff options
| author | bors <bors@rust-lang.org> | 2020-11-28 15:17:13 +0000 | 
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-11-28 15:17:13 +0000 | 
| commit | e37f25aa3f356546ab851e394d5598fc575eabda (patch) | |
| tree | 74c4ea90fdc836713c72cb393d1b8f442dd0e4c4 /compiler/rustc_codegen_cranelift/src/base.rs | |
| parent | 4ae328bef47dffcbf363e5ae873f419c06a5511d (diff) | |
| parent | 208d680f771601cf5efb6a7bfb49cb2b9e655d3e (diff) | |
| download | rust-e37f25aa3f356546ab851e394d5598fc575eabda.tar.gz rust-e37f25aa3f356546ab851e394d5598fc575eabda.zip  | |
Auto merge of #79507 - jonas-schievink:rollup-e5yeayh, r=jonas-schievink
Rollup of 10 pull requests Successful merges: - #78086 (Improve doc for 'as _') - #78853 (rustc_parse: fix ConstBlock expr span) - #79234 (Resolve typedefs in HashMap gdb/lldb pretty-printers) - #79344 (Convert UNC path to local path to satisfy install script on Windows) - #79383 (Fix bold code formatting in keyword docs) - #79460 (Remove intermediate vectors from `add_bounds`) - #79474 (Change comments on types to doc-comments) - #79476 (Sync rustc_codegen_cranelift) - #79478 (Expand docs on Peekable::peek_mut) - #79486 (Slightly improve code samples in E0591) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_cranelift/src/base.rs')
| -rw-r--r-- | compiler/rustc_codegen_cranelift/src/base.rs | 31 | 
1 files changed, 26 insertions, 5 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/base.rs b/compiler/rustc_codegen_cranelift/src/base.rs index a4df371c88a..72073896a72 100644 --- a/compiler/rustc_codegen_cranelift/src/base.rs +++ b/compiler/rustc_codegen_cranelift/src/base.rs @@ -12,6 +12,10 @@ pub(crate) fn codegen_fn<'tcx>( ) { let tcx = cx.tcx; + let _inst_guard = + crate::PrintOnPanic(|| format!("{:?} {}", instance, tcx.symbol_name(instance).name)); + debug_assert!(!instance.substs.needs_infer()); + let mir = tcx.instance_mir(instance.def); // Declare function @@ -499,7 +503,8 @@ fn codegen_stmt<'tcx>( UnOp::Neg => match layout.ty.kind() { ty::Int(IntTy::I128) => { // FIXME remove this case once ineg.i128 works - let zero = CValue::const_val(fx, layout, ty::ScalarInt::null(layout.size)); + let zero = + CValue::const_val(fx, layout, ty::ScalarInt::null(layout.size)); crate::num::codegen_int_binop(fx, BinOp::Sub, zero, operand) } ty::Int(_) => CValue::by_val(fx.bcx.ins().ineg(val), layout), @@ -509,7 +514,11 @@ fn codegen_stmt<'tcx>( }; lval.write_cvalue(fx, res); } - Rvalue::Cast(CastKind::Pointer(PointerCast::ReifyFnPointer), ref operand, to_ty) => { + Rvalue::Cast( + CastKind::Pointer(PointerCast::ReifyFnPointer), + ref operand, + to_ty, + ) => { let from_ty = fx.monomorphize(operand.ty(&fx.mir.local_decls, fx.tcx)); let to_layout = fx.layout_of(fx.monomorphize(to_ty)); match *from_ty.kind() { @@ -530,9 +539,21 @@ fn codegen_stmt<'tcx>( _ => bug!("Trying to ReifyFnPointer on non FnDef {:?}", from_ty), } } - Rvalue::Cast(CastKind::Pointer(PointerCast::UnsafeFnPointer), ref operand, to_ty) - | Rvalue::Cast(CastKind::Pointer(PointerCast::MutToConstPointer), ref operand, to_ty) - | Rvalue::Cast(CastKind::Pointer(PointerCast::ArrayToPointer), ref operand, to_ty) => { + Rvalue::Cast( + CastKind::Pointer(PointerCast::UnsafeFnPointer), + ref operand, + to_ty, + ) + | Rvalue::Cast( + CastKind::Pointer(PointerCast::MutToConstPointer), + ref operand, + to_ty, + ) + | Rvalue::Cast( + CastKind::Pointer(PointerCast::ArrayToPointer), + ref operand, + to_ty, + ) => { let to_layout = fx.layout_of(fx.monomorphize(to_ty)); let operand = codegen_operand(fx, operand); lval.write_cvalue(fx, operand.cast_pointer_to(to_layout));  | 
