File tree 3 files changed +62
-6
lines changed
3 files changed +62
-6
lines changed Original file line number Diff line number Diff line change @@ -475,7 +475,11 @@ where
475
475
None => None ,
476
476
} ;
477
477
let vers = vers. as_ref ( ) . map ( |s| & * * s) ;
478
- let dep = Dependency :: parse_no_deprecated ( name, vers, source. source_id ( ) ) ?;
478
+ let dep = Dependency :: parse_no_deprecated (
479
+ name,
480
+ Some ( vers. unwrap_or ( "*" ) ) ,
481
+ source. source_id ( ) ,
482
+ ) ?;
479
483
let deps = source. query_vec ( & dep) ?;
480
484
match deps. iter ( ) . map ( |p| p. package_id ( ) ) . max ( ) {
481
485
Some ( pkgid) => {
Original file line number Diff line number Diff line change @@ -113,17 +113,20 @@ error: some crates failed to install
113
113
114
114
#[ test]
115
115
fn pick_max_version ( ) {
116
- pkg ( "foo" , "0.0.1" ) ;
117
- pkg ( "foo" , "0.0.2" ) ;
116
+ pkg ( "foo" , "0.1.0" ) ;
117
+ pkg ( "foo" , "0.2.0" ) ;
118
+ pkg ( "foo" , "0.2.1" ) ;
119
+ pkg ( "foo" , "0.2.1-pre.1" ) ;
120
+ pkg ( "foo" , "0.3.0-pre.2" ) ;
118
121
119
122
assert_that (
120
123
cargo_process ( "install" ) . arg ( "foo" ) ,
121
124
execs ( ) . with_status ( 0 ) . with_stderr ( & format ! (
122
125
"\
123
126
[UPDATING] registry `[..]`
124
- [DOWNLOADING] foo v0.0.2 (registry [..])
125
- [INSTALLING] foo v0.0.2
126
- [COMPILING] foo v0.0.2
127
+ [DOWNLOADING] foo v0.2.1 (registry [..])
128
+ [INSTALLING] foo v0.2.1
129
+ [COMPILING] foo v0.2.1
127
130
[FINISHED] release [optimized] target(s) in [..]
128
131
[INSTALLING] {home}[..]bin[..]foo[..]
129
132
warning: be sure to add `[..]` to your PATH to be able to run the installed binaries
Original file line number Diff line number Diff line change @@ -1109,3 +1109,52 @@ fn patch_depends_on_another_patch() {
1109
1109
execs ( ) . with_status ( 0 ) . with_stderr ( "[FINISHED] [..]" ) ,
1110
1110
) ;
1111
1111
}
1112
+
1113
+ #[ test]
1114
+ fn replace_prerelease ( ) {
1115
+ Package :: new ( "bar" , "1.1.0-pre.1" ) . publish ( ) ;
1116
+ let p = project ( "foo" )
1117
+ . file (
1118
+ "Cargo.toml" ,
1119
+ r#"
1120
+ [workspace]
1121
+ members = ["foo"]
1122
+
1123
+ [patch.crates-io]
1124
+ bar = { path = "./bar" }
1125
+ "# ,
1126
+ )
1127
+ . file (
1128
+ "foo/Cargo.toml" ,
1129
+ r#"
1130
+ [project]
1131
+ name = "foo"
1132
+ version = "0.5.0"
1133
+ authors = []
1134
+
1135
+ [dependencies]
1136
+ bar = "1.1.0-pre.1"
1137
+ "# ,
1138
+ )
1139
+ . file (
1140
+ "foo/src/main.rs" ,
1141
+ "
1142
+ extern crate bar;
1143
+ fn main() { bar::bar() }
1144
+ " ,
1145
+ )
1146
+ . file (
1147
+ "bar/Cargo.toml" ,
1148
+ r#"
1149
+ [project]
1150
+ name = "bar"
1151
+ version = "1.1.0-pre.1"
1152
+ authors = []
1153
+ [workspace]
1154
+ "# ,
1155
+ )
1156
+ . file ( "bar/src/lib.rs" , "pub fn bar() {}" )
1157
+ . build ( ) ;
1158
+
1159
+ assert_that ( p. cargo ( "build" ) , execs ( ) . with_status ( 0 ) ) ;
1160
+ }
You can’t perform that action at this time.
0 commit comments