@@ -6028,25 +6028,28 @@ fn registry_inferred_from_unique_option() {
60286028
60296029 p. cargo ( "package -Zpackage-workspace" )
60306030 . masquerade_as_nightly_cargo ( & [ "package-workspace" ] )
6031- . with_status ( 101 )
60326031 . with_stderr_data ( str![ [ r#"
60336032[PACKAGING] dep v0.1.0 ([ROOT]/foo/dep)
60346033[PACKAGED] 3 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
60356034[PACKAGING] main v0.0.1 ([ROOT]/foo/main)
60366035[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
60436046
60446047"# ] ] )
60456048 . run ( ) ;
60466049}
60476050
60486051#[ cargo_test]
6049- fn registry_not_inferred_because_of_missing_option ( ) {
6052+ fn registry_not_inferred_because_of_conflict ( ) {
60506053 let alt_reg = registry:: RegistryBuilder :: new ( )
60516054 . http_api ( )
60526055 . http_index ( )
@@ -6100,8 +6103,7 @@ fn registry_not_inferred_because_of_missing_option() {
61006103 . masquerade_as_nightly_cargo ( & [ "package-workspace" ] )
61016104 . with_status ( 101 )
61026105 . 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
61056107
61066108"# ] ] )
61076109 . run ( ) ;
@@ -6121,10 +6123,21 @@ The registry `alternative` is not listed in the `package.publish` value in Cargo
61216123 alt_reg. index_url( )
61226124 ) )
61236125 . masquerade_as_nightly_cargo ( & [ "package-workspace" ] )
6124- . with_status ( 101 )
61256126 . 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
61286141
61296142"# ] ] )
61306143 . run ( ) ;
@@ -6143,7 +6156,7 @@ fn registry_not_inferred_because_of_multiple_options() {
61436156 "Cargo.toml" ,
61446157 r#"
61456158 [workspace]
6146- members = ["dep", "main", "other" ]
6159+ members = ["dep", "main"]
61476160 "# ,
61486161 )
61496162 . file (
@@ -6179,29 +6192,13 @@ fn registry_not_inferred_because_of_multiple_options() {
61796192 "# ,
61806193 )
61816194 . 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" , "" )
61976195 . build ( ) ;
61986196
61996197 p. cargo ( "package -Zpackage-workspace" )
62006198 . masquerade_as_nightly_cargo ( & [ "package-workspace" ] )
62016199 . with_status ( 101 )
62026200 . 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
62056202
62066203"# ] ] )
62076204 . run ( ) ;
@@ -6214,8 +6211,6 @@ The registry `crates-io` is not listed in the `package.publish` value in Cargo.t
62146211[PACKAGING] main v0.0.1 ([ROOT]/foo/main)
62156212[UPDATING] `alternative` index
62166213[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)
62196214[VERIFYING] dep v0.1.0 ([ROOT]/foo/dep)
62206215[COMPILING] dep v0.1.0 ([ROOT]/foo/target/package/dep-0.1.0)
62216216[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
62256220[COMPILING] dep v0.1.0 (registry `alternative`)
62266221[COMPILING] main v0.0.1 ([ROOT]/foo/target/package/main-0.0.1)
62276222[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
62316223
62326224"# ] ] )
62336225 . run ( ) ;
62346226}
62356227
62366228#[ cargo_test]
6237- fn registry_not_inferred_because_of_conflict ( ) {
6229+ fn registry_not_inferred_because_of_mismatch ( ) {
62386230 let _alt_reg = registry:: RegistryBuilder :: new ( )
62396231 . http_api ( )
62406232 . http_index ( )
@@ -6267,6 +6259,8 @@ fn registry_not_inferred_because_of_conflict() {
62676259 "# ,
62686260 )
62696261 . 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.
62706264 . file (
62716265 "dep/Cargo.toml" ,
62726266 r#"
@@ -6278,7 +6272,6 @@ fn registry_not_inferred_because_of_conflict() {
62786272 license = "MIT"
62796273 description = "dep"
62806274 repository = "bar"
6281- publish = ["alternative2"]
62826275 "# ,
62836276 )
62846277 . file ( "dep/src/lib.rs" , "" )
@@ -6288,18 +6281,28 @@ fn registry_not_inferred_because_of_conflict() {
62886281 . masquerade_as_nightly_cargo ( & [ "package-workspace" ] )
62896282 . with_status ( 101 )
62906283 . 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
62936285
62946286"# ] ] )
62956287 . run ( ) ;
62966288
62976289 p. cargo ( "package -Zpackage-workspace --registry=alternative" )
62986290 . masquerade_as_nightly_cargo ( & [ "package-workspace" ] )
6299- . with_status ( 101 )
63006291 . 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
63036306
63046307"# ] ] )
63056308 . run ( ) ;
0 commit comments