@@ -6028,25 +6028,28 @@ fn registry_inferred_from_unique_option() {
6028
6028
6029
6029
p. cargo ( "package -Zpackage-workspace" )
6030
6030
. masquerade_as_nightly_cargo ( & [ "package-workspace" ] )
6031
- . with_status ( 101 )
6032
6031
. with_stderr_data ( str![ [ r#"
6033
6032
[PACKAGING] dep v0.1.0 ([ROOT]/foo/dep)
6034
6033
[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
6035
6034
[PACKAGING] main v0.0.1 ([ROOT]/foo/main)
6036
6035
[UPDATING] `alternative` index
6037
- [ERROR] failed to prepare local package for uploading
6038
-
6039
- Caused by:
6040
- no matching package named `dep` found
6041
- location searched: registry `alternative`
6042
- required by package `main v0.0.1 ([ROOT]/foo/main)`
6036
+ [PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
6037
+ [VERIFYING] dep v0.1.0 ([ROOT]/foo/dep)
6038
+ [COMPILING] dep v0.1.0 ([ROOT]/foo/target/package/dep-0.1.0)
6039
+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
6040
+ [VERIFYING] main v0.0.1 ([ROOT]/foo/main)
6041
+ [UPDATING] `alternative` index
6042
+ [UNPACKING] dep v0.1.0 (registry `[ROOT]/foo/target/package/tmp-registry`)
6043
+ [COMPILING] dep v0.1.0 (registry `alternative`)
6044
+ [COMPILING] main v0.0.1 ([ROOT]/foo/target/package/main-0.0.1)
6045
+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
6043
6046
6044
6047
"# ] ] )
6045
6048
. run ( ) ;
6046
6049
}
6047
6050
6048
6051
#[ cargo_test]
6049
- fn registry_not_inferred_because_of_missing_option ( ) {
6052
+ fn registry_not_inferred_because_of_conflict ( ) {
6050
6053
let alt_reg = registry:: RegistryBuilder :: new ( )
6051
6054
. http_api ( )
6052
6055
. http_index ( )
@@ -6100,8 +6103,7 @@ fn registry_not_inferred_because_of_missing_option() {
6100
6103
. masquerade_as_nightly_cargo ( & [ "package-workspace" ] )
6101
6104
. with_status ( 101 )
6102
6105
. with_stderr_data ( str![ [ r#"
6103
- [ERROR] `dep` cannot be packaged.
6104
- The registry `crates-io` is not listed in the `package.publish` value in Cargo.toml.
6106
+ [ERROR] conflicts between `package.publish` fields in the selected packages
6105
6107
6106
6108
"# ] ] )
6107
6109
. run ( ) ;
@@ -6121,10 +6123,21 @@ The registry `alternative` is not listed in the `package.publish` value in Cargo
6121
6123
alt_reg. index_url( )
6122
6124
) )
6123
6125
. masquerade_as_nightly_cargo ( & [ "package-workspace" ] )
6124
- . with_status ( 101 )
6125
6126
. with_stderr_data ( str![ [ r#"
6126
- [ERROR] `dep` cannot be packaged.
6127
- The registry `crates-io` is not listed in the `package.publish` value in Cargo.toml.
6127
+ [PACKAGING] dep v0.1.0 ([ROOT]/foo/dep)
6128
+ [PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
6129
+ [PACKAGING] main v0.0.1 ([ROOT]/foo/main)
6130
+ [UPDATING] `alternative` index
6131
+ [PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
6132
+ [VERIFYING] dep v0.1.0 ([ROOT]/foo/dep)
6133
+ [COMPILING] dep v0.1.0 ([ROOT]/foo/target/package/dep-0.1.0)
6134
+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
6135
+ [VERIFYING] main v0.0.1 ([ROOT]/foo/main)
6136
+ [UPDATING] `alternative` index
6137
+ [UNPACKING] dep v0.1.0 (registry `[ROOT]/foo/target/package/tmp-registry`)
6138
+ [COMPILING] dep v0.1.0 (registry `alternative`)
6139
+ [COMPILING] main v0.0.1 ([ROOT]/foo/target/package/main-0.0.1)
6140
+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
6128
6141
6129
6142
"# ] ] )
6130
6143
. run ( ) ;
@@ -6143,7 +6156,7 @@ fn registry_not_inferred_because_of_multiple_options() {
6143
6156
"Cargo.toml" ,
6144
6157
r#"
6145
6158
[workspace]
6146
- members = ["dep", "main", "other" ]
6159
+ members = ["dep", "main"]
6147
6160
"# ,
6148
6161
)
6149
6162
. file (
@@ -6179,29 +6192,13 @@ fn registry_not_inferred_because_of_multiple_options() {
6179
6192
"# ,
6180
6193
)
6181
6194
. file ( "dep/src/lib.rs" , "" )
6182
- // No publish field means "publish anywhere"
6183
- . file (
6184
- "other/Cargo.toml" ,
6185
- r#"
6186
- [package]
6187
- name = "other"
6188
- version = "0.1.0"
6189
- edition = "2015"
6190
- authors = []
6191
- license = "MIT"
6192
- description = "dep"
6193
- repository = "bar"
6194
- "# ,
6195
- )
6196
- . file ( "other/src/lib.rs" , "" )
6197
6195
. build ( ) ;
6198
6196
6199
6197
p. cargo ( "package -Zpackage-workspace" )
6200
6198
. masquerade_as_nightly_cargo ( & [ "package-workspace" ] )
6201
6199
. with_status ( 101 )
6202
6200
. with_stderr_data ( str![ [ r#"
6203
- [ERROR] `dep` cannot be packaged.
6204
- The registry `crates-io` is not listed in the `package.publish` value in Cargo.toml.
6201
+ [ERROR] --registry is required to disambiguate between "alternative" or "alternative2" registries
6205
6202
6206
6203
"# ] ] )
6207
6204
. run ( ) ;
@@ -6214,8 +6211,6 @@ The registry `crates-io` is not listed in the `package.publish` value in Cargo.t
6214
6211
[PACKAGING] main v0.0.1 ([ROOT]/foo/main)
6215
6212
[UPDATING] `alternative` index
6216
6213
[PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
6217
- [PACKAGING] other v0.1.0 ([ROOT]/foo/other)
6218
- [PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
6219
6214
[VERIFYING] dep v0.1.0 ([ROOT]/foo/dep)
6220
6215
[COMPILING] dep v0.1.0 ([ROOT]/foo/target/package/dep-0.1.0)
6221
6216
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
@@ -6225,16 +6220,13 @@ The registry `crates-io` is not listed in the `package.publish` value in Cargo.t
6225
6220
[COMPILING] dep v0.1.0 (registry `alternative`)
6226
6221
[COMPILING] main v0.0.1 ([ROOT]/foo/target/package/main-0.0.1)
6227
6222
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
6228
- [VERIFYING] other v0.1.0 ([ROOT]/foo/other)
6229
- [COMPILING] other v0.1.0 ([ROOT]/foo/target/package/other-0.1.0)
6230
- [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
6231
6223
6232
6224
"# ] ] )
6233
6225
. run ( ) ;
6234
6226
}
6235
6227
6236
6228
#[ cargo_test]
6237
- fn registry_not_inferred_because_of_conflict ( ) {
6229
+ fn registry_not_inferred_because_of_mismatch ( ) {
6238
6230
let _alt_reg = registry:: RegistryBuilder :: new ( )
6239
6231
. http_api ( )
6240
6232
. http_index ( )
@@ -6267,6 +6259,8 @@ fn registry_not_inferred_because_of_conflict() {
6267
6259
"# ,
6268
6260
)
6269
6261
. file ( "main/src/main.rs" , "fn main() {}" )
6262
+ // No `publish` field means "any registry", but the presence of this package
6263
+ // will stop us from inferring a registry.
6270
6264
. file (
6271
6265
"dep/Cargo.toml" ,
6272
6266
r#"
@@ -6278,7 +6272,6 @@ fn registry_not_inferred_because_of_conflict() {
6278
6272
license = "MIT"
6279
6273
description = "dep"
6280
6274
repository = "bar"
6281
- publish = ["alternative2"]
6282
6275
"# ,
6283
6276
)
6284
6277
. file ( "dep/src/lib.rs" , "" )
@@ -6288,18 +6281,28 @@ fn registry_not_inferred_because_of_conflict() {
6288
6281
. masquerade_as_nightly_cargo ( & [ "package-workspace" ] )
6289
6282
. with_status ( 101 )
6290
6283
. with_stderr_data ( str![ [ r#"
6291
- [ERROR] `dep` cannot be packaged.
6292
- The registry `crates-io` is not listed in the `package.publish` value in Cargo.toml.
6284
+ [ERROR] --registry is required because not all `package.publish` settings agree
6293
6285
6294
6286
"# ] ] )
6295
6287
. run ( ) ;
6296
6288
6297
6289
p. cargo ( "package -Zpackage-workspace --registry=alternative" )
6298
6290
. masquerade_as_nightly_cargo ( & [ "package-workspace" ] )
6299
- . with_status ( 101 )
6300
6291
. with_stderr_data ( str![ [ r#"
6301
- [ERROR] `dep` cannot be packaged.
6302
- The registry `alternative` is not listed in the `package.publish` value in Cargo.toml.
6292
+ [PACKAGING] dep v0.1.0 ([ROOT]/foo/dep)
6293
+ [PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
6294
+ [PACKAGING] main v0.0.1 ([ROOT]/foo/main)
6295
+ [UPDATING] `alternative` index
6296
+ [PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
6297
+ [VERIFYING] dep v0.1.0 ([ROOT]/foo/dep)
6298
+ [COMPILING] dep v0.1.0 ([ROOT]/foo/target/package/dep-0.1.0)
6299
+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
6300
+ [VERIFYING] main v0.0.1 ([ROOT]/foo/main)
6301
+ [UPDATING] `alternative` index
6302
+ [UNPACKING] dep v0.1.0 (registry `[ROOT]/foo/target/package/tmp-registry`)
6303
+ [COMPILING] dep v0.1.0 (registry `alternative`)
6304
+ [COMPILING] main v0.0.1 ([ROOT]/foo/target/package/main-0.0.1)
6305
+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
6303
6306
6304
6307
"# ] ] )
6305
6308
. run ( ) ;
0 commit comments