Repository navigation
ci: lint Rust dependencies using cargo deny - #7390
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
thomaseizinger
force-pushed
the
chore/cargo-deny
branch
from
November 21, 2024 01:36
50560de to
3cd7bc4
Compare
thomaseizinger
commented
Nov 21, 2024
Comment on lines
96
to
107
Member
Author
There was a problem hiding this comment.
These are all the licenses we currently depend on.
thomaseizinger
commented
Nov 21, 2024
Comment on lines
214
to
269
Member
Author
There was a problem hiding this comment.
These are all currently duplicated dependencies.
thomaseizinger
commented
Nov 21, 2024
Member
Author
There was a problem hiding this comment.
This is also different from the default config, normally git dependencies are banned but we make quite liberal use of them so I opted to set it to allow.
thomaseizinger
commented
Nov 21, 2024
Member
Author
There was a problem hiding this comment.
All our code is now explicitly licensed as Apache 2.0.
thomaseizinger
enabled auto-merge
November 21, 2024 01:38
thomaseizinger
force-pushed
the
chore/cargo-deny
branch
from
November 21, 2024 22:32
3cd7bc4 to
ad5d241
Compare
thomaseizinger
force-pushed
the
chore/cargo-deny
branch
from
November 22, 2024 00:02
0516920 to
b15db08
Compare
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One of Rust's promises is "if it compiles, it works". However, there are certain situations in which this isn't true. In particular, when using dynamic typing patterns where trait objects are downcast to concrete types, having two versions of the same dependency can silently break things.
This happened in #7379 where I forgot to patch a certain Sentry dependency. A similar problem exists with our
tracing-stackdriverdependency (see #7241).Lastly, duplicate dependencies increase the compile-times of a project, so we should aim for having as few duplicate versions of a particular dependency as possible in our dependency graph.
This PR introduces
cargo deny, a linter for Rust dependencies. In addition to linting for duplicate dependencies, it also enforces that all dependencies are compatible with an allow-list of licenses and it warns when a dependency is referred to from multiple crates without introducing a workspace dependency. Thanks to existing tooling (https://github.com/mainmatter/cargo-autoinherit), transitioning all dependencies to workspace dependencies was quite easy.Resolves: #7241.