Skip to content

Commit ef7ab8b

Browse files
committed
Auto merge of #11095 - weihanglo:update-comment-resolveversion, r=epage
Update comment about ResolveVersion default version ### What does this PR try to resolve? Point out that the current `ResolveVersion` defaults to `V3` ### How should we test and review this PR? - Introduced in 1.47.0 https://github.com/rust-lang/cargo/blob/rust-1.47.0/src/cargo/core/resolver/resolve.rs#L60-L73 - As default in 1.53.0 https://github.com/rust-lang/cargo/blob/rust-1.53.0/src/cargo/core/resolver/resolve.rs#L412 <!-- homu-ignore:end -->
2 parents 547e6d2 + d94ce9f commit ef7ab8b

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/cargo/core/resolver/resolve.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@ pub struct Resolve {
4646
summaries: HashMap<PackageId, Summary>,
4747
}
4848

49-
/// A version to indicate how a `Cargo.lock` should be serialized. Currently
50-
/// V2 is the default when creating a new lockfile. If a V1 lockfile already
51-
/// exists, it will stay as V1.
49+
/// A version to indicate how a `Cargo.lock` should be serialized.
50+
///
51+
/// When creating a new lockfile, the default version defined in
52+
/// [`ResolveVersion::default`] is used.
53+
/// If an old version of lockfile already exists, it will stay as-is.
5254
///
5355
/// It's theorized that we can add more here over time to track larger changes
5456
/// to the `Cargo.lock` format, but we've yet to see how that strategy pans out.
@@ -59,12 +61,13 @@ pub enum ResolveVersion {
5961
/// A more compact format, more amenable to avoiding source-control merge
6062
/// conflicts. The `dependencies` arrays are compressed and checksums are
6163
/// listed inline. Introduced in 2019 in version 1.38. New lockfiles use
62-
/// V2 by default starting in 1.41.
64+
/// V2 by default from 1.41 to 1.52.
6365
V2,
6466
/// A format that explicitly lists a `version` at the top of the file as
6567
/// well as changing how git dependencies are encoded. Dependencies with
6668
/// `branch = "master"` are no longer encoded the same way as those without
67-
/// branch specifiers.
69+
/// branch specifiers. Introduced in 2020 in version 1.47. New lockfiles use
70+
/// V3 by default staring in 1.53.
6871
V3,
6972
}
7073

@@ -395,7 +398,7 @@ impl fmt::Debug for Resolve {
395398
impl Default for ResolveVersion {
396399
/// The default way to encode new or updated `Cargo.lock` files.
397400
///
398-
/// It's important that if a new version of `ResolveVersion` is added that
401+
/// It's important that if a new version of [`ResolveVersion`] is added that
399402
/// this is not updated until *at least* the support for the version is in
400403
/// the stable release of Rust.
401404
///

0 commit comments

Comments
 (0)