diff options
| author | bors <bors@rust-lang.org> | 2020-10-17 10:28:52 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-10-17 10:28:52 +0000 |
| commit | 6f0ea299cfcb94aad6dc0a4fd06ae01153daf8fa (patch) | |
| tree | 352755212bf75978554c42881b56c37099120047 /compiler/rustc_codegen_llvm | |
| parent | 03687f8ffaf5ff03f6bedbe77752b9f930c7efeb (diff) | |
| parent | f6a53b4c691a5ba5ead6c0c0d072b301de1649f8 (diff) | |
| download | rust-6f0ea299cfcb94aad6dc0a4fd06ae01153daf8fa.tar.gz rust-6f0ea299cfcb94aad6dc0a4fd06ae01153daf8fa.zip | |
Auto merge of #77685 - jackh726:binder-map, r=lcnr
Use rebind instead of Binder::bind when possible These are really only the easy places. I just searched for `Binder::bind` and replaced where it straightforward. r? `@lcnr` cc. `@nikomatsakis`
Diffstat (limited to 'compiler/rustc_codegen_llvm')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/intrinsic.rs | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs index e78a4ea2e3c..e9900e8bc10 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -673,17 +673,9 @@ fn codegen_emcc_try( fn gen_fn<'ll, 'tcx>( cx: &CodegenCx<'ll, 'tcx>, name: &str, - inputs: Vec<Ty<'tcx>>, - output: Ty<'tcx>, + rust_fn_sig: ty::PolyFnSig<'tcx>, codegen: &mut dyn FnMut(Builder<'_, 'll, 'tcx>), ) -> &'ll Value { - let rust_fn_sig = ty::Binder::bind(cx.tcx.mk_fn_sig( - inputs.into_iter(), - output, - false, - hir::Unsafety::Unsafe, - Abi::Rust, - )); let fn_abi = FnAbi::of_fn_ptr(cx, rust_fn_sig, &[]); let llfn = cx.declare_fn(name, &fn_abi); cx.set_frame_pointer_elimination(llfn); @@ -710,22 +702,31 @@ fn get_rust_try_fn<'ll, 'tcx>( // Define the type up front for the signature of the rust_try function. let tcx = cx.tcx; let i8p = tcx.mk_mut_ptr(tcx.types.i8); - let try_fn_ty = tcx.mk_fn_ptr(ty::Binder::bind(tcx.mk_fn_sig( + // `unsafe fn(*mut i8) -> ()` + let try_fn_ty = tcx.mk_fn_ptr(ty::Binder::dummy(tcx.mk_fn_sig( iter::once(i8p), tcx.mk_unit(), false, hir::Unsafety::Unsafe, Abi::Rust, ))); - let catch_fn_ty = tcx.mk_fn_ptr(ty::Binder::bind(tcx.mk_fn_sig( + // `unsafe fn(*mut i8, *mut i8) -> ()` + let catch_fn_ty = tcx.mk_fn_ptr(ty::Binder::dummy(tcx.mk_fn_sig( [i8p, i8p].iter().cloned(), tcx.mk_unit(), false, hir::Unsafety::Unsafe, Abi::Rust, ))); - let output = tcx.types.i32; - let rust_try = gen_fn(cx, "__rust_try", vec![try_fn_ty, i8p, catch_fn_ty], output, codegen); + // `unsafe fn(unsafe fn(*mut i8) -> (), *mut i8, unsafe fn(*mut i8, *mut i8) -> ()) -> i32` + let rust_fn_sig = ty::Binder::dummy(cx.tcx.mk_fn_sig( + vec![try_fn_ty, i8p, catch_fn_ty].into_iter(), + tcx.types.i32, + false, + hir::Unsafety::Unsafe, + Abi::Rust, + )); + let rust_try = gen_fn(cx, "__rust_try", rust_fn_sig, codegen); cx.rust_try_fn.set(Some(rust_try)); rust_try } |
