Skip to content

Allow using opt-level="s"/"z" in profile overrides#3007

Merged
bors merged 1 commit into
rust-lang:masterfrom
whitequark:opt-level-s
Aug 18, 2016
Merged

Allow using opt-level="s"/"z" in profile overrides#3007
bors merged 1 commit into
rust-lang:masterfrom
whitequark:opt-level-s

Conversation

@whitequark

@whitequark whitequark commented Aug 17, 2016

Copy link
Copy Markdown
Contributor

Initially, I've considered making a dedicated OptLevel enum, but this appeared to bring no practical benefit, only boilerplate, so I've used a String instead, which is also in line with the u32 that was there before, not even checked for being in range 0...3.

@rust-highfive

Copy link
Copy Markdown

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

Comment thread tests/profiles.rs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're missing quotes around {level} (at least s and z require quotes)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, that simple... Works now, thanks!

@alexcrichton

Copy link
Copy Markdown
Member

Thanks for the PR! As this is a nightly-only feature for now I think the test will need a gate at the top (similar to the plugin tests) to just run on nightly. Other than that though looks good to me!

@whitequark

Copy link
Copy Markdown
Contributor Author

@alexcrichton Done

@alexcrichton

Copy link
Copy Markdown
Member

Looks like tests are failing?

@matklad

matklad commented Aug 17, 2016

Copy link
Copy Markdown
Contributor

I think these s and z can be very cryptic for new users. We can use some longer form in configuration files. Not sure that it is a good idea though :)

@whitequark

Copy link
Copy Markdown
Contributor Author

Tests passed now.

@alexcrichton

Copy link
Copy Markdown
Member

Good question @matklad! I've opened up rust-lang/rust#35784 as a tracking issue for this unstable feature in general, and that seems appropriate to revisit when we move to stabilize the optimization levels.

Other than that, looks great to me, thanks @whitequark!

@bors: r+

@bors

bors commented Aug 18, 2016

Copy link
Copy Markdown
Contributor

📌 Commit bc858b0 has been approved by alexcrichton

@bors

bors commented Aug 18, 2016

Copy link
Copy Markdown
Contributor

⌛ Testing commit bc858b0 with merge 22fccc1...

bors added a commit that referenced this pull request Aug 18, 2016
Allow using opt-level="s"/"z" in profile overrides

Initially, I've considered making a dedicated `OptLevel` enum, but this appeared to bring no practical benefit, only boilerplate, so I've used a String instead, which is also in line with the `u32` that was there before, not even checked for being in range `0...3`.
@bors

bors commented Aug 18, 2016

Copy link
Copy Markdown
Contributor

☀️ Test successful - cargo-cross-linux, cargo-linux-32, cargo-linux-64, cargo-mac-32, cargo-mac-64, cargo-win-gnu-32, cargo-win-gnu-64, cargo-win-msvc-32, cargo-win-msvc-64
Approved by: alexcrichton
Pushing 22fccc1 to master...

@bors bors merged commit bc858b0 into rust-lang:master Aug 18, 2016
@bors bors mentioned this pull request Aug 18, 2016
@whitequark whitequark deleted the opt-level-s branch August 18, 2016 15:52
@MagaTailor

Copy link
Copy Markdown

Well, it's become a little inconsistent. The "s"/"z" suggestion is only printed after putting e.g. "3" in the Cargo.toml, while the most obvious 's' or 'z' on their own fail to parse with no hint.

And BTW, -C opt-level=z or s doesn't need quoting, just like the previous numeric levels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants