diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2019-10-29 22:08:50 +0200 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2019-12-03 15:55:14 +0200 |
| commit | 902433b5bf4f42714ed8d5b6bbf0d574d83a4f0f (patch) | |
| tree | 02ae839ea543ecc2a9f8f3392d6bdc366f2669ae /src/librustc_codegen_ssa | |
| parent | 2b921d51d750cdb2892fff1cf0681481f4e5e3f6 (diff) | |
| download | rust-902433b5bf4f42714ed8d5b6bbf0d574d83a4f0f.tar.gz rust-902433b5bf4f42714ed8d5b6bbf0d574d83a4f0f.zip | |
rustc: take a PolyFnSig instead of an FnSig in FnAbi::of_fn_ptr.
Diffstat (limited to 'src/librustc_codegen_ssa')
| -rw-r--r-- | src/librustc_codegen_ssa/mir/block.rs | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/src/librustc_codegen_ssa/mir/block.rs b/src/librustc_codegen_ssa/mir/block.rs index 1f635688071..6dccf329c9f 100644 --- a/src/librustc_codegen_ssa/mir/block.rs +++ b/src/librustc_codegen_ssa/mir/block.rs @@ -488,11 +488,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { // available - right now `sig` is only needed for getting the `abi` // and figuring out how many extra args were passed to a C-variadic `fn`. let sig = callee.layout.ty.fn_sig(bx.tcx()); - let sig = bx.tcx().normalize_erasing_late_bound_regions( - ty::ParamEnv::reveal_all(), - &sig, - ); - let abi = sig.abi; + let abi = sig.abi(); // Handle intrinsics old codegen wants Expr's for, ourselves. let intrinsic = match def { @@ -502,6 +498,17 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { }; let intrinsic = intrinsic.as_ref().map(|s| &s[..]); + let extra_args = &args[sig.inputs().skip_binder().len()..]; + let extra_args = extra_args.iter().map(|op_arg| { + let op_ty = op_arg.ty(*self.mir, bx.tcx()); + self.monomorphize(&op_ty) + }).collect::<Vec<_>>(); + + let fn_abi = match instance { + Some(instance) => FnAbi::of_instance(&bx, instance, &extra_args), + None => FnAbi::of_fn_ptr(&bx, sig, &extra_args) + }; + if intrinsic == Some("transmute") { if let Some(destination_ref) = destination.as_ref() { let &(ref dest, target) = destination_ref; @@ -515,23 +522,12 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { // we can do what we like. Here, we declare that transmuting // into an uninhabited type is impossible, so anything following // it must be unreachable. - assert_eq!(bx.layout_of(sig.output()).abi, layout::Abi::Uninhabited); + assert_eq!(fn_abi.ret.layout.abi, layout::Abi::Uninhabited); bx.unreachable(); } return; } - let extra_args = &args[sig.inputs().len()..]; - let extra_args = extra_args.iter().map(|op_arg| { - let op_ty = op_arg.ty(*self.mir, bx.tcx()); - self.monomorphize(&op_ty) - }).collect::<Vec<_>>(); - - let fn_abi = match instance { - Some(instance) => FnAbi::of_instance(&bx, instance, &extra_args), - None => FnAbi::of_fn_ptr(&bx, sig, &extra_args) - }; - // For normal codegen, this Miri-specific intrinsic is just a NOP. if intrinsic == Some("miri_start_panic") { let target = destination.as_ref().unwrap().1; |
