@@ -120,14 +120,14 @@ impl RegistryCredentialConfig {
120120/// `registry`, or `index` are set, then uses `crates-io`.
121121/// * `force_update`: If `true`, forces the index to be updated.
122122/// * `token_required`: If `true`, the token will be set.
123- fn registry (
124- gctx : & GlobalContext ,
123+ fn registry < ' gctx > (
124+ gctx : & ' gctx GlobalContext ,
125125 source_ids : & RegistrySourceIds ,
126126 token_from_cmdline : Option < Secret < & str > > ,
127127 reg_or_index : Option < & RegistryOrIndex > ,
128128 force_update : bool ,
129129 token_required : Option < Operation < ' _ > > ,
130- ) -> CargoResult < Registry > {
130+ ) -> CargoResult < ( Registry , RegistrySource < ' gctx > ) > {
131131 let is_index = reg_or_index. map ( |v| v. is_index ( ) ) . unwrap_or_default ( ) ;
132132 if is_index && token_required. is_some ( ) && token_from_cmdline. is_none ( ) {
133133 bail ! ( "command-line argument --index requires --token to be specified" ) ;
@@ -136,9 +136,9 @@ fn registry(
136136 auth:: cache_token_from_commandline ( gctx, & source_ids. original , token) ;
137137 }
138138
139+ let mut src = RegistrySource :: remote ( source_ids. replacement , & HashSet :: new ( ) , gctx) ?;
139140 let cfg = {
140141 let _lock = gctx. acquire_package_cache_lock ( CacheLockMode :: DownloadExclusive ) ?;
141- let mut src = RegistrySource :: remote ( source_ids. replacement , & HashSet :: new ( ) , gctx) ?;
142142 // Only update the index if `force_update` is set.
143143 if force_update {
144144 src. invalidate_cache ( )
@@ -170,11 +170,9 @@ fn registry(
170170 None
171171 } ;
172172 let handle = http_handle ( gctx) ?;
173- Ok ( Registry :: new_handle (
174- api_host,
175- token,
176- handle,
177- cfg. auth_required ,
173+ Ok ( (
174+ Registry :: new_handle ( api_host, token, handle, cfg. auth_required ) ,
175+ src,
178176 ) )
179177}
180178
0 commit comments