Skip to content

Setup cargo-semver-checks #4603

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

weiznich
Copy link
Member

This commit sets up a xtask for cargo-semver-checks and integrates it in our CI. It also fixes 2 instances of reported breakage. With that there are still 3 more instances reported. I believe two of them are false positives (The Downcast super trait and the IntoArrayExpression trait message). The third one is a "real" breakage, but I would nevertheless say that this will likely not affect anyone as I do not see any reasonable way to to do something with a trait object there at all.

I'm still not sure what's the correct way to supress such errors only at specific locations.

Marked as draft as the other instances need to be addressed before merging.

@weiznich weiznich requested a review from a team May 16, 2025 16:18
This commit sets up a xtask for cargo-semver-checks and integrates it in
our CI. It also fixes 2 instances of reported breakage. With that there
are still 3 more instances reported. I believe two of them are false
positives (The `Downcast` super trait and the `IntoArrayExpression`
trait message). The third one is a "real" breakage, but I would
nevertheless say that this will likely not affect anyone as I do not see
any reasonable way to to do something with a trait object there at all.

I'm still not sure what's the correct way to supress such errors only at
specific locations.
@weiznich weiznich force-pushed the ci/cargo-semver-checks branch from 5f4456e to 097fa47 Compare May 16, 2025 16:31
@weiznich
Copy link
Member Author

For reference currently the following "breaking" changes are reported:


Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/inherent_method_missing.ron

Failed in:
  SerializedDatabase::new, previously in file /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/diesel-2.2.0/src/sqlite/connection/serialized_database.rs:16

We merged that one deliberately as "bug fix" as this was not supposed to be public and this was unsound.

--- failure trait_added_supertrait: non-sealed trait added new supertraits ---

Description:
A non-sealed trait added one or more supertraits, which breaks downstream implementations of the trait
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#generic-bounds-tighten
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/trait_added_supertrait.ron

Failed in:
  trait diesel::connection::Instrumentation gained Downcast in file /home/runner/work/diesel/diesel/diesel/src/connection/instrumentation.rs:246

I believe that's a false positive for the reasons discussed in #4129 (comment)

--- failure trait_no_longer_dyn_compatible: trait no longer dyn compatible ---

Description:
Trait is no longer dyn compatible, which breaks `dyn Trait` usage.
        ref: https://doc.rust-lang.org/stable/reference/items/traits.html#object-safety
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/trait_no_longer_dyn_compatible.ron

Failed in:
  trait SqlOrd in file /home/runner/work/diesel/diesel/diesel/src/sql_types/ord.rs:7

     Summary semver requires new major version: 4 major and 0 minor checks failed
  trait SqlType in file /home/runner/work/diesel/diesel/diesel/src/sql_types/mod.rs:671
  trait Foldable in file /home/runner/work/diesel/diesel/diesel/src/sql_types/fold.rs:4
  trait SingleValue in file /home/runner/work/diesel/diesel/diesel/src/sql_types/mod.rs:655

It's correct that this is "breaking" but I would assume that nobody notice this as there as nothing usful what you could do with such a trait object.

--- failure trait_now_doc_hidden: pub trait is now #[doc(hidden)] ---

Description:
A pub trait is now #[doc(hidden)], removing it from the crate's public API.
        ref: https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html#hidden
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/trait_now_doc_hidden.ron

That seems to be a bug as that item is not public on the old version either. Filled as obi1kenobi/cargo-semver-checks#1267

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant