Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adjust for FnAbi changes #1928

Merged
merged 2 commits into from
Dec 24, 2021
Merged

adjust for FnAbi changes #1928

merged 2 commits into from
Dec 24, 2021

Conversation

RalfJung
Copy link
Member

This is the Miri side of rust-lang/rust#91342.

@bors
Copy link
Contributor

bors commented Dec 15, 2021

☔ The latest upstream changes (presumably #1937) made this pull request unmergeable. Please resolve the merge conflicts.

@RalfJung
Copy link
Member Author

RalfJung commented Dec 15, 2021

(I'll wait with rebasing until rust-lang/rust#91342 lands.)

bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 24, 2021
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 rust-lang#56166
Miri PR at rust-lang/miri#1928
@RalfJung
Copy link
Member Author

@bors r+

@bors
Copy link
Contributor

bors commented Dec 24, 2021

📌 Commit 5ab0ea6 has been approved by RalfJung

@bors
Copy link
Contributor

bors commented Dec 24, 2021

⌛ Testing commit 5ab0ea6 with merge d307e6c...

@bors
Copy link
Contributor

bors commented Dec 24, 2021

☀️ Test successful - checks-actions
Approved by: RalfJung
Pushing d307e6c to master...

@bors bors merged commit d307e6c into rust-lang:master Dec 24, 2021
@RalfJung RalfJung deleted the fn-abi branch December 24, 2021 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-blocked-on-rust Status: Blocked on landing a Rust PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants