-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
ICE when transmuting to extern "rust-call" fn() #66696
Comments
Backtrace:
|
I'd like to give this a try. The failing code is this rust/src/librustc/ty/layout.rs Lines 2472 to 2487 in 809e180
For example if I change function type and add an argument, I get a different panic saying that the last argument should be a tuple:
But if I turn that argument into a tuple it works:
I don't know anything about RustCall ABI but assuming these restrictions are correct I guess there will be a check (maybe in the type checker?) that checks the function type and reject the program with a proper error message when the function is not valid according to RustCall ABI. That means a special case for Does this make sense? Where is a good place to add this check? OP says this only happens in nightly, but |
As of #67986, it will still ICE, but deliberately (as the |
Implement `std::marker::Tuple`, use it in `extern "rust-call"` and `Fn`-family traits Implements rust-lang/compiler-team#537 I made a few opinionated decisions in this implementation, specifically: 1. Enforcing `extern "rust-call"` on fn items during wfcheck, 2. Enforcing this for all functions (not just ones that have bodies), 3. Gating this `Tuple` marker trait behind its own feature, instead of grouping it into (e.g.) `unboxed_closures`. Still needing to be done: 1. Enforce that `extern "rust-call"` `fn`-ptrs are well-formed only if they have 1/2 args and the second one implements `Tuple`. (Doing this would fix ICE in rust-lang#66696.) 2. Deny all explicit/user `impl`s of the `Tuple` trait, kinda like `Sized`. 3. Fixing `Tuple` trait built-in impl for chalk, so that chalkification tests are un-broken. Open questions: 1. Does this need t-lang or t-libs signoff? Fixes rust-lang#99820
Hi, I appear to have found this ICE that only occurs on nightly. Reproducing it is as simple as the below example:
The text was updated successfully, but these errors were encountered: