-
-
Notifications
You must be signed in to change notification settings - Fork 76
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
False positive: Items moved to another crate + re-exported from there are reported as missing #355
Comments
Hi! Thanks for the report, and sorry for the inconvenience. This is definitely a bug and "just pass" is indeed the expected outcome. The underlying cause is that somewhat recently, there was a change in the rustdoc JSON format where items defined in foreign crates are no longer inlined into the crate that re-exports them. As you can imagine, that means Of course, that doesn't make this any less of a bug. We're working on a design that should fix it, but doing this right and without completely wrecking linting performance is a bit complicated so it's taking a bit of time. Apologies! Hopefully this should be a one-off false-positive, in that once the next |
pub use
are reported as missing
Thanks a bunch for your quick response, this makes me much less anxious about continuing on this path :-) |
Of course! Thanks for opening the thoughtfully-written issue, and please keep them coming if anything else is less than optimal. We're doing our best to wrangle all the edge cases that pop up :) |
How difficult is this to implement? We don't allow merges with CI failures but from what I understand, the current workaround is to accept the false-positive and immediately do a release to "fix" things? I am happy to have a go at implementing this as I'd rather not want to build local workarounds and libp2p/rust-libp2p#3350 is not pressing. |
It's a difficult one, unfortunately. As of somewhat recently, rustdoc no longer "inlines" foreign items that are relevant, like re-exported items, implemented foreign traits, etc. This was done for sensible reasons in rustdoc, but isn't something we originally planned for in our design. The assumption that there's only a single crate's rustdoc to be generated and loaded is pretty deeply embedded and won't be easy to change. I'd say it's on the "week or two of focused work" kind of timescale. The queries are all fine and won't need to change, but we'll need to allow the Trustfall adapter implementation to build and load new rustdoc JSONs dynamically — ideally without replicating the rustdoc-building code once per adapter version. We'll need to special-case If you're still interested, I'd be happy to point you in the right direction. The work will be not just here but also in https://github.com/obi1kenobi/trustfall-rustdoc-adapter which holds the Trustfall adapters for the various rustdoc JSON format versions (one per branch). |
Thanks for outlining the approach. I am afraid that is a bit too big in scope for me to tackle. |
Item IDs (type I've discussed this issue with folks that work on rustdoc, and I believe they understand the severity of the problem and are interested in helping come up with a reasonable and more permanent solution. |
Steps to reproduce the bug with the above code
I'm moving two traits and a type from the coap-handler-implementations (v0.3.5) crate to the coap-handler (v0.1.4) crate, and pub use them in their old places.
Diff on coap-handler-implementations
Diff on coap-handler
Then running, in -implementations:
Actual Behaviour
Expected Behaviour
I'd expect either of two behaviors:
Just pass
Point out that by replacing a type (I'm not sure what the situation with a trait is) with a
pub use
d one, there comes up the risk of a third party impl'ing something for both the types, creating a similar situation with why we can't unify!
with core::convert::Infallible.I'd argue that this should only be reported as a minor issue, because there are situations in which this is practically ruled out: Like in this case, releases happen simultaneously, so a user would need to have implemented something on the -implementations trait, update, -handlers but not -implementation, add a second impl, and then update -- that borders malice.
Either way: The item is not gone, but reported as gone.
Generated System Information
Software version
cargo-semver-checks 0.17.1
Operating system
Linux 6.0.0-3-amd64
Command-line
cargo version
Compile time information
Build Configuration
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: