-
Notifications
You must be signed in to change notification settings - Fork 472
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
tool: Expose family()
in favour of incomplete is_like_xxx()
wrappers
#1358
Conversation
c5d5bde
to
421c210
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Have a few suggestions, and I will cut release tomorrow as it's too late for me.
src/tool.rs
Outdated
/// Whether the tool is GNU Compiler Collection-like. | ||
#[deprecated = "Consider matching against the ToolFamily returned by family() instead"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we should deprecate this now cc @madsmtm what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't sure either, might be a bit harsh but otherwise we could forget about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the same time matching against self.family()
for single variants is a bit ugly as you've seen.
421c210
to
55b8852
Compare
If we incorporate this PR, shall I just go ahead and remove |
55b8852
to
99c2f68
Compare
Yes i think so |
99c2f68
to
e551e8b
Compare
I suggest we hold off on doing this until the situation gets out of hand. Deprecating the current methods will cause a lot of unneeded churn, especially for projects that don't want to increase their minimum cc-rs version. |
Instead of adding a new `is_like_xxx()` function every time new information is needed, or new enumeration variants would be added, provide the (now `non_exhaustive`) `enum` directly to callers to match what they're interested in. Also removes `is_like_clang_cl()` again from rust-lang#1357 since that did not yet make it into a release, and would only cause unnecessary duplication in our API patterns.
e551e8b
to
cc342c5
Compare
family()
and deprecate is_like_xxx()
wrappersfamily()
in favour of incomplete is_like_xxx()
wrappers
@briansmith yeah makes sense, |
I wonder if it is a good idea to expose |
Regarding API I think it's ok. But since it's new API, cc @madsmtm can you take a look at this please?
I remember we do have some tests for compiler family detection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I don't particularly like exposing ToolFamily
, for several reasons:
- I'm not certain that
Msvc { clang_cl }
is the right nesting, it could also be e.g.Clang { cl }
. - I'm unsure if these three families are really the right separation, e.g. we might want
ToolFamily::VxWorks
orToolFamily::Emscripten
one day, but if we exposeToolFamily
we're forced to put those underToolFamily::Gnu { vxworks }
orToolFamily::Clang { emscripten }
.
Basically, I'm trying to say that even with#[non_exhaustive]
on the enum, it'd still be a semantic breaking change to add a new variant. - Methods allows us to do the lookup more lazily. E.g. right now we don't use the
zig_cc
variable internally, so we might actually want to callis_zig_cc
lazily instead when the user asks, but that would be harder if we exposedfamily
.
That's indeed true, we might want to reorder |
I'd prefer that, yes. |
Sorry @MarijnS95, thank you for your work but we are still too worried about the potential API breakage/subpar API, we will close this PR for now and I will cut a new release. |
Ugh, thanks for nothing. If I had known this wouldn't be merged - closed without proper discussion even - I would have at the very least reverted #1357 again. Now we're stuck with In the end in Any of the
Sure, we could have debated that before jumping the gun.
Can you explain why? Do they currently resolve to
If the wrong thing currently resolves to the wrong variant, sure... I didn't expect to have to fix/clean up this popular library though.
In |
Hmmm maybe we can add another |
Sorry about the closing, I thought that we just don't want to expose it now and didn't think more of this as it was late for me. Perhaps I should wait a bit longer for more feedback instead of rushing |
It would be awesome to implement #882, to provide "use MSVC-provided clang-cl instead of cl.exe" and "use MSVC-provided clang-cl instead of cl.exe" APIs, which would also do the job of discovering where clang.exe/clang-cl.exe live so they don't have to be in |
Let me have a look, I think that's possible. |
I wasn't aware of #882, moving the burden to switch compilers (and all complication that comes with detecting it, rather than pushing it out to users via documentation that encourages them to modify Let's investigate that before adding |
Instead of adding a new
is_like_xxx()
function every time new information is needed, or new enumeration variants would be added, provide the (nownon_exhaustive
)enum
directly to callers to match what they're interested in.Also removes
is_like_clang_cl()
again from #1357 since that did not yet make it into a release, and would only cause unnecessary duplication in our API patterns.