Skip to content
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

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

Merged
merged 1 commit into from
Aug 18, 2016
Merged

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

merged 1 commit into from
Aug 18, 2016

Conversation

whitequark
Copy link
Member

@whitequark whitequark commented Aug 17, 2016

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

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.

authors = []

[profile.dev]
opt-level = {level}
Copy link
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
Member 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
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
Member Author

@alexcrichton Done

@alexcrichton
Copy link
Member

Looks like tests are failing?

@matklad
Copy link
Member

matklad commented Aug 17, 2016

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
Member Author

Tests passed now.

@alexcrichton
Copy link
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
Copy link
Contributor

bors commented Aug 18, 2016

📌 Commit bc858b0 has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Aug 18, 2016

⌛ 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
Copy link
Contributor

bors commented Aug 18, 2016

☀️ 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

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