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 true and false as options for strip option #9153

Closed
wants to merge 4 commits into from

Conversation

calavera
Copy link
Contributor

@calavera calavera commented Feb 8, 2021

This follows the convention of lto and debug that allow true for
the highest level, and false for disabled.

Signed-off-by: David Calavera david.calavera@gmail.com

This follows the convention of `lto` and `debug` that allow `true` for
the highest level, and `false` for disabled.

Signed-off-by: David Calavera <david.calavera@gmail.com>
@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 @ehuss (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.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 8, 2021
Verifying options doesn't happen when the file is parsed.
This scenario is already covered in another test.

See [the profiles test suite](https://github.com/rust-lang/cargo/blob/6e3e14e223f9566773b5d903357cbf35ae528ac6/tests/testsuite/profiles.rs#L549)

Signed-off-by: David Calavera <david.calavera@gmail.com>
Copy link
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me!

src/cargo/util/toml/mod.rs Outdated Show resolved Hide resolved
src/cargo/core/profiles.rs Outdated Show resolved Hide resolved
@ehuss ehuss added S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 9, 2021
@calavera
Copy link
Contributor Author

calavera commented Feb 9, 2021

thanks for the review @alexcrichton. I'll try to work on a more general solution with less specific validations

- Accept a string option that's passed to rustc to decide
how to handle it.
- Remove early validation.

Signed-off-by: David Calavera <david.calavera@gmail.com>
The compiler emits an error when it receives an unknown option.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Copy link
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

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

Looks great to me, thanks!

@ehuss
Copy link
Contributor

ehuss commented Feb 9, 2021

@bors r+ squash

@bors
Copy link
Contributor

bors commented Feb 9, 2021

📌 Commit 666380f has been approved by ehuss

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. labels Feb 9, 2021
Some(StringOrBool::String(ref n)) if matches!(n.as_str(), "off" | "n" | "no") => {
profile.lto = Lto::Off
}
Some(StringOrBool::String(ref n)) if is_off(n.as_str()) => profile.lto = Lto::Off,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a little uncomfortable changing this to accept "none" as off, but in the grand scheme of things probably doesn't matter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

to be honest, it made me uncomfortable too, but then I remembered that I copied/pasted this code in different places in the first iteration, and kinda decided to avoid that for future contributors.

bors added a commit that referenced this pull request Feb 10, 2021
Allow `true` and `false` as options for `strip` option

This follows the convention of `lto` and `debug` that allow `true` for
the highest level, and `false` for disabled.

Signed-off-by: David Calavera <david.calavera@gmail.com>
@bors
Copy link
Contributor

bors commented Feb 10, 2021

⌛ Testing commit 666380f with merge ab64d13...

@bors
Copy link
Contributor

bors commented Feb 10, 2021

☀️ Test successful - checks-actions
Approved by: ehuss
Pushing ab64d13 to master...

JohnTitor added a commit to JohnTitor/rust that referenced this pull request Feb 10, 2021
Update cargo

5 commits in 34170fcd6e0947808a1ac63ac85ffc0da7dace2f..ab64d1393b5b77c66b6534ef5023a1b89ee7bf64
2021-02-04 15:52:52 +0000 to 2021-02-10 00:19:10 +0000
- Allow `true` and `false` as options for `strip` option (rust-lang/cargo#9153)
- Change git dependencies to use `HEAD` by default (rust-lang/cargo#9133)
- appendix auth gcm link to new repo (which is xplat) (rust-lang/cargo#9152)
- Fix warnings of the new non_fmt_panic lint (rust-lang/cargo#9148)
- Fix panic with doc collision orphan. (rust-lang/cargo#9142)
@calavera
Copy link
Contributor Author

It looks like bors merged these changes in master already, but the PR is still open. Should this be closed? I've noticed that other PRs get closed and marked as "merged" by bors, I don't understand why it didn't happen with this one.

@ehuss
Copy link
Contributor

ehuss commented Feb 10, 2021

Oh, strange! GitHub was having some issues yesterday, that could be it. Or it could be the squash command, I've never used that before. Or it could be bors was taking a nap.

@ehuss ehuss closed this Feb 10, 2021
@calavera calavera deleted the strip_options branch February 10, 2021 17:25
@ehuss ehuss added this to the 1.52.0 milestone Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants