-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Add support for binding a method off an impl #435
Comments
Currently, this fails in trans with an "unimplemented re-binding existing function" error. |
With my fix to #754, your program compiles but returns the wrong value. |
This is closely related to #758. One of them probably depends on the other, depending on how we tackle them. |
This particular test is passing now, but it might be accidental. I'm not sure we've got this feature working in general yet; I haven't yet thought through how the latest incarnation of the object system behaves wrt bind. |
I think it working is basically accidental? I suspect that if the object had fields things would be a bit more problematic. |
I'm unassigning myself from this one and marking it as unassigned, since, realistically speaking, I don't think I'll have time to tackle it in the next four days. |
LValues no longer carry information about generics and objs, instead there's an extended form of lvalue, lval_maybe_callee, only used by call and bind, which holds this info. This makes it possible to take the value of a method and get a working closure, and will (with some more work) allow us to call statically known functions without loading from their pair. Closes rust-lang#435 Closes rust-lang#758
This was working only by accident (the resulting closure doesn't actually hold on to the object, so it segfaults when called after the object dies). I assumed the closed over thing was the object box, but in fact it's a {vtbl_, box_} pair. Extra machinery will be needed to wrap this in a closure. |
Repurposing this bug to support the same for impls. The problem is basically the same: package up enough information into the closure to allow the resulting function value to find it's self value. |
This allows you to take the value of, for example, `[1].len`, or bind it with `bind x.map(_)` syntax. I'm holding off on implementing this for dynamic methods (those on bounded type parameters or iface types) until it's clearer what we will do with monomorphization. Issue #435
Enable musl with aarch64
Add grouped patterns.
Read and write dylib metadata
Generate content into `build` folder
Make it legal to do the following:
This feature would make it possible to reify methods as standalone functions. (I haven't thought through all the implications of this; I suppose the resulting function would have to capture the object in its scope.)
The text was updated successfully, but these errors were encountered: