-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Cannot move upvars through multiple closures #2338
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
Of course, requiring an explicit copy capture clause makes using higher-order functions for flow control a lot less appealing. |
I'm having trouble reproducing this bug. (There have been a number syntactic changes to the language since it was filed.) |
In particular, the interface to
|
If there was ever a bug here (which is unclear to me), I think that this no longer applies due to the moves-based-on-type rules. I'm closing. @brson let me know if you disagree. |
tweak format strings
This commit adds an implementation for the `benchcomp visualize` command. Currently, there is one visualization, "error_on_regression", which causes `benchcomp` or `benchcomp visualize` to terminate with a return code of 1 if there was a regression in any of the metrics. Users can specify the following in their config file: visualize: - type: error_on_regression variant_pairs: - [variant_1, variant_2] - [variant_1, variant_3] checks: - metric: runtime test: "lambda old, new: new / old > 1.1" - metric: passed test: "lambda old, new: False if not old else not new" This says to check whether any benchmark regressed when run under variant_2 compared to variant_1. A benchmark is considered to have regressed if the value of the 'runtime' metric under variant_2 is 10% higher than the value under variant_1. Furthermore, the benchmark is also considered to have regressed if it was previously passing, but is now failing. These same checks are performed on all benchmarks run under variant_3 compared to variant_1. If any of those lambda functions returns True, then benchcomp will terminate with a return code of 1. This commit fixes rust-lang#2338.
This fails because
q
ends up being a copy. Even adding capture clauses to both functions does not work becauseq
cannot be moved out of the first closure.This results in some subtle behavior with functional control structures, particularly since the copy happens implicitly. For example, in my rewrite of
core::comm
I have a requirement that a particular variable not be copied. This has to carefully be verified through tests to prevent the compiler from inserting copies and prevents me from using nice-looking functional code.I don't know how to fix this. Probably the easiest thing is to disallow this pattern by requiring the copies to be explicit.
The text was updated successfully, but these errors were encountered: