-
Notifications
You must be signed in to change notification settings - Fork 461
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. |
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.