cargo-semver-checks: Semver errors when exposing types from 3rd party crates that are not at the latest version
Scenario:
- Crate
Ahas a dependency on crateB = "1.0"and exposes crateB’s types in its own public API. - The lockfile for crate
Acurrently usingBversion1.0. Version1.1ofBexists and contains additional pub methods on its pub types. - The current version of
Ais semver-checked using the default (registry-based) baseline:- The current rustdoc will use
B v1.0and will show the v1.0 methods fromBas part ofA’s public API. - The baseline rustdoc for
Awill be generated, which will cause a new lockfile to be created with the latest allowed version ofB: v1.1. - The baseline’s public API for
Awill show additional methods that don’t exist in the current version: those added inB v1.1but not present in `B v1.0. - cargo-semver-checks will report those as major breaking changes.
- The current rustdoc will use
Steps to reproduce the bug with the above code
Checkout https://github.com/servo/core-foundation-rs/tree/cocoa-v0.24.1/cocoa
Run rustup run nightly cargo semver-checks check-release
Actual Behaviour
--- failure inherent_method_missing: pub method removed or renamed ---
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-check/tree/v0.12.0/src/queries/inherent_method_missing.ron
Failed in:
NSEventMask::from_bits_unchecked, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2334
NSEventMask::intersection, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2334
NSEventMask::union, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2334
NSEventMask::difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2334
NSEventMask::symmetric_difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2334
NSEventMask::complement, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2334
NSWindowOcclusionState::from_bits_unchecked, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:896
NSWindowOcclusionState::intersection, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:896
NSWindowOcclusionState::union, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:896
NSWindowOcclusionState::difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:896
NSWindowOcclusionState::symmetric_difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:896
NSWindowOcclusionState::complement, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:896
NSEventSwipeTrackingOptions::from_bits_unchecked, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2259
NSEventSwipeTrackingOptions::intersection, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2259
NSEventSwipeTrackingOptions::union, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2259
NSEventSwipeTrackingOptions::difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2259
NSEventSwipeTrackingOptions::symmetric_difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2259
NSEventSwipeTrackingOptions::complement, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2259
NSApplicationPresentationOptions::from_bits_unchecked, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:185
NSApplicationPresentationOptions::intersection, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:185
NSApplicationPresentationOptions::union, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:185
NSApplicationPresentationOptions::difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:185
NSApplicationPresentationOptions::symmetric_difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:185
NSApplicationPresentationOptions::complement, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:185
NSWindowOrderingMode::from_bits_unchecked, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:252
NSWindowOrderingMode::intersection, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:252
NSWindowOrderingMode::union, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:252
NSWindowOrderingMode::difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:252
NSWindowOrderingMode::symmetric_difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:252
NSWindowOrderingMode::complement, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:252
AutoresizingMask::from_bits_unchecked, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/quartzcore.rs:1359
AutoresizingMask::intersection, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/quartzcore.rs:1359
AutoresizingMask::union, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/quartzcore.rs:1359
AutoresizingMask::difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/quartzcore.rs:1359
AutoresizingMask::symmetric_difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/quartzcore.rs:1359
AutoresizingMask::complement, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/quartzcore.rs:1359
CornerMask::from_bits_unchecked, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/quartzcore.rs:1350
CornerMask::intersection, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/quartzcore.rs:1350
CornerMask::union, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/quartzcore.rs:1350
CornerMask::difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/quartzcore.rs:1350
CornerMask::symmetric_difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/quartzcore.rs:1350
CornerMask::complement, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/quartzcore.rs:1350
NSWindowCollectionBehavior::from_bits_unchecked, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:878
NSWindowCollectionBehavior::intersection, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:878
NSWindowCollectionBehavior::union, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:878
NSWindowCollectionBehavior::difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:878
NSWindowCollectionBehavior::symmetric_difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:878
NSWindowCollectionBehavior::complement, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:878
NSEventPhase::from_bits_unchecked, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2273
NSEventPhase::intersection, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2273
NSEventPhase::union, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2273
NSEventPhase::difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2273
NSEventPhase::symmetric_difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2273
NSEventPhase::complement, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2273
NSAlignmentOptions::from_bits_unchecked, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:260
NSAlignmentOptions::intersection, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:260
NSAlignmentOptions::union, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:260
NSAlignmentOptions::difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:260
NSAlignmentOptions::symmetric_difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:260
NSAlignmentOptions::complement, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:260
NSTouchPhase::from_bits_unchecked, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2285
NSTouchPhase::intersection, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2285
NSTouchPhase::union, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2285
NSTouchPhase::difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2285
NSTouchPhase::symmetric_difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2285
NSTouchPhase::complement, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2285
NSWindowStyleMask::from_bits_unchecked, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:203
NSWindowStyleMask::intersection, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:203
NSWindowStyleMask::union, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:203
NSWindowStyleMask::difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:203
NSWindowStyleMask::symmetric_difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:203
NSWindowStyleMask::complement, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:203
NSEventModifierFlags::from_bits_unchecked, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2375
NSEventModifierFlags::intersection, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2375
NSEventModifierFlags::union, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2375
NSEventModifierFlags::difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2375
NSEventModifierFlags::symmetric_difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2375
NSEventModifierFlags::complement, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:2375
EdgeAntialiasingMask::from_bits_unchecked, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/quartzcore.rs:1341
EdgeAntialiasingMask::intersection, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/quartzcore.rs:1341
EdgeAntialiasingMask::union, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/quartzcore.rs:1341
EdgeAntialiasingMask::difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/quartzcore.rs:1341
EdgeAntialiasingMask::symmetric_difference, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/quartzcore.rs:1341
EdgeAntialiasingMask::complement, previously in file /Users/jrmuizel/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/quartzcore.rs:1341
Final [ 2.753s] semver requires new major version: 1 major and 0 minor checks failed
Expected Behaviour
No changes should be found when no changes have been made
Additional Context
It seems like things are getting confused by the bitflags macro
Debug Output
No response
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 24 (15 by maintainers)
Commits related to this issue
- Explicitly `cargo update` in path dependency workspaces. Resolves a variant of #167 described here: https://github.com/obi1kenobi/cargo-semver-checks/issues/167#issuecomment-2324959305 This issue wa... — committed to obi1kenobi/cargo-semver-checks by obi1kenobi 2 years ago
- Explicitly `cargo update` in path dependency workspaces. Resolves a variant of #167 described here: https://github.com/obi1kenobi/cargo-semver-checks/issues/167#issuecomment-2324959305 This issue wa... — committed to obi1kenobi/cargo-semver-checks by obi1kenobi 2 years ago
- Explicitly `cargo update` in path dependency workspaces. (#901) Resolves a variant of #167 described here: https://github.com/obi1kenobi/cargo-semver-checks/issues/167#issuecomment-2324959305 This i... — committed to obi1kenobi/cargo-semver-checks by obi1kenobi 2 years ago
It does resolve the issue.
When I run
maincargo-semver-checks oncocoa-v0.24.1with bitflags flags set to v1.0.4 in my Cargo.lock it correctly returns no changes.Unfortunately, I don’t think so. The current version rustdoc information (which
cargo-semver-checksuses as input) is built bycargo docwhich relies on the localCargo.lockfile. Ifcargo-semver-checksran acargo updatecommand to move all the dependency versions forward in thatcargo doccall, that would also result in an editedCargo.lockfile which I feel users would find unexpected and undesirable.You may be able to work around this on your end by running something like:
It’s also worth considering that the semver issue uncovered here can also arise in actual usage as well:
cocoa.bitflagsto an older version, like1.0.4.bitflags v1.0.4.cocoa, getting back abitflagstype, and then calling a method on it that was added later thanbitflags v1.0.4.If the above scenario is a concern, it may be worth specifying a newer minimum version bound on
cocoa’sbitflagsdependency to avoid it.