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

Additional SemVer compatibility items. #8736

Open
2 of 43 tasks
ehuss opened this issue Sep 26, 2020 · 6 comments
Open
2 of 43 tasks

Additional SemVer compatibility items. #8736

ehuss opened this issue Sep 26, 2020 · 6 comments
Labels
A-documenting-cargo-itself Area: Cargo's documentation A-new-subcommand Area: new subcommand A-semver Area: semver specifications, version matching, etc.

Comments

@ehuss
Copy link
Contributor

ehuss commented Sep 26, 2020

This is a dump of some elements that I considered adding to the SemVer compatibility chapter, but didn't have time or knowledge to finish.

As an alternative to documentation, we could make these lints in a tool like cargo-crate-api

@ehuss ehuss added the A-documenting-cargo-itself Area: Cargo's documentation label Sep 26, 2020
@jhpratt
Copy link
Member

jhpratt commented Sep 28, 2020

Another thing that might be worth mentioning is the standback crate in the MSRV bit. It does exactly what is recommended — copies code from stdlib — but also re-exports when possible based on the compiler version in use. I created it specifically for that reason, and have yet to run into any issues. Imports are essentially identical, as a bonus.

@ehuss ehuss added the A-semver Area: semver specifications, version matching, etc. label Mar 20, 2021
@QuineDot
Copy link

  • Fundamental types, adding blanket trait impls, and the re-rebalancing RFC. There is a section on fundamental types that has changed as part of RFC 1023 and RFC 2451 that I don't fully understand.
  • Maybe discuss the impact of adding this impl has: #75180

#75180 is a blanket trait impl (and thus a major breaking change) as per RFC 2451: it's an impl for &T, but as & is fundamental, &T is not covered, and thus the impl is a blanket impl. This comment (and some of the crater results) illustrate how it can break existing downstream implementations.

@Skepfyr
Copy link

Skepfyr commented Jun 3, 2021

Another thing I believe is missing is updating dependencies whose types are part of your public API.

@epage epage added the A-new-subcommand Area: new subcommand label Mar 30, 2022
@epage
Copy link
Contributor

epage commented Apr 21, 2022

We talked about this in the cargo team meeting and we are leaning towards automating this, see #374, like with cargo-crate-api

@udoprog
Copy link

udoprog commented May 8, 2022

I don't know if this falls under here (or if there's a duplicate issue or any prior discussion), but due to the way that the cargo resolver currently works removing a feature flag even from a non-public dependency appears to constitute a breaking change.

Consider crate a and b:

[package]
name = "a"
version = "1.0.0"

[dependencies]
uuid = { version = "1.0.0", features = ["serde"] }
[package]
name = "a"

[dependencies]
a = "1.0.0"
uuid = "1.0.0"

Crate b can now use uuid::Uuid as if it implements Serialize / Deserialize since the serde feature is transitively activated.

If crate a then changes their manifest to:

[package]
name = "a"
version = "1.0.1"

[dependencies]
uuid = "1.0.0"

Once crate b updates its dependency to crate a, uuid::Uuid no longers implements the Serialize / Deserialize traits and any code which assumed so stops compiling. Removing a dependency in a constitutes removing a constraint requiring any non-default features.

If we bring -Z min-versions into the mix, removing or relaxing a dependency has additional versioning hazards since it might potentially relax a minimal version constraint.

Example of breakage in the wild: tokio-rs/tokio#4663

@RalfJung
Copy link
Member

RalfJung commented Sep 5, 2023

Compatibility of types of fields within a repr(packed) type. See rust-lang/rust#115305 (comment) and rust-lang/rust#115315.

FWIW I don't think this should lead to a docs change; it should lead to a rustc change instead, similar to rust-lang/rust#99020.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-documenting-cargo-itself Area: Cargo's documentation A-new-subcommand Area: new subcommand A-semver Area: semver specifications, version matching, etc.
Projects
None yet
Development

No branches or pull requests

7 participants