]> git.lizzy.rs Git - rust.git/commit - src/tools/clippy
Auto merge of #65947 - eddyb:fn-abi, r=oli-obk,nagisa
authorbors <bors@rust-lang.org>
Wed, 4 Dec 2019 08:22:05 +0000 (08:22 +0000)
committerbors <bors@rust-lang.org>
Wed, 4 Dec 2019 08:22:05 +0000 (08:22 +0000)
commit5f1d6c44034ac143f7a3e56ae7ea8858dcbb61ca
tree8ce8e889e897fa1514cece0e96b6f632de2411d5
parenta7fc0939ca4f8f951ce39e85ec5d149c7bb1501c
parentc2f4c57296f0d929618baed0b0d6eb594abf01eb
Auto merge of #65947 - eddyb:fn-abi, r=oli-obk,nagisa

rustc: split FnAbi's into definitions/direct calls ("of_instance") and indirect calls ("of_fn_ptr").

After this PR:
* `InstanceDef::Virtual` is only used for "direct" virtual calls, and shims around those calls use `InstanceDef::ReifyShim` (i.e. for `<dyn Trait as Trait>::f as fn(_)`)
  * this could easily be done for intrinsics as well, to allow their reification, but I didn't do it
* `FnAbi::of_instance` is **always** used for declaring/defining an `fn`, and for direct calls to an `fn`
  * this is great for e.g. https://github.com/rust-lang/rust/pull/65881 (`#[track_caller]`), which can introduce the "caller location" argument into "codegen signatures" by only changing `FnAbi::of_instance`, after this PR
* `FnAbi::of_fn_ptr` is used primarily for indirect calls, i.e. to `fn` pointers
  * *not* virtual calls (which use `FnAbi::of_instance` with `InstanceDef::Virtual`)
  * there's also a couple uses where the `rustc_codegen_llvm` needs to declare (i.e. FFI-import) an LLVM function that has no Rust declaration available at all
    * at least one of them could probably be a "weak lang item" instead

As there are many steps, this PR is best reviewed commit by commit - some of which arguably should be in their own PRs, I may have gotten carried away a bit.

cc @nagisa @rkruppe @oli-obk @anp
src/librustc_codegen_llvm/intrinsic.rs
src/librustc_codegen_ssa/base.rs