-
Notifications
You must be signed in to change notification settings - Fork 356
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
Running diverging closure coerced to fn ptr fails: "invalid use of NULL pointer" #1075
Comments
test closure-to-fn-ptr coercions a bit more Also add some commented-out failing tests, Cc rust-lang/rust#66738 #1075
Does it have to be |
I don't understand it either, but replacing |
There is something weird about the coercion of diverging closures anyway, see rust-lang/rust#66738. |
Looks like the exception comes from here and then probably So, we have a function call with a return place, but that return place is actually the callers return place, and the caller diverges. This is okay because the callee also diverges, but we error out when just creating that return place. |
…oli-obk handle diverging functions forwarding their return place Fixes rust-lang/miri#1075: the shim around diverging closures turned into function pointers actually "obtains" a return place inside a diverging function, but just uses it as the return place for a diverging callee. Handle this by using NULL places. This is kind of a hack as it breaks our invariant that all places are dereferencable, but we'd eventually let raw pointers break that anyway I assume so that seems fine. r? @oli-obk
…oli-obk handle diverging functions forwarding their return place Fixes rust-lang/miri#1075: the shim around diverging closures turned into function pointers actually "obtains" a return place inside a diverging function, but just uses it as the return place for a diverging callee. Handle this by using NULL places. This is kind of a hack as it breaks our invariant that all places are dereferencable, but we'd eventually let raw pointers break that anyway I assume so that seems fine. r? @oli-obk
…oli-obk handle diverging functions forwarding their return place Fixes rust-lang/miri#1075: the shim around diverging closures turned into function pointers actually "obtains" a return place inside a diverging function, but just uses it as the return place for a diverging callee. Handle this by using NULL places. This is kind of a hack as it breaks our invariant that all places are dereferencable, but we'd eventually let raw pointers break that anyway I assume so that seems fine. r? @oli-obk
Test diverging closure coercion Adds a test for #1075. Depends on rust-lang/rust#66827.
The following code fails to run in Miri:
The error is
I am not entirely sure what is happening; it looks like this has something to do with the shim that is used to coerce non-capturing closures to function pointers.
Cc @eddyb @oli-obk
The text was updated successfully, but these errors were encountered: