mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00

This commit enables the support added in #7070 by default. This means that gradually over time all `Cargo.lock` files will be migrated to the new format. Cargo shipped with Rust 1.38.0 supports this new lock file format, so any project using Rust 1.38.0 or above will converge quickly onto the new lock file format and continue working. The main benefit of the new format is to be more friendly to git merge conflicts. Information is deduplicated throughout the lock file to avoid verbose `depedencies` lists and the `checksum` data is all listed inline with `[[package]]`. This has been deployed with rust-lang/rust for some time now and it subjectively at least seems to have greatly reduced the amount of bouncing that happens for touching `Cargo.lock`.
35 lines
836 B
Rust
35 lines
836 B
Rust
use cargo_test_support::project;
|
|
use cargo_test_support::registry::Package;
|
|
|
|
// Ensure that the "-Z minimal-versions" CLI option works and the minimal
|
|
// version of a dependency ends up in the lock file.
|
|
#[cargo_test]
|
|
fn minimal_version_cli() {
|
|
Package::new("dep", "1.0.0").publish();
|
|
Package::new("dep", "1.1.0").publish();
|
|
|
|
let p = project()
|
|
.file(
|
|
"Cargo.toml",
|
|
r#"
|
|
[package]
|
|
name = "foo"
|
|
authors = []
|
|
version = "0.0.1"
|
|
|
|
[dependencies]
|
|
dep = "1.0"
|
|
"#,
|
|
)
|
|
.file("src/main.rs", "fn main() {}")
|
|
.build();
|
|
|
|
p.cargo("generate-lockfile -Zminimal-versions")
|
|
.masquerade_as_nightly_cargo()
|
|
.run();
|
|
|
|
let lock = p.read_lockfile();
|
|
|
|
assert!(!lock.contains("1.1.0"));
|
|
}
|