-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Implemented string lookup for build.rustflags
config key
#3356
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
Looks good to me, thanks! Could you add a test for this as well? |
Sure, will do! Also, it would make sense to allow for the same syntax in the |
675256b
to
79924b5
Compare
While building the test case, I noticed that some moving part outside of cargo is doing config file validation, killing the process with an error message before my code runs:
I'll look into it now. EDIT: It is indeed a part in cargo, but the message shouldn't be printed, given we want to retry with a different lookup. |
Oh I think it's the |
Yes, I figured as much :). Still needs a way to generate a better error message signalling the user can use both strings and lists. It will probably be somewhat longer and less elegant, however. |
Hm, after fiddling around with the code a bit, I think this is the cleanest implementation: match config.values()?.get(&key) {
Some(&ConfigValue::String(ref arg, _)) => {
return Ok(arg.split(' ').map(str::to_string).collect());
},
Some(&ConfigValue::List(ref args, _)) => {
let args = args.into_iter().map(|a| a.0.clone());
return Ok(args.collect());
},
Some(value) => return config.expected("list or string", &key, value.clone()),
None => (),
} |
Ah I prefer to use |
Yes, that's indeed a pitfall. I guess it won't work without a third lookup for the value, however, if we want a custom error message (which I think would make sense). Or I could implement something like |
Oh runtime we don't really have to worry about here, just errors and such. |
* One of the tests still doesn't pass, this needs further investigation
Looks good to me, thanks! Want to go ahead and refactor this to perhaps |
Sure. I also still need to figure out the details around the second test failing. |
This should, when passing all tests, be a complete solution in my book ^^. |
@bors: r+ Thanks! |
📌 Commit f440704 has been approved by |
⌛ Testing commit f440704 with merge 4aef11e... |
💔 Test failed - status-appveyor |
@bors: retry
…On Fri, Dec 2, 2016 at 2:07 PM, bors ***@***.***> wrote:
💔 Test failed - status-appveyor
<https://ci.appveyor.com/project/rust-lang-libs/cargo/build/1.0.509>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3356 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAD95IDo21IuCPnf3Q83gxHmbunPLe9Pks5rEJaNgaJpZM4LBxHg>
.
|
⌛ Testing commit f440704 with merge c2852b1... |
💔 Test failed - status-travis |
@bors: retry |
Implemented string lookup for `build.rustflags` config key This addresses the immediate issue described in #3052 . I am, however, unsure about the current state of the deeper issues mentioned in that issue, but if needed, I can take stab at them as well. :)
☀️ Test successful - status-appveyor, status-travis |
Thanks for having me! |
This addresses the immediate issue described in #3052 .
I am, however, unsure about the current state of the deeper issues mentioned in that issue, but if needed, I can take stab at them as well. :)