rust/compiler/rustc_middle/src
bors 59337cddd4 Auto merge of #91342 - RalfJung:fn-abi, r=eddyb,oli-obk
CTFE eval_fn_call: use FnAbi to determine argument skipping and compatibility

This makes use of the `FnAbi` type in CTFE/Miri, which `@eddyb` has been saying for years is what we should do.^^ `FnAbi` is used to
- determine which arguments to skip (rather than the previous heuristic of skipping ZST arguments with the Rust ABI)
- impose further restrictions on whether caller and callee are consistent in how a given argument is passed

I was hoping it would also simplify the code, but that is not the case -- the previous type compatibility checks are still required (AFAIK), only the ZST skipping is gone and that took barely any code. We also need some hacks because `FnAbi` assumes a certain way of implementing `caller_location` (by passing extra arguments), but Miri can just read the caller location from the call stack so it doesn't need those arguments. (The fact that every backend has to separately implement support for these arguments seems suboptimal -- looks like this might have been better implemented on the MIR level.) To avoid having to implement those unnecessary arguments in Miri, we just compute *whether* the argument is present on the caller/callee side, but don't actually pass that argument around.

I have no idea if this looks the way `@eddyb` thinks it should look... but it makes Miri's test suite pass. ;)
One of rustc's tests fails unfortunately (`ui/const-generics/issues/issue-67739.rs`), some const generic code that is evaluated too early -- I think that should raise `TooGeneric` but instead it ICEs. My assumption is this is some FnAbi code that has not been properly tested on polymorphic code, but it might also be me calling that FnAbi code the wrong way.

r? `@oli-obk` `@eddyb`
Fixes https://github.com/rust-lang/rust/issues/56166
Miri PR at https://github.com/rust-lang/miri/pull/1928
2021-12-24 04:59:05 +00:00
..
dep_graph Remove in_band_lifetimes from rustc_middle 2021-12-15 19:50:43 -05:00
hir Revert "Auto merge of #91491 - spastorino:revert-91354, r=oli-obk" 2021-12-12 12:34:46 +08:00
infer Remove in_band_lifetimes from rustc_middle 2021-12-15 19:50:43 -05:00
middle Auto merge of #92099 - matthiaskrgr:rollup-4gwv67m, r=matthiaskrgr 2021-12-19 12:36:56 +00:00
mir Auto merge of #91342 - RalfJung:fn-abi, r=eddyb,oli-obk 2021-12-24 04:59:05 +00:00
query Auto merge of #91924 - Aaron1011:serialize-adt-def, r=michaelwoerister 2021-12-20 10:35:48 +00:00
thir add a CastKind to Node::Cast 2021-09-09 01:32:03 +01:00
traits Auto merge of #92167 - pierwill:chalk-update, r=jackh726 2021-12-23 08:59:55 +00:00
ty Auto merge of #91342 - RalfJung:fn-abi, r=eddyb,oli-obk 2021-12-24 04:59:05 +00:00
util Use AddAssign impl 2021-11-09 23:47:36 +01:00
arena.rs Fully serialize AdtDef 2021-12-15 16:32:16 -05:00
lib.rs Remove in_band_lifetimes from rustc_middle 2021-12-15 19:50:43 -05:00
lint.rs Auto merge of #92099 - matthiaskrgr:rollup-4gwv67m, r=matthiaskrgr 2021-12-19 12:36:56 +00:00
macros.rs Rename TypeFolderFallible to FallibleTypeFolder 2021-12-02 16:14:18 +00:00
tests.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
thir.rs rename mir -> thir around abstract consts 2021-09-09 01:32:03 +01:00