-
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
rustc: allow "omitting" visit glue. #11793
Conversation
This adds `-Z noop-reflection` which causes all visit glues to be empty. As an example of its effects, an optimised libsyntax.so is 300 KB (5%) smaller and requires 14MB less memory to compile. This is likely most useful for #[no_std] crates using closures or trait objects (which require a tydesc to be created for their contained types) to avoid the code bloat of the otherwise unused visit glue.
Although I really hate visit glue, I would prefer fixing the root cause by removing the |
There are definitely a few explicit uses of visit glue in libsyntax. |
I also fear that this may not be the best solution for this problem. My biggest concern is that you can't retroactively go back and remove visit glue from libraries you're linking to (you'd have to recompile them). For example the no-landing-pads option will retroactively modify code when performing LTO, which isn't great because it only runs on LTO, but it's at least possible. I feel like the general usage pattern of Regardless, I'd be curious to get some more opinions on this. |
I think cc @nikomatsakis, who has been having similar thoughts. |
I'm happy to work on |
We decided in today's meeting that this isn't quite the strategy that we'd like to pursue. We definitely think that visit glue is leading to codegen/compile-time problems, but for now we shouldn't be omitting it like this. We're debating the idea of removing |
teach `eager_or_lazy` about panicky arithmetic operations Fixes rust-lang#9422 Fixes rust-lang#9814 Fixes rust-lang#11793 It's a bit sad that we have to do this because arithmetic operations seemed to me like the prime example where a closure would not be necessary, but this has "side effects" (changes behavior when going from lazy to eager) as some of these panic on overflow/underflow if compiled with `-Coverflow-checks` (which is the default in debug mode). Given the number of backlinks in the mentioned issues, this seems to be a FP that is worth fixing, probably. changelog: [`unnecessary_lazy_evaluations`]: don't lint if closure has panicky arithmetic operations
This adds
-Z noop-reflection
which causes all visit glues to beempty. As an example of its effects, an optimised libsyntax.so is 300
KB (5%) smaller and requires 14MB less memory to compile.
This is likely most useful for #[no_std] crates using closures or trait
objects (which require a tydesc to be created for their contained types)
to avoid the code bloat of the otherwise unused visit glue.