Skip to content
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

Tracking issue: Checking cross-crate items #638

Open
Tracked by #61
obi1kenobi opened this issue Jan 19, 2024 · 0 comments
Open
Tracked by #61

Tracking issue: Checking cross-crate items #638

obi1kenobi opened this issue Jan 19, 2024 · 0 comments
Labels
C-enhancement Category: raise the bar on expectations

Comments

@obi1kenobi
Copy link
Owner

obi1kenobi commented Jan 19, 2024

cargo-semver-checks currently only generates and analyzes a single crate's rustdoc JSON at a time. If that crate's public API exposes or relies on items from other crates, those foreign items are not present in the rustdoc JSON we get to see.

This can cause both false-positives (e.g. #609) and false-negatives (e.g. #629).

The purpose of this issue is to have a single place to link to when this conversation comes up, and to have a single location where interested folks can track progress.

The underlying technical reasons for the lack of cross-crate checking are the following:

  • Rustdoc doesn't inline re-exported items across crates. This used to be the case, but was removed because it was causing lots of bugs and other kinds of unpleasantness.
  • There's currently no reliable way to determine which dependency (including crate and exact version, to distinguish between multiple major versions) a cross-crate item came from. There has been interest in adding such a mechanism, though progress seems to have slowed recently: Add a new --orchestrator-id flag to rustc rust-lang/compiler-team#635
  • After such a mechanism is added, there will still be probably 3-6 person-months of work needed on the cargo-semver-checks side: we'll need to analyze each rustdoc JSON to find 3rd party crates whose rustdoc JSON we also need, and recursively generate more rustdoc JSON until we've resolved all items in the public API we're scanning. Such a large investment of time would require finding a more permanent source of funding for the project — sponsoring me on GitHub is the way to do that. When I can cover rent with cargo-semver-checks, I'll be much more able to work on time-consuming improvements like this.

A note on resolver v1 vs v2: using cargo metadata implicitly uses resolver v1 (regardless of the resolver version selected by the crate), which in some cases may disagree on which features are enabled in downstream crates for crates that use resolver v2. When we analyze more broadly across the dependency graph, keep this in mind and make sure we get this right.

@obi1kenobi obi1kenobi added the C-enhancement Category: raise the bar on expectations label Jan 19, 2024
@obi1kenobi obi1kenobi pinned this issue Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: raise the bar on expectations
Projects
None yet
Development

No branches or pull requests

1 participant