@@ -1567,15 +1567,20 @@ fn too_many_matches() {
1567
1567
1568
1568
// Picks 0.1.1, the most recent version.
1569
1569
p. cargo ( "check" )
1570
+ . with_status ( 101 )
1570
1571
. with_stderr (
1571
1572
"\
1572
1573
[UPDATING] `[..]/alternative-registry` index
1573
- [UPDATING] `[..]/registry` index
1574
- [DOWNLOADING] crates ...
1575
- [DOWNLOADED] bar v0.1.1 (registry `[..]/alternative-registry`)
1576
- [CHECKING] bar v0.1.1 (registry `[..]/alternative-registry`)
1577
- [CHECKING] foo v0.1.0 ([..]/foo)
1578
- [FINISHED] [..]
1574
+ [ERROR] failed to resolve patches for `https://github.com/rust-lang/crates.io-index`
1575
+
1576
+ Caused by:
1577
+ patch for `bar` in `https://github.com/rust-lang/crates.io-index` failed to resolve
1578
+
1579
+ Caused by:
1580
+ patch for `bar` in `registry `[..]/alternative-registry`` resolved to more than one candidate
1581
+ Found versions: 0.1.0, 0.1.1
1582
+ Update the patch definition to select only one package.
1583
+ For example, add an `=` version requirement to the patch definition, such as `version = \" =0.1.1\" `.
1579
1584
" ,
1580
1585
)
1581
1586
. run ( ) ;
@@ -1611,7 +1616,7 @@ fn no_matches() {
1611
1616
error: failed to resolve patches for `https://github.com/rust-lang/crates.io-index`
1612
1617
1613
1618
Caused by:
1614
- patch for `bar` in `https://github.com/rust-lang/crates.io-index` did not resolve to any crates
1619
+ patch for `bar` in `https://github.com/rust-lang/crates.io-index` failed to resolve
1615
1620
1616
1621
Caused by:
1617
1622
The patch location `[..]/foo/bar` does not appear to contain any packages matching the name `bar`.
@@ -1650,7 +1655,7 @@ fn mismatched_version() {
1650
1655
[ERROR] failed to resolve patches for `https://github.com/rust-lang/crates.io-index`
1651
1656
1652
1657
Caused by:
1653
- patch for `bar` in `https://github.com/rust-lang/crates.io-index` did not resolve to any crates
1658
+ patch for `bar` in `https://github.com/rust-lang/crates.io-index` failed to resolve
1654
1659
1655
1660
Caused by:
1656
1661
The patch location `[..]/foo/bar` contains a `bar` package with version `0.1.0`, \
@@ -1760,7 +1765,7 @@ fn patch_walks_backwards_restricted() {
1760
1765
error: failed to resolve patches for `https://github.com/rust-lang/crates.io-index`
1761
1766
1762
1767
Caused by:
1763
- patch for `bar` in `https://github.com/rust-lang/crates.io-index` did not resolve to any crates
1768
+ patch for `bar` in `https://github.com/rust-lang/crates.io-index` failed to resolve
1764
1769
1765
1770
Caused by:
1766
1771
The patch location `[..]/foo/bar` contains a `bar` package with version `0.1.0`, but the patch definition requires `^0.1.1`.
@@ -1942,7 +1947,7 @@ fn can_update_with_alt_reg() {
1942
1947
bar = "0.1"
1943
1948
1944
1949
[patch.crates-io]
1945
- bar = { version = "0.1.1", registry = "alternative" }
1950
+ bar = { version = "= 0.1.1", registry = "alternative" }
1946
1951
"# ,
1947
1952
)
1948
1953
. file ( "src/lib.rs" , "" )
@@ -1967,12 +1972,42 @@ fn can_update_with_alt_reg() {
1967
1972
// Should remain locked.
1968
1973
p. cargo ( "check" ) . with_stderr ( "[FINISHED] [..]" ) . run ( ) ;
1969
1974
1975
+ // This does nothing, due to `=` requirement.
1970
1976
p. cargo ( "update -p bar" )
1971
1977
. with_stderr (
1972
1978
"\
1973
1979
[UPDATING] `[..]/alternative-registry` index
1974
1980
[UPDATING] `[..]/registry` index
1975
- [UPDATING] bar v0.1.1 (registry `[..]/alternative-registry`) -> v0.1.2
1981
+ " ,
1982
+ )
1983
+ . run ( ) ;
1984
+
1985
+ // Bump to 0.1.2.
1986
+ p. change_file (
1987
+ "Cargo.toml" ,
1988
+ r#"
1989
+ [package]
1990
+ name = "foo"
1991
+ version = "0.1.0"
1992
+
1993
+ [dependencies]
1994
+ bar = "0.1"
1995
+
1996
+ [patch.crates-io]
1997
+ bar = { version = "=0.1.2", registry = "alternative" }
1998
+ "# ,
1999
+ ) ;
2000
+
2001
+ p. cargo ( "check" )
2002
+ . with_stderr (
2003
+ "\
2004
+ [UPDATING] `[..]/alternative-registry` index
2005
+ [UPDATING] `[..]/registry` index
2006
+ [DOWNLOADING] crates ...
2007
+ [DOWNLOADED] bar v0.1.2 (registry `[..]/alternative-registry`)
2008
+ [CHECKING] bar v0.1.2 (registry `[..]/alternative-registry`)
2009
+ [CHECKING] foo v0.1.0 ([..]/foo)
2010
+ [FINISHED] [..]
1976
2011
" ,
1977
2012
)
1978
2013
. run ( ) ;
0 commit comments