]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #40377 - camlorn:optimization_fuel, r=eddyb
authorCorey Farwell <coreyf@rwell.org>
Tue, 11 Apr 2017 22:36:12 +0000 (18:36 -0400)
committerGitHub <noreply@github.com>
Tue, 11 Apr 2017 22:36:12 +0000 (18:36 -0400)
Implement optimization fuel and re-enable struct field reordering

See [this discussion](https://internals.rust-lang.org/t/rolling-out-or-unrolling-struct-field-reorderings/4485) for background.

This pull request adds two new compilation options: `-Z print-fuel=crate` prints the optimization fuel used by a crate and `-Z fuel=crate=n` sets the optimization fuel for a crate.

It also turns field reordering back on.  There is no way to test this feature without something consuming fuel.  We can roll this back if we want, but then the optimization fuel bits will be dead code.

The one notable absence from this PR is a test case.  I'm not sure how to do one that's worth having.  The only thing I can think of to test is `-Z fuel=foo=0`.  The problem with other tests is that either (1) they're so big that future optimizations will apply, thus breaking them or (2) we don't know which order the optimizations will be applied in, so we can't guess the message that will be printed.  If someone has a useful proposal for a good test, I certainly want to add one.


Trivial merge