@@ -118,14 +118,14 @@ impl RegistryCredentialConfig {
118118/// `registry`, or `index` are set, then uses `crates-io`.
119119/// * `force_update`: If `true`, forces the index to be updated.
120120/// * `token_required`: If `true`, the token will be set.
121- fn registry (
122- gctx : & GlobalContext ,
121+ fn registry < ' gctx > (
122+ gctx : & ' gctx GlobalContext ,
123123 source_ids : & RegistrySourceIds ,
124124 token_from_cmdline : Option < Secret < & str > > ,
125125 reg_or_index : Option < & RegistryOrIndex > ,
126126 force_update : bool ,
127127 token_required : Option < Operation < ' _ > > ,
128- ) -> CargoResult < Registry > {
128+ ) -> CargoResult < ( Registry , RegistrySource < ' gctx > ) > {
129129 let is_index = reg_or_index. map ( |v| v. is_index ( ) ) . unwrap_or_default ( ) ;
130130 if is_index && token_required. is_some ( ) && token_from_cmdline. is_none ( ) {
131131 bail ! ( "command-line argument --index requires --token to be specified" ) ;
@@ -134,9 +134,9 @@ fn registry(
134134 auth:: cache_token_from_commandline ( gctx, & source_ids. original , token) ;
135135 }
136136
137+ let mut src = RegistrySource :: remote ( source_ids. replacement , & HashSet :: new ( ) , gctx) ?;
137138 let cfg = {
138139 let _lock = gctx. acquire_package_cache_lock ( CacheLockMode :: DownloadExclusive ) ?;
139- let mut src = RegistrySource :: remote ( source_ids. replacement , & HashSet :: new ( ) , gctx) ?;
140140 // Only update the index if `force_update` is set.
141141 if force_update {
142142 src. invalidate_cache ( )
@@ -168,11 +168,9 @@ fn registry(
168168 None
169169 } ;
170170 let handle = http_handle ( gctx) ?;
171- Ok ( Registry :: new_handle (
172- api_host,
173- token,
174- handle,
175- cfg. auth_required ,
171+ Ok ( (
172+ Registry :: new_handle ( api_host, token, handle, cfg. auth_required ) ,
173+ src,
176174 ) )
177175}
178176
0 commit comments