@@ -51,7 +51,7 @@ pub struct Resolve {
51
51
52
52
/// A version to indicate how a `Cargo.lock` should be serialized.
53
53
///
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.
55
55
/// If an old version of lockfile already exists, it will stay as-is.
56
56
///
57
57
/// It's important that if a new version is added that this is not updated
@@ -67,7 +67,7 @@ pub struct Resolve {
67
67
///
68
68
/// It's theorized that we can add more here over time to track larger changes
69
69
/// 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 ) ]
71
71
pub enum ResolveVersion {
72
72
/// Historical baseline for when this abstraction was added.
73
73
V1 ,
@@ -81,7 +81,6 @@ pub enum ResolveVersion {
81
81
/// `branch = "master"` are no longer encoded the same way as those without
82
82
/// branch specifiers. Introduced in 2020 in version 1.47. New lockfiles use
83
83
/// V3 by default staring in 1.53.
84
- #[ default]
85
84
V3 ,
86
85
/// SourceId URL serialization is aware of URL encoding. For example,
87
86
/// `?branch=foo bar` is now encoded as `?branch=foo+bar` and can be decoded
@@ -94,6 +93,17 @@ pub enum ResolveVersion {
94
93
}
95
94
96
95
impl 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
+
97
107
/// The maximum version of lockfile made into the stable channel.
98
108
///
99
109
/// Any version larger than this needs `-Znext-lockfile-bump` to enable.
0 commit comments