@@ -51,7 +51,7 @@ pub struct Resolve {
5151
5252/// A version to indicate how a `Cargo.lock` should be serialized.
5353///
54- /// When creating a new lockfile, the version with `#[ default]` is used.
54+ /// When creating a new lockfile, the version in [`ResolveVersion:: default`] is used.
5555/// If an old version of lockfile already exists, it will stay as-is.
5656///
5757/// It's important that if a new version is added that this is not updated
@@ -67,7 +67,7 @@ pub struct Resolve {
6767///
6868/// It's theorized that we can add more here over time to track larger changes
6969/// to the `Cargo.lock` format, but we've yet to see how that strategy pans out.
70- #[ derive( Default , PartialEq , Eq , Clone , Copy , Debug , PartialOrd , Ord ) ]
70+ #[ derive( PartialEq , Eq , Clone , Copy , Debug , PartialOrd , Ord ) ]
7171pub enum ResolveVersion {
7272 /// Historical baseline for when this abstraction was added.
7373 V1 ,
@@ -81,7 +81,6 @@ pub enum ResolveVersion {
8181 /// `branch = "master"` are no longer encoded the same way as those without
8282 /// branch specifiers. Introduced in 2020 in version 1.47. New lockfiles use
8383 /// V3 by default staring in 1.53.
84- #[ default]
8584 V3 ,
8685 /// SourceId URL serialization is aware of URL encoding. For example,
8786 /// `?branch=foo bar` is now encoded as `?branch=foo+bar` and can be decoded
@@ -94,6 +93,17 @@ pub enum ResolveVersion {
9493}
9594
9695impl ResolveVersion {
96+ /// Gets the default lockfile version.
97+ ///
98+ /// This is intended to be private.
99+ /// You shall use [`ResolveVersion::with_rust_version`] always.
100+ ///
101+ /// Update this and the description of enum variants of [`ResolveVersion`]
102+ /// when we're changing the default lockfile version.
103+ fn default ( ) -> ResolveVersion {
104+ ResolveVersion :: V3
105+ }
106+
97107 /// The maximum version of lockfile made into the stable channel.
98108 ///
99109 /// Any version larger than this needs `-Znext-lockfile-bump` to enable.
0 commit comments