-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Functions provided in a vector to a vec::each can't be called #3550
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
Comments
We were so close to figuring it out! That vec::each change has, in fact, made it in, and it also turns out that
Though if you're calling func multiple times inside the loop you should probably reassign it for convenience:
This still feels a little grody, though. Niko has noted a potential solution for this in rust-lang/prev.rust-lang.org#1, via supporting infallible matching in parameter lists. That would enable you to write it a bit more naturally:
@nikomatsakis, would you mind opening an issue for infallible matching in parameter lists, so it doesn't get forgotten? I get the feeling that people are going to keep stumbling/grumbling over this. |
That looks like it has fixed it - you're a star. The latter syntax would indeed make life a lot more pleasant, but I'm happy to call this closed. |
@AngryLawyer using named functions as values is wonky right now and needs to be rethought. Wrapping them in explicit closures per @bstrie is the best workaround. |
@brson Actually, using named functions in this case wasn't an issue. Changing |
as @bstrie pointed out, this is related to demoding... each gives you a ptr to the thing in the list, hence a ptr to a fn, so you have to manually dereference the pointer to call it. |
@bstrie no |
tls dtors: treat all unixes uniformly
tls dtors: treat all unixes uniformly
This may turn out to me being a plonker, but while maintaining rust-sdl to match the latest version of Master, I had to swap out vec::iter for vec::each, as the former has vanished.
I have code similar to this:
And I'm getting this in response.
Any ideas?
The text was updated successfully, but these errors were encountered: