-
-
Notifications
You must be signed in to change notification settings - Fork 79
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
Enable specifying features for current and baseline #181
Comments
Hi! Thanks for checking out cargo-semver-checks and for suggesting this new feature. It seems like there's a broader need for flexibility around semver-checking. Here are a few of the other use cases I know of so far:
I think it's worth trying to solve for the more general theme here rather than trying to solve individual use cases separately (MSRV, macros, "unstable" features, etc.). One way to do that would be through a mechanism similar to clippy lints, where altered lint behaviors are applied to specific portions of the code or manifest: "MSRV is minor not major" / "don't semver-check this module" etc. The tracking issue for that is #58. What do you think? Is that a reasonable approach that would address your project's needs as well? |
aha! a
would be interesting, but it would mean I'd have to sprinkle that in a few places. There's also an issue when the feature is not additive (even though features are supposed to be additive). I'm satisfied with a mechanism like that however |
Since a goal of Do you feel like this proposed mechanism would satisfy the need described in the issue? If so, is it safe to close this issue in favor of #58 as the tracking issue for that mechanism? |
It does :) Thanks! |
Hmm, been thinking about this some more recently. The thing I actually want is to check if a specific set of features are still semver compatible. i.e have I accidentally introduced new behaviour when only feature Has this concern been captured anywhere @obi1kenobi ? |
@tonowak and I were recently discussing this as a possible near-future use case. Right now, I'm fine with reopening this issue to track the ability to specify features explicitly. It's been tangentially mentioned elsewhere, but this seems like a good issue specifically for that. |
One possible option:
|
I want to chime in because I am also facing a problem with the I am currently working on matlab-sys, which exposes bindings to the native C interface of Matlab. This C interface can be used in two slightly different, incompatible, versions, which would get toggled by a I don't know how much work it would be to allow specifying the features when running semver-checks, but it would be really helpful for me. In the simplest case you could require the user to specify all flags manually as soon as at least one is specified and then just pass them verbatim to rustdoc I suppose? |
Thanks for sharing your use case, this is very helpful when designing a complex feature like this. I had a couple of follow-up questions:
Interesting! So I'm guessing if features could be specified here, you'd just run
Out of curiosity, what happens if users specify both features? What happens if they specify neither feature? Since the resolver will enable all requested features but compile only once per major version, it's even possible to have a "diamond dependency" like this:
In this case, if Might it be better to split the |
Yes, in my case I would do just that.
C extensions using the C-API are intended to be compiled from inside Matlab with the mex command. This command sets one of both features, specifying both is an error. Upon your question I discovered it is possible to build C extensions outside of Matlab and manually For my crate I have inserted a manual The main difference between the two versions comes down to how arrays or matrices of complex numbers are handled and stored. For one feature they are managed as two different arrays, one for the real parts and one for the imaginary parts. For the other feature they are interleaved, so one array with real and complex parts in alternating order. Syntactically it would be possible to expose both features simultaneously I think, at least it works for the C-API as long as one compiles the code manually to circumvent the checks from the But I really don't think anyone should both versions at the same time. There are functions (mxGetData) with the exact same signature in both versions which return a
Yes, that could happen and as explained above I don't think mixing them is a good idea, which is why I check for that at compile time. I think that is preferable to the mess I explained in the paragraph above.
In the normal workflow with C and the Sorry for this long response with details that are not really relevant to this issue, your questions definitely gave me food for thought though. I still think being able to specify features at the command line would be nice to have and in my totally uninformed and naive imagination not too difficult to implement. |
Thanks for the context, it was definitely relevant. To build the best tool possible, it's useful for me to understand as many real-world use cases as possible — and the devil is always in the details. Much appreciated! |
v0.21 was just released and allows specifying the exact set of features to use, both by feature group (e.g. only default features) as well as at the level of individual features. Thanks for your patience! Would love to hear how it went if you get a chance to try it! |
Describe your use case
I have a crate which has a feature-flag
unsupported
which does not guarantee semver compatibility. This might not be the best contract but there's no way to makecargo semver-checks check-release
not enable--all-features
.Describe the solution you'd like
this would enable all features, except
unsupported
Alternatives, if applicable
could also work, but that would cause problems in CI as you wouldn't be able to easily specify what features are new or not. E.g in the example,
new_feature
is not in the baseline, but is part of the apiAdditional Context
No response
The text was updated successfully, but these errors were encountered: