-
-
Notifications
You must be signed in to change notification settings - Fork 78
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
Improve UX when a deprecated #[doc(hidden)]
item is removed, since it isn't obvious why the item was public API in the first place
#971
Comments
Reproduced, and I agree with your analysis. Triaging now. Thanks for the report, and sorry for the inconvenience. I'm planning to cut a new release tomorrow, and I'll try to include a fix for this if feasible. |
Amazing, thank you! We're not blocked since we've now published 0.8.6 (which includes this change), so there's no rush on our side. |
Ah, this is actually "works as intended" because of an unfortunate interaction between deprecations and
A couple of observations here:
Here's a key property we want: if an item goes from non-hidden public API to completely deleted, then we want to report a breaking change at some point regardless of the sequence of steps taken. If we aren't careful, here's a possible sequence that could break that property:
Assuming you agree that property is valuable, then this case ("deprecated hidden item is deleted") has to be reported as breaking. AFAICT there's simply no other place to report a breaking change in the sequence above. In an ideal world, we'd have separate attributes for "not public API" and "hidden from docs.rs," where one implies the other but not vice versa. Alas, that is not Rust today. Let me know if that makes sense, and if you have any ideas on how to make the UX here better. This is hardly obvious, and I don't think the current lint explained it particularly well — even I was confused about why the lint triggered. |
Ahh interesting. Philosophically I disagree that case (2) should be supported, but I'm sure you have more experience with how these patterns are used in the wild than I do. Luckily we should rarely or even never need to deal with this again, and if we ever do, we can just manually bypass cargo-semver-checks in that one instance. So this isn't blocking us. Thanks for the analysis! |
I also dislike case (2) personally, but it's unfortunately common enough in practice that we can't realistically ignore it =/ That said, we have some options for local improvements. We can write some more refined lints that separate the "deprecated + hidden" case from the regular case. We can adjust the wording of the message that the lint displays. Etc. I'll tweak the issue title and labels, and keep it open so we can circle back to those UX improvements when we get a chance. |
#[doc(hidden)]
trait method removed#[doc(hidden)]
item is removed, since it isn't obvious why the item was public API in the first place
Which lint or lints are the issue
trait_method_missing
Known issues that might be causing this
Steps to reproduce the bug with the above code
Download google/zerocopy@0bee231 and run
cargo +1.81.0 semver-checks --baseline-version 0.8.5
.Actual Behaviour
The removed methods were previously
#[doc(hidden)]
, and so I would expect it not to be considered semver-breaking to remove them. However, I get this output:(This was originally discovered in CI.)
Expected Behaviour
I would expect removing
#[doc(hidden)]
trait methods with default implementations to not be a semver-breaking change.Verbose Lint Output
Generated System Information
cargo version
Compile time information
Cargo build configuration:
Please file an issue on GitHub reporting your bug.
Consider adding the diagnostic information above, either manually or automatically through the link below:
https://github.com/obi1kenobi/cargo-semver-checks/issues/new?labels=C-bug&template=3-bug-report.yml&sys-info=%23%23%23%23%20Software%20version%0A%0Acargo-semver-checks%200.35.0%0A%0A%23%23%23%23%20Operating%20system%0A%0AmacOS%2014.6.1%20%28Darwin%2023.6.0%29%0A%0A%23%23%23%23%20Command-line%0A%0A%60%60%60bash%0A%2FUsers%2Fjosh%2F.cargo%2Fbin%2Fcargo-semver-checks%20semver-checks%20--bugreport%20%0A%60%60%60%0A%0A%23%23%23%23%20cargo%20version%0A%0A%60%60%60%0A%3E%20cargo%20-V%20%0Acargo%201.81.0%20%282dbb1af80%202024-08-20%29%0A%60%60%60%0A%0A%23%23%23%23%20Compile%20time%20information%0A%0A-%20Profile%3A%20release%0A-%20Target%20triple%3A%20aarch64-apple-darwin%0A-%20Family%3A%20unix%0A-%20OS%3A%20macos%0A-%20Architecture%3A%20aarch64%0A-%20Pointer%20width%3A%2064%0A-%20Endian%3A%20little%0A-%20CPU%20features%3A%20aes%2Ccrc%2Cdit%2Cdotprod%2Cdpb%2Cdpb2%2Cfcma%2Cfhm%2Cflagm%2Cfp16%2Cfrintts%2Cjsconv%2Clor%2Clse%2Cneon%2Cpaca%2Cpacg%2Cpan%2Cpmuv3%2Cras%2Crcpc%2Crcpc2%2Crdm%2Csb%2Csha2%2Csha3%2Cssbs%2Cvh%0A-%20Host%3A%20aarch64-apple-darwin%0A%0A&build-config=
The text was updated successfully, but these errors were encountered: